workos 7.0.0 → 7.1.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/.github/workflows/ci.yml +1 -1
- data/.github/workflows/lint.yml +1 -1
- data/.github/workflows/release-please.yml +30 -2
- data/.github/workflows/release.yml +1 -1
- data/.last-synced-sha +1 -0
- data/.oagen-manifest.json +739 -4
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +16 -0
- data/Gemfile.lock +2 -2
- data/README.md +0 -1
- data/lib/workos/admin_portal/domain_verification_intent_options.rb +18 -0
- data/lib/workos/admin_portal/generate_link.rb +3 -3
- data/lib/workos/admin_portal/intent_options.rb +6 -2
- data/lib/workos/admin_portal.rb +3 -3
- data/lib/workos/authorization.rb +61 -67
- data/lib/workos/client.rb +8 -0
- data/lib/workos/directory_sync/directory_user_with_groups.rb +10 -2
- data/lib/workos/groups/create_group.rb +22 -0
- data/lib/workos/groups/create_group_membership.rb +18 -0
- data/lib/workos/groups/update_group.rb +7 -0
- data/lib/workos/groups.rb +256 -0
- data/lib/workos/shared/waitlist_user.rb +37 -0
- data/lib/workos/shared/waitlist_user_approved.rb +34 -0
- data/lib/workos/shared/waitlist_user_created.rb +34 -0
- data/lib/workos/shared/waitlist_user_denied.rb +34 -0
- data/lib/workos/types/create_webhook_endpoint_events.rb +4 -1
- data/lib/workos/types/groups_order.rb +9 -0
- data/lib/workos/types/sso_provider.rb +10 -1
- data/lib/workos/types/user_management_authentication_provider.rb +10 -1
- data/lib/workos/types/user_management_organization_membership_groups_order.rb +9 -0
- data/lib/workos/types/waitlist_user_state.rb +14 -0
- data/lib/workos/user_management/invitation.rb +3 -0
- data/lib/workos/user_management/invitation_accepted_data.rb +3 -0
- data/lib/workos/user_management/invitation_created_data.rb +3 -0
- data/lib/workos/user_management/invitation_resent_data.rb +3 -0
- data/lib/workos/user_management/invitation_revoked_data.rb +3 -0
- data/lib/workos/user_management/user_invite.rb +3 -0
- data/lib/workos/user_management.rb +32 -40
- data/lib/workos/user_management_organization_membership_groups.rb +60 -0
- data/lib/workos/version.rb +1 -1
- data/lib/workos.rb +4 -0
- data/rbi/workos/admin_portal.rbi +2 -2
- data/rbi/workos/authorization.rbi +13 -12
- data/rbi/workos/client.rbi +6 -0
- data/rbi/workos/create_group.rbi +30 -0
- data/rbi/workos/create_group_membership.rbi +24 -0
- data/rbi/workos/domain_verification_intent_options.rbi +24 -0
- data/rbi/workos/generate_link.rbi +2 -2
- data/rbi/workos/groups.rbi +97 -0
- data/rbi/workos/intent_options.rbi +8 -2
- data/rbi/workos/invitation.rbi +6 -0
- data/rbi/workos/invitation_accepted_data.rbi +6 -0
- data/rbi/workos/invitation_created_data.rbi +6 -0
- data/rbi/workos/invitation_resent_data.rbi +6 -0
- data/rbi/workos/invitation_revoked_data.rbi +6 -0
- data/rbi/workos/update_group.rbi +30 -0
- data/rbi/workos/user_invite.rbi +6 -0
- data/rbi/workos/user_management_organization_membership_groups.rbi +25 -0
- data/rbi/workos/waitlist_user.rbi +60 -0
- data/rbi/workos/waitlist_user_approved.rbi +54 -0
- data/rbi/workos/waitlist_user_created.rbi +54 -0
- data/rbi/workos/waitlist_user_denied.rbi +54 -0
- data/test/workos/test_authorization.rb +33 -33
- data/test/workos/test_groups.rb +89 -0
- data/test/workos/test_model_round_trip.rb +153 -24
- data/test/workos/test_user_management_organization_membership_groups.rb +33 -0
- metadata +29 -8
- data/lib/workos/user_management/urn_ietf_params_oauth_grant_type_device_code_session_authenticate_request.rb +0 -8
- data/lib/workos/user_management/urn_workos_oauth_grant_type_email_verification_code_session_authenticate_request.rb +0 -8
- data/lib/workos/user_management/urn_workos_oauth_grant_type_magic_auth_code_session_authenticate_request.rb +0 -8
- data/lib/workos/user_management/urn_workos_oauth_grant_type_mfa_totp_session_authenticate_request.rb +0 -8
- data/lib/workos/user_management/urn_workos_oauth_grant_type_organization_selection_session_authenticate_request.rb +0 -8
- /data/lib/workos/{shared → groups}/group.rb +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
# typed: strong
|
|
6
|
+
|
|
7
|
+
module WorkOS
|
|
8
|
+
class UpdateGroup
|
|
9
|
+
sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void }
|
|
10
|
+
def initialize(json); end
|
|
11
|
+
|
|
12
|
+
sig { returns(T.nilable(String)) }
|
|
13
|
+
def name; end
|
|
14
|
+
|
|
15
|
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
|
16
|
+
def name=(value); end
|
|
17
|
+
|
|
18
|
+
sig { returns(T.nilable(String)) }
|
|
19
|
+
def description; end
|
|
20
|
+
|
|
21
|
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
|
22
|
+
def description=(value); end
|
|
23
|
+
|
|
24
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
|
25
|
+
def to_h; end
|
|
26
|
+
|
|
27
|
+
sig { params(args: T.untyped).returns(String) }
|
|
28
|
+
def to_json(*args); end
|
|
29
|
+
end
|
|
30
|
+
end
|
data/rbi/workos/user_invite.rbi
CHANGED
|
@@ -69,6 +69,12 @@ module WorkOS
|
|
|
69
69
|
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
|
70
70
|
def accepted_user_id=(value); end
|
|
71
71
|
|
|
72
|
+
sig { returns(T.nilable(String)) }
|
|
73
|
+
def role_slug; end
|
|
74
|
+
|
|
75
|
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
|
76
|
+
def role_slug=(value); end
|
|
77
|
+
|
|
72
78
|
sig { returns(String) }
|
|
73
79
|
def created_at; end
|
|
74
80
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
# typed: strong
|
|
6
|
+
|
|
7
|
+
module WorkOS
|
|
8
|
+
class UserManagementOrganizationMembershipGroups
|
|
9
|
+
sig { params(client: WorkOS::BaseClient).void }
|
|
10
|
+
def initialize(client); end
|
|
11
|
+
|
|
12
|
+
sig do
|
|
13
|
+
params(
|
|
14
|
+
om_id: String,
|
|
15
|
+
before: T.nilable(String),
|
|
16
|
+
after: T.nilable(String),
|
|
17
|
+
limit: T.nilable(Integer),
|
|
18
|
+
order: T.nilable(String),
|
|
19
|
+
request_options: T::Hash[Symbol, T.untyped]
|
|
20
|
+
).returns(WorkOS::Types::ListStruct)
|
|
21
|
+
end
|
|
22
|
+
def list_organization_membership_groups(om_id:, before:, after:, limit:, order:, request_options:); end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
# typed: strong
|
|
6
|
+
|
|
7
|
+
module WorkOS
|
|
8
|
+
class WaitlistUser
|
|
9
|
+
sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void }
|
|
10
|
+
def initialize(json); end
|
|
11
|
+
|
|
12
|
+
sig { returns(String) }
|
|
13
|
+
def object; end
|
|
14
|
+
|
|
15
|
+
sig { params(value: String).returns(String) }
|
|
16
|
+
def object=(value); end
|
|
17
|
+
|
|
18
|
+
sig { returns(String) }
|
|
19
|
+
def id; end
|
|
20
|
+
|
|
21
|
+
sig { params(value: String).returns(String) }
|
|
22
|
+
def id=(value); end
|
|
23
|
+
|
|
24
|
+
sig { returns(String) }
|
|
25
|
+
def email; end
|
|
26
|
+
|
|
27
|
+
sig { params(value: String).returns(String) }
|
|
28
|
+
def email=(value); end
|
|
29
|
+
|
|
30
|
+
sig { returns(String) }
|
|
31
|
+
def state; end
|
|
32
|
+
|
|
33
|
+
sig { params(value: String).returns(String) }
|
|
34
|
+
def state=(value); end
|
|
35
|
+
|
|
36
|
+
sig { returns(T.nilable(String)) }
|
|
37
|
+
def approved_at; end
|
|
38
|
+
|
|
39
|
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
|
40
|
+
def approved_at=(value); end
|
|
41
|
+
|
|
42
|
+
sig { returns(String) }
|
|
43
|
+
def created_at; end
|
|
44
|
+
|
|
45
|
+
sig { params(value: String).returns(String) }
|
|
46
|
+
def created_at=(value); end
|
|
47
|
+
|
|
48
|
+
sig { returns(String) }
|
|
49
|
+
def updated_at; end
|
|
50
|
+
|
|
51
|
+
sig { params(value: String).returns(String) }
|
|
52
|
+
def updated_at=(value); end
|
|
53
|
+
|
|
54
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
|
55
|
+
def to_h; end
|
|
56
|
+
|
|
57
|
+
sig { params(args: T.untyped).returns(String) }
|
|
58
|
+
def to_json(*args); end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
# typed: strong
|
|
6
|
+
|
|
7
|
+
module WorkOS
|
|
8
|
+
class WaitlistUserApproved
|
|
9
|
+
sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void }
|
|
10
|
+
def initialize(json); end
|
|
11
|
+
|
|
12
|
+
sig { returns(String) }
|
|
13
|
+
def id; end
|
|
14
|
+
|
|
15
|
+
sig { params(value: String).returns(String) }
|
|
16
|
+
def id=(value); end
|
|
17
|
+
|
|
18
|
+
sig { returns(String) }
|
|
19
|
+
def event; end
|
|
20
|
+
|
|
21
|
+
sig { params(value: String).returns(String) }
|
|
22
|
+
def event=(value); end
|
|
23
|
+
|
|
24
|
+
sig { returns(WorkOS::WaitlistUser) }
|
|
25
|
+
def data; end
|
|
26
|
+
|
|
27
|
+
sig { params(value: WorkOS::WaitlistUser).returns(WorkOS::WaitlistUser) }
|
|
28
|
+
def data=(value); end
|
|
29
|
+
|
|
30
|
+
sig { returns(String) }
|
|
31
|
+
def created_at; end
|
|
32
|
+
|
|
33
|
+
sig { params(value: String).returns(String) }
|
|
34
|
+
def created_at=(value); end
|
|
35
|
+
|
|
36
|
+
sig { returns(T.nilable(WorkOS::EventContext)) }
|
|
37
|
+
def context; end
|
|
38
|
+
|
|
39
|
+
sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) }
|
|
40
|
+
def context=(value); end
|
|
41
|
+
|
|
42
|
+
sig { returns(String) }
|
|
43
|
+
def object; end
|
|
44
|
+
|
|
45
|
+
sig { params(value: String).returns(String) }
|
|
46
|
+
def object=(value); end
|
|
47
|
+
|
|
48
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
|
49
|
+
def to_h; end
|
|
50
|
+
|
|
51
|
+
sig { params(args: T.untyped).returns(String) }
|
|
52
|
+
def to_json(*args); end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
# typed: strong
|
|
6
|
+
|
|
7
|
+
module WorkOS
|
|
8
|
+
class WaitlistUserCreated
|
|
9
|
+
sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void }
|
|
10
|
+
def initialize(json); end
|
|
11
|
+
|
|
12
|
+
sig { returns(String) }
|
|
13
|
+
def id; end
|
|
14
|
+
|
|
15
|
+
sig { params(value: String).returns(String) }
|
|
16
|
+
def id=(value); end
|
|
17
|
+
|
|
18
|
+
sig { returns(String) }
|
|
19
|
+
def event; end
|
|
20
|
+
|
|
21
|
+
sig { params(value: String).returns(String) }
|
|
22
|
+
def event=(value); end
|
|
23
|
+
|
|
24
|
+
sig { returns(WorkOS::WaitlistUser) }
|
|
25
|
+
def data; end
|
|
26
|
+
|
|
27
|
+
sig { params(value: WorkOS::WaitlistUser).returns(WorkOS::WaitlistUser) }
|
|
28
|
+
def data=(value); end
|
|
29
|
+
|
|
30
|
+
sig { returns(String) }
|
|
31
|
+
def created_at; end
|
|
32
|
+
|
|
33
|
+
sig { params(value: String).returns(String) }
|
|
34
|
+
def created_at=(value); end
|
|
35
|
+
|
|
36
|
+
sig { returns(T.nilable(WorkOS::EventContext)) }
|
|
37
|
+
def context; end
|
|
38
|
+
|
|
39
|
+
sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) }
|
|
40
|
+
def context=(value); end
|
|
41
|
+
|
|
42
|
+
sig { returns(String) }
|
|
43
|
+
def object; end
|
|
44
|
+
|
|
45
|
+
sig { params(value: String).returns(String) }
|
|
46
|
+
def object=(value); end
|
|
47
|
+
|
|
48
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
|
49
|
+
def to_h; end
|
|
50
|
+
|
|
51
|
+
sig { params(args: T.untyped).returns(String) }
|
|
52
|
+
def to_json(*args); end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
# typed: strong
|
|
6
|
+
|
|
7
|
+
module WorkOS
|
|
8
|
+
class WaitlistUserDenied
|
|
9
|
+
sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void }
|
|
10
|
+
def initialize(json); end
|
|
11
|
+
|
|
12
|
+
sig { returns(String) }
|
|
13
|
+
def id; end
|
|
14
|
+
|
|
15
|
+
sig { params(value: String).returns(String) }
|
|
16
|
+
def id=(value); end
|
|
17
|
+
|
|
18
|
+
sig { returns(String) }
|
|
19
|
+
def event; end
|
|
20
|
+
|
|
21
|
+
sig { params(value: String).returns(String) }
|
|
22
|
+
def event=(value); end
|
|
23
|
+
|
|
24
|
+
sig { returns(WorkOS::WaitlistUser) }
|
|
25
|
+
def data; end
|
|
26
|
+
|
|
27
|
+
sig { params(value: WorkOS::WaitlistUser).returns(WorkOS::WaitlistUser) }
|
|
28
|
+
def data=(value); end
|
|
29
|
+
|
|
30
|
+
sig { returns(String) }
|
|
31
|
+
def created_at; end
|
|
32
|
+
|
|
33
|
+
sig { params(value: String).returns(String) }
|
|
34
|
+
def created_at=(value); end
|
|
35
|
+
|
|
36
|
+
sig { returns(T.nilable(WorkOS::EventContext)) }
|
|
37
|
+
def context; end
|
|
38
|
+
|
|
39
|
+
sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) }
|
|
40
|
+
def context=(value); end
|
|
41
|
+
|
|
42
|
+
sig { returns(String) }
|
|
43
|
+
def object; end
|
|
44
|
+
|
|
45
|
+
sig { params(value: String).returns(String) }
|
|
46
|
+
def object=(value); end
|
|
47
|
+
|
|
48
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
|
49
|
+
def to_h; end
|
|
50
|
+
|
|
51
|
+
sig { params(args: T.untyped).returns(String) }
|
|
52
|
+
def to_json(*args); end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -18,17 +18,17 @@ class AuthorizationTest < Minitest::Test
|
|
|
18
18
|
refute_nil result
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def
|
|
21
|
+
def test_list_resources_for_membership_returns_expected_result
|
|
22
22
|
stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/resources(\?|\z)})
|
|
23
23
|
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
24
|
-
result = @client.authorization.
|
|
24
|
+
result = @client.authorization.list_resources_for_membership(organization_membership_id: "stub", permission_slug: "stub", parent_resource: {type: "by_id"})
|
|
25
25
|
assert_kind_of WorkOS::Types::ListStruct, result
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
def
|
|
28
|
+
def test_list_effective_permissions_returns_expected_result
|
|
29
29
|
stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/resources/stub/permissions(\?|\z)})
|
|
30
30
|
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
31
|
-
result = @client.authorization.
|
|
31
|
+
result = @client.authorization.list_effective_permissions(organization_membership_id: "stub", resource_id: "stub")
|
|
32
32
|
assert_kind_of WorkOS::Types::ListStruct, result
|
|
33
33
|
end
|
|
34
34
|
|
|
@@ -39,10 +39,10 @@ class AuthorizationTest < Minitest::Test
|
|
|
39
39
|
assert_kind_of WorkOS::Types::ListStruct, result
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
def
|
|
42
|
+
def test_list_role_assignments_returns_expected_result
|
|
43
43
|
stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/role_assignments(\?|\z)})
|
|
44
44
|
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
45
|
-
result = @client.authorization.
|
|
45
|
+
result = @client.authorization.list_role_assignments(organization_membership_id: "stub")
|
|
46
46
|
assert_kind_of WorkOS::Types::ListStruct, result
|
|
47
47
|
end
|
|
48
48
|
|
|
@@ -60,10 +60,10 @@ class AuthorizationTest < Minitest::Test
|
|
|
60
60
|
assert_nil result
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
def
|
|
63
|
+
def test_remove_role_assignment_returns_expected_result
|
|
64
64
|
stub_request(:delete, %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/role_assignments/stub(\?|\z)})
|
|
65
65
|
.to_return(body: "{}", status: 200)
|
|
66
|
-
result = @client.authorization.
|
|
66
|
+
result = @client.authorization.remove_role_assignment(organization_membership_id: "stub", role_assignment_id: "stub")
|
|
67
67
|
assert_nil result
|
|
68
68
|
end
|
|
69
69
|
|
|
@@ -102,52 +102,52 @@ class AuthorizationTest < Minitest::Test
|
|
|
102
102
|
assert_nil result
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
-
def
|
|
105
|
+
def test_add_organization_role_permission_returns_expected_result
|
|
106
106
|
stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub/permissions(\?|\z)})
|
|
107
107
|
.to_return(body: "{}", status: 200)
|
|
108
|
-
result = @client.authorization.
|
|
108
|
+
result = @client.authorization.add_organization_role_permission(organization_id: "stub", slug: "stub", body_slug: "stub")
|
|
109
109
|
refute_nil result
|
|
110
110
|
end
|
|
111
111
|
|
|
112
|
-
def
|
|
112
|
+
def test_set_organization_role_permissions_returns_expected_result
|
|
113
113
|
stub_request(:put, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub/permissions(\?|\z)})
|
|
114
114
|
.to_return(body: "{}", status: 200)
|
|
115
|
-
result = @client.authorization.
|
|
115
|
+
result = @client.authorization.set_organization_role_permissions(organization_id: "stub", slug: "stub", permissions: [])
|
|
116
116
|
refute_nil result
|
|
117
117
|
end
|
|
118
118
|
|
|
119
|
-
def
|
|
119
|
+
def test_remove_organization_role_permission_returns_expected_result
|
|
120
120
|
stub_request(:delete, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub/permissions/stub(\?|\z)})
|
|
121
121
|
.to_return(body: "{}", status: 200)
|
|
122
|
-
result = @client.authorization.
|
|
122
|
+
result = @client.authorization.remove_organization_role_permission(organization_id: "stub", slug: "stub", permission_slug: "stub")
|
|
123
123
|
refute_nil result
|
|
124
124
|
end
|
|
125
125
|
|
|
126
|
-
def
|
|
126
|
+
def test_get_resource_by_external_id_returns_expected_result
|
|
127
127
|
stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub(\?|\z)})
|
|
128
128
|
.to_return(body: "{}", status: 200)
|
|
129
|
-
result = @client.authorization.
|
|
129
|
+
result = @client.authorization.get_resource_by_external_id(organization_id: "stub", resource_type_slug: "stub", external_id: "stub")
|
|
130
130
|
refute_nil result
|
|
131
131
|
end
|
|
132
132
|
|
|
133
|
-
def
|
|
133
|
+
def test_update_resource_by_external_id_returns_expected_result
|
|
134
134
|
stub_request(:patch, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub(\?|\z)})
|
|
135
135
|
.to_return(body: "{}", status: 200)
|
|
136
|
-
result = @client.authorization.
|
|
136
|
+
result = @client.authorization.update_resource_by_external_id(organization_id: "stub", resource_type_slug: "stub", external_id: "stub")
|
|
137
137
|
refute_nil result
|
|
138
138
|
end
|
|
139
139
|
|
|
140
|
-
def
|
|
140
|
+
def test_delete_resource_by_external_id_returns_expected_result
|
|
141
141
|
stub_request(:delete, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub(\?|\z)})
|
|
142
142
|
.to_return(body: "{}", status: 200)
|
|
143
|
-
result = @client.authorization.
|
|
143
|
+
result = @client.authorization.delete_resource_by_external_id(organization_id: "stub", resource_type_slug: "stub", external_id: "stub")
|
|
144
144
|
assert_nil result
|
|
145
145
|
end
|
|
146
146
|
|
|
147
|
-
def
|
|
147
|
+
def test_list_memberships_for_resource_by_external_id_returns_expected_result
|
|
148
148
|
stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub/organization_memberships(\?|\z)})
|
|
149
149
|
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
150
|
-
result = @client.authorization.
|
|
150
|
+
result = @client.authorization.list_memberships_for_resource_by_external_id(organization_id: "stub", resource_type_slug: "stub", external_id: "stub", permission_slug: "stub")
|
|
151
151
|
assert_kind_of WorkOS::Types::ListStruct, result
|
|
152
152
|
end
|
|
153
153
|
|
|
@@ -273,25 +273,25 @@ class AuthorizationTest < Minitest::Test
|
|
|
273
273
|
# Parameterized authentication error tests (one per endpoint).
|
|
274
274
|
[
|
|
275
275
|
{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"}}},
|
|
276
|
-
{name: :
|
|
277
|
-
{name: :
|
|
276
|
+
{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"}}},
|
|
277
|
+
{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"}},
|
|
278
278
|
{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"}},
|
|
279
|
-
{name: :
|
|
279
|
+
{name: :list_role_assignments, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/role_assignments(\?|\z)}, args: {organization_membership_id: "stub"}},
|
|
280
280
|
{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"}}},
|
|
281
281
|
{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"}}},
|
|
282
|
-
{name: :
|
|
282
|
+
{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"}},
|
|
283
283
|
{name: :list_organization_roles, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles(\?|\z)}, args: {organization_id: "stub"}},
|
|
284
284
|
{name: :create_organization_role, verb: :post, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles(\?|\z)}, args: {organization_id: "stub", name: "stub"}},
|
|
285
285
|
{name: :get_organization_role, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}},
|
|
286
286
|
{name: :update_organization_role, verb: :patch, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}},
|
|
287
287
|
{name: :delete_organization_role, verb: :delete, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}},
|
|
288
|
-
{name: :
|
|
289
|
-
{name: :
|
|
290
|
-
{name: :
|
|
291
|
-
{name: :
|
|
292
|
-
{name: :
|
|
293
|
-
{name: :
|
|
294
|
-
{name: :
|
|
288
|
+
{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"}},
|
|
289
|
+
{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: []}},
|
|
290
|
+
{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"}},
|
|
291
|
+
{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"}},
|
|
292
|
+
{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"}},
|
|
293
|
+
{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"}},
|
|
294
|
+
{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"}},
|
|
295
295
|
{name: :list_resources, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/resources(\?|\z)}},
|
|
296
296
|
{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"}},
|
|
297
297
|
{name: :get_resource, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/resources/stub(\?|\z)}, args: {resource_id: "stub"}},
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
require "test_helper"
|
|
6
|
+
|
|
7
|
+
class GroupsTest < Minitest::Test
|
|
8
|
+
include FixtureHelper
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
@client = WorkOS::Client.new(api_key: "sk_test_123")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_list_organization_groups_returns_expected_result
|
|
15
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/groups(\?|\z)})
|
|
16
|
+
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
17
|
+
result = @client.groups.list_organization_groups(organization_id: "stub")
|
|
18
|
+
assert_kind_of WorkOS::Types::ListStruct, result
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_create_organization_group_returns_expected_result
|
|
22
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/organizations/stub/groups(\?|\z)})
|
|
23
|
+
.to_return(body: "{}", status: 200)
|
|
24
|
+
result = @client.groups.create_organization_group(organization_id: "stub", name: "stub")
|
|
25
|
+
refute_nil result
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_get_organization_group_returns_expected_result
|
|
29
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub(\?|\z)})
|
|
30
|
+
.to_return(body: "{}", status: 200)
|
|
31
|
+
result = @client.groups.get_organization_group(organization_id: "stub", group_id: "stub")
|
|
32
|
+
refute_nil result
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_update_organization_group_returns_expected_result
|
|
36
|
+
stub_request(:patch, %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub(\?|\z)})
|
|
37
|
+
.to_return(body: "{}", status: 200)
|
|
38
|
+
result = @client.groups.update_organization_group(organization_id: "stub", group_id: "stub")
|
|
39
|
+
refute_nil result
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def test_delete_organization_group_returns_expected_result
|
|
43
|
+
stub_request(:delete, %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub(\?|\z)})
|
|
44
|
+
.to_return(body: "{}", status: 200)
|
|
45
|
+
result = @client.groups.delete_organization_group(organization_id: "stub", group_id: "stub")
|
|
46
|
+
assert_nil result
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def test_list_group_organization_memberships_returns_expected_result
|
|
50
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub/organization-memberships(\?|\z)})
|
|
51
|
+
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
52
|
+
result = @client.groups.list_group_organization_memberships(organization_id: "stub", group_id: "stub")
|
|
53
|
+
assert_kind_of WorkOS::Types::ListStruct, result
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def test_create_group_organization_membership_returns_expected_result
|
|
57
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub/organization-memberships(\?|\z)})
|
|
58
|
+
.to_return(body: "{}", status: 200)
|
|
59
|
+
result = @client.groups.create_group_organization_membership(organization_id: "stub", group_id: "stub", organization_membership_id: "stub")
|
|
60
|
+
refute_nil result
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def test_delete_group_organization_membership_returns_expected_result
|
|
64
|
+
stub_request(:delete, %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub/organization-memberships/stub(\?|\z)})
|
|
65
|
+
.to_return(body: "{}", status: 200)
|
|
66
|
+
result = @client.groups.delete_group_organization_membership(organization_id: "stub", group_id: "stub", om_id: "stub")
|
|
67
|
+
assert_nil result
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Parameterized authentication error tests (one per endpoint).
|
|
71
|
+
[
|
|
72
|
+
{name: :list_organization_groups, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/groups(\?|\z)}, args: {organization_id: "stub"}},
|
|
73
|
+
{name: :create_organization_group, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations/stub/groups(\?|\z)}, args: {organization_id: "stub", name: "stub"}},
|
|
74
|
+
{name: :get_organization_group, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub(\?|\z)}, args: {organization_id: "stub", group_id: "stub"}},
|
|
75
|
+
{name: :update_organization_group, verb: :patch, url: %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub(\?|\z)}, args: {organization_id: "stub", group_id: "stub"}},
|
|
76
|
+
{name: :delete_organization_group, verb: :delete, url: %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub(\?|\z)}, args: {organization_id: "stub", group_id: "stub"}},
|
|
77
|
+
{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"}},
|
|
78
|
+
{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"}},
|
|
79
|
+
{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"}}
|
|
80
|
+
].each do |spec|
|
|
81
|
+
define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do
|
|
82
|
+
stub_request(spec[:verb], spec[:url])
|
|
83
|
+
.to_return(body: '{"message": "Unauthorized"}', status: 401)
|
|
84
|
+
assert_raises(WorkOS::AuthenticationError) do
|
|
85
|
+
@client.groups.send(spec[:name], **(spec[:args] || {}))
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|