workos 9.1.0 → 9.2.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/release-please.yml +42 -83
- data/.last-synced-sha +1 -1
- data/.oagen-manifest.json +74 -3
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +56 -0
- data/Gemfile.lock +2 -2
- data/lib/workos/authorization/create_group_role_assignment.rb +7 -0
- data/lib/workos/authorization/delete_group_role_assignments_by_criteria.rb +7 -0
- data/lib/workos/authorization/group_role_assignment.rb +37 -0
- data/lib/workos/authorization/group_role_assignment_list.rb +25 -0
- data/lib/workos/authorization/group_role_assignment_resource.rb +25 -0
- data/lib/workos/authorization/replace_group_role_assignment_entry.rb +7 -0
- data/lib/workos/authorization/replace_group_role_assignments.rb +18 -0
- data/lib/workos/authorization/user_role_assignment_resource.rb +1 -19
- data/lib/workos/authorization.rb +180 -0
- data/lib/workos/client.rb +8 -0
- data/lib/workos/client_api/client_api_token.rb +22 -0
- data/lib/workos/client_api/client_api_token_response.rb +18 -0
- data/lib/workos/client_api.rb +39 -0
- data/lib/workos/pipes/connected_account.rb +6 -0
- data/lib/workos/pipes/data_integrations_list_response_data.rb +3 -0
- data/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb +6 -0
- data/lib/workos/pipes.rb +5 -5
- data/lib/workos/pipes_provider/configure_data_integration_body.rb +28 -0
- data/lib/workos/pipes_provider/data_integration_configuration_list_response.rb +22 -0
- data/lib/workos/pipes_provider/data_integration_configuration_response.rb +46 -0
- data/lib/workos/pipes_provider/data_integration_credentials.rb +31 -0
- data/lib/workos/pipes_provider.rb +68 -0
- data/lib/workos/types/connected_account_auth_method.rb +13 -0
- data/lib/workos/types/data_integration_access_token_response_error.rb +2 -2
- data/lib/workos/types/data_integration_credentials_credentials_type.rb +14 -0
- data/lib/workos/types/data_integrations_list_response_data_auth_methods.rb +9 -0
- data/lib/workos/types/data_integrations_list_response_data_connected_account_auth_method.rb +9 -0
- data/lib/workos/types/widget_session_token_scopes.rb +2 -1
- data/lib/workos/user_management.rb +1 -1
- data/lib/workos/version.rb +1 -1
- data/lib/workos/widgets/widget_session_token_response.rb +1 -12
- data/lib/workos.rb +2 -0
- data/rbi/workos/authorization.rbi +63 -0
- data/rbi/workos/authorization_code_session_authenticate_request.rbi +2 -2
- data/rbi/workos/client.rbi +6 -0
- data/rbi/workos/client_api.rbi +22 -0
- data/rbi/workos/client_api_token.rbi +30 -0
- data/rbi/workos/client_api_token_response.rbi +24 -0
- data/rbi/workos/configure_data_integration_body.rbi +42 -0
- data/rbi/workos/connected_account.rbi +12 -0
- data/rbi/workos/create_group_role_assignment.rbi +42 -0
- data/rbi/workos/data_integration_configuration_list_response.rbi +30 -0
- data/rbi/workos/data_integration_configuration_response.rbi +78 -0
- data/rbi/workos/data_integration_credentials.rbi +48 -0
- data/rbi/workos/data_integrations_list_response_data.rbi +6 -0
- data/rbi/workos/data_integrations_list_response_data_connected_account.rbi +12 -0
- data/rbi/workos/delete_group_role_assignments_by_criteria.rbi +42 -0
- data/rbi/workos/group_role_assignment.rbi +60 -0
- data/rbi/workos/group_role_assignment_resource.rbi +36 -0
- data/rbi/workos/organization_membership_service.rbi +1 -1
- data/rbi/workos/pipes.rbi +2 -2
- data/rbi/workos/pipes_provider.rbi +34 -0
- data/rbi/workos/refresh_token_session_authenticate_request.rbi +2 -2
- data/rbi/workos/replace_group_role_assignment_entry.rbi +42 -0
- data/rbi/workos/replace_group_role_assignments.rbi +24 -0
- data/rbi/workos/user_management.rbi +3 -3
- data/test/workos/test_authorization.rb +48 -0
- data/test/workos/test_client_api.rb +33 -0
- data/test/workos/test_model_round_trip.rb +196 -14
- data/test/workos/test_pipes.rb +3 -3
- data/test/workos/test_pipes_provider.rb +41 -0
- data/test/workos/test_user_management.rb +2 -2
- metadata +36 -1
|
@@ -0,0 +1,36 @@
|
|
|
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 GroupRoleAssignmentResource
|
|
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 external_id; end
|
|
20
|
+
|
|
21
|
+
sig { params(value: String).returns(String) }
|
|
22
|
+
def external_id=(value); end
|
|
23
|
+
|
|
24
|
+
sig { returns(String) }
|
|
25
|
+
def resource_type_slug; end
|
|
26
|
+
|
|
27
|
+
sig { params(value: String).returns(String) }
|
|
28
|
+
def resource_type_slug=(value); end
|
|
29
|
+
|
|
30
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
|
31
|
+
def to_h; end
|
|
32
|
+
|
|
33
|
+
sig { params(args: T.untyped).returns(String) }
|
|
34
|
+
def to_json(*args); end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -43,7 +43,7 @@ module WorkOS
|
|
|
43
43
|
statuses: T.nilable(T::Array[String]),
|
|
44
44
|
user_id: T.nilable(String),
|
|
45
45
|
request_options: T::Hash[Symbol, T.untyped]
|
|
46
|
-
).returns(
|
|
46
|
+
).returns(WorkOS::Types::ListStruct)
|
|
47
47
|
end
|
|
48
48
|
def list_organization_memberships(before:, after:, limit:, order:, organization_id:, statuses:, user_id:, request_options:); end
|
|
49
49
|
|
data/rbi/workos/pipes.rbi
CHANGED
|
@@ -22,13 +22,13 @@ module WorkOS
|
|
|
22
22
|
|
|
23
23
|
sig do
|
|
24
24
|
params(
|
|
25
|
-
|
|
25
|
+
provider: String,
|
|
26
26
|
user_id: String,
|
|
27
27
|
organization_id: T.nilable(String),
|
|
28
28
|
request_options: T::Hash[Symbol, T.untyped]
|
|
29
29
|
).returns(WorkOS::DataIntegrationAccessTokenResponse)
|
|
30
30
|
end
|
|
31
|
-
def
|
|
31
|
+
def get_access_token(provider:, user_id:, organization_id:, request_options:); end
|
|
32
32
|
|
|
33
33
|
sig do
|
|
34
34
|
params(
|
|
@@ -0,0 +1,34 @@
|
|
|
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 PipesProvider
|
|
9
|
+
sig { params(client: WorkOS::BaseClient).void }
|
|
10
|
+
def initialize(client); end
|
|
11
|
+
|
|
12
|
+
sig do
|
|
13
|
+
params(
|
|
14
|
+
organization_id: String,
|
|
15
|
+
request_options: T::Hash[Symbol, T.untyped]
|
|
16
|
+
).returns(WorkOS::DataIntegrationConfigurationListResponse)
|
|
17
|
+
end
|
|
18
|
+
def list_organization_data_integration_configurations(organization_id:, request_options:); end
|
|
19
|
+
|
|
20
|
+
sig do
|
|
21
|
+
params(
|
|
22
|
+
organization_id: String,
|
|
23
|
+
slug: String,
|
|
24
|
+
enabled: T.nilable(T::Boolean),
|
|
25
|
+
scopes: T.nilable(T::Array[String]),
|
|
26
|
+
client_id: T.nilable(String),
|
|
27
|
+
client_secret: T.nilable(String),
|
|
28
|
+
request_options: T::Hash[Symbol, T.untyped]
|
|
29
|
+
).returns(WorkOS::DataIntegrationConfigurationResponse)
|
|
30
|
+
end
|
|
31
|
+
def update_organization_data_integration_configuration(organization_id:, slug:, enabled:, scopes:, client_id:, client_secret:, request_options:); end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -15,10 +15,10 @@ module WorkOS
|
|
|
15
15
|
sig { params(value: String).returns(String) }
|
|
16
16
|
def client_id=(value); end
|
|
17
17
|
|
|
18
|
-
sig { returns(String) }
|
|
18
|
+
sig { returns(T.nilable(String)) }
|
|
19
19
|
def client_secret; end
|
|
20
20
|
|
|
21
|
-
sig { params(value: String).returns(String) }
|
|
21
|
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
|
22
22
|
def client_secret=(value); end
|
|
23
23
|
|
|
24
24
|
sig { returns(String) }
|
|
@@ -0,0 +1,42 @@
|
|
|
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 ReplaceGroupRoleAssignmentEntry
|
|
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 role_slug; end
|
|
14
|
+
|
|
15
|
+
sig { params(value: String).returns(String) }
|
|
16
|
+
def role_slug=(value); end
|
|
17
|
+
|
|
18
|
+
sig { returns(T.nilable(String)) }
|
|
19
|
+
def resource_id; end
|
|
20
|
+
|
|
21
|
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
|
22
|
+
def resource_id=(value); end
|
|
23
|
+
|
|
24
|
+
sig { returns(T.nilable(String)) }
|
|
25
|
+
def resource_external_id; end
|
|
26
|
+
|
|
27
|
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
|
28
|
+
def resource_external_id=(value); end
|
|
29
|
+
|
|
30
|
+
sig { returns(T.nilable(String)) }
|
|
31
|
+
def resource_type_slug; end
|
|
32
|
+
|
|
33
|
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
|
34
|
+
def resource_type_slug=(value); end
|
|
35
|
+
|
|
36
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
|
37
|
+
def to_h; end
|
|
38
|
+
|
|
39
|
+
sig { params(args: T.untyped).returns(String) }
|
|
40
|
+
def to_json(*args); end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
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 ReplaceGroupRoleAssignments
|
|
9
|
+
sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void }
|
|
10
|
+
def initialize(json); end
|
|
11
|
+
|
|
12
|
+
sig { returns(T::Array[WorkOS::ReplaceGroupRoleAssignmentEntry]) }
|
|
13
|
+
def role_assignments; end
|
|
14
|
+
|
|
15
|
+
sig { params(value: T::Array[WorkOS::ReplaceGroupRoleAssignmentEntry]).returns(T::Array[WorkOS::ReplaceGroupRoleAssignmentEntry]) }
|
|
16
|
+
def role_assignments=(value); end
|
|
17
|
+
|
|
18
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
|
19
|
+
def to_h; end
|
|
20
|
+
|
|
21
|
+
sig { params(args: T.untyped).returns(String) }
|
|
22
|
+
def to_json(*args); end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -48,9 +48,9 @@ module WorkOS
|
|
|
48
48
|
sig do
|
|
49
49
|
params(
|
|
50
50
|
client_id: String,
|
|
51
|
-
client_secret: String,
|
|
52
51
|
grant_type: String,
|
|
53
52
|
code: String,
|
|
53
|
+
client_secret: T.nilable(String),
|
|
54
54
|
code_verifier: T.nilable(String),
|
|
55
55
|
invitation_token: T.nilable(String),
|
|
56
56
|
ip_address: T.nilable(String),
|
|
@@ -59,7 +59,7 @@ module WorkOS
|
|
|
59
59
|
request_options: T::Hash[Symbol, T.untyped]
|
|
60
60
|
).returns(WorkOS::AuthenticateResponse)
|
|
61
61
|
end
|
|
62
|
-
def create_authenticate(client_id:,
|
|
62
|
+
def create_authenticate(client_id:, grant_type:, code:, client_secret:, code_verifier:, invitation_token:, ip_address:, device_id:, user_agent:, request_options:); end
|
|
63
63
|
|
|
64
64
|
sig do
|
|
65
65
|
params(
|
|
@@ -252,7 +252,7 @@ module WorkOS
|
|
|
252
252
|
organization_id: T.nilable(String),
|
|
253
253
|
email: T.nilable(String),
|
|
254
254
|
request_options: T::Hash[Symbol, T.untyped]
|
|
255
|
-
).returns(
|
|
255
|
+
).returns(WorkOS::Types::ListStruct)
|
|
256
256
|
end
|
|
257
257
|
def list_invitations(before:, after:, limit:, order:, organization_id:, email:, request_options:); end
|
|
258
258
|
|
|
@@ -11,6 +11,48 @@ class AuthorizationTest < Minitest::Test
|
|
|
11
11
|
@client = WorkOS::Client.new(api_key: "sk_test_123")
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
+
def test_list_group_role_assignments_returns_expected_result
|
|
15
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/groups/stub/role_assignments(\?|\z)})
|
|
16
|
+
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
17
|
+
result = @client.authorization.list_group_role_assignments(group_id: "stub")
|
|
18
|
+
assert_kind_of WorkOS::Types::ListStruct, result
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_create_group_role_assignment_returns_expected_result
|
|
22
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/groups/stub/role_assignments(\?|\z)})
|
|
23
|
+
.to_return(body: "{}", status: 200)
|
|
24
|
+
result = @client.authorization.create_group_role_assignment(group_id: "stub", role_slug: "stub")
|
|
25
|
+
refute_nil result
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_update_group_role_assignments_returns_expected_result
|
|
29
|
+
stub_request(:put, %r{\Ahttps://api\.workos\.com/authorization/groups/stub/role_assignments(\?|\z)})
|
|
30
|
+
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
31
|
+
result = @client.authorization.update_group_role_assignments(group_id: "stub", role_assignments: [{}])
|
|
32
|
+
assert_kind_of WorkOS::Types::ListStruct, result
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_delete_group_role_assignments_returns_expected_result
|
|
36
|
+
stub_request(:delete, %r{\Ahttps://api\.workos\.com/authorization/groups/stub/role_assignments(\?|\z)})
|
|
37
|
+
.to_return(body: "{}", status: 200)
|
|
38
|
+
result = @client.authorization.delete_group_role_assignments(group_id: "stub", role_slug: "stub")
|
|
39
|
+
assert_nil result
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def test_get_group_role_assignment_returns_expected_result
|
|
43
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/groups/stub/role_assignments/stub(\?|\z)})
|
|
44
|
+
.to_return(body: "{}", status: 200)
|
|
45
|
+
result = @client.authorization.get_group_role_assignment(group_id: "stub", role_assignment_id: "stub")
|
|
46
|
+
refute_nil result
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def test_delete_group_role_assignment_returns_expected_result
|
|
50
|
+
stub_request(:delete, %r{\Ahttps://api\.workos\.com/authorization/groups/stub/role_assignments/stub(\?|\z)})
|
|
51
|
+
.to_return(body: "{}", status: 200)
|
|
52
|
+
result = @client.authorization.delete_group_role_assignment(group_id: "stub", role_assignment_id: "stub")
|
|
53
|
+
assert_nil result
|
|
54
|
+
end
|
|
55
|
+
|
|
14
56
|
def test_check_returns_expected_result
|
|
15
57
|
stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/check(\?|\z)})
|
|
16
58
|
.with(body: hash_including("permission_slug" => "stub", "resource_id" => "stub"))
|
|
@@ -352,6 +394,12 @@ class AuthorizationTest < Minitest::Test
|
|
|
352
394
|
|
|
353
395
|
# Parameterized authentication error tests (one per endpoint).
|
|
354
396
|
[
|
|
397
|
+
{name: :list_group_role_assignments, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/groups/stub/role_assignments(\?|\z)}, args: {group_id: "stub"}},
|
|
398
|
+
{name: :create_group_role_assignment, verb: :post, url: %r{\Ahttps://api\.workos\.com/authorization/groups/stub/role_assignments(\?|\z)}, args: {group_id: "stub", role_slug: "stub"}},
|
|
399
|
+
{name: :update_group_role_assignments, verb: :put, url: %r{\Ahttps://api\.workos\.com/authorization/groups/stub/role_assignments(\?|\z)}, args: {group_id: "stub", role_assignments: [{}]}},
|
|
400
|
+
{name: :delete_group_role_assignments, verb: :delete, url: %r{\Ahttps://api\.workos\.com/authorization/groups/stub/role_assignments(\?|\z)}, args: {group_id: "stub", role_slug: "stub"}},
|
|
401
|
+
{name: :get_group_role_assignment, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/groups/stub/role_assignments/stub(\?|\z)}, args: {group_id: "stub", role_assignment_id: "stub"}},
|
|
402
|
+
{name: :delete_group_role_assignment, verb: :delete, url: %r{\Ahttps://api\.workos\.com/authorization/groups/stub/role_assignments/stub(\?|\z)}, args: {group_id: "stub", role_assignment_id: "stub"}},
|
|
355
403
|
{name: :check, verb: :post, url: %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/check(\?|\z)}, args: {organization_membership_id: "stub", permission_slug: "stub", resource_target: WorkOS::Authorization::ResourceTargetById.new(resource_id: "stub")}},
|
|
356
404
|
{name: :list_resources_for_membership, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/resources(\?|\z)}, args: {organization_membership_id: "stub", permission_slug: "stub", parent_resource: WorkOS::Authorization::ParentResourceById.new(parent_resource_id: "stub")}},
|
|
357
405
|
{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"}},
|
|
@@ -0,0 +1,33 @@
|
|
|
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 ClientApiTest < 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_create_token_returns_expected_result
|
|
15
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/client/token(\?|\z)})
|
|
16
|
+
.to_return(body: "{}", status: 200)
|
|
17
|
+
result = @client.client_api.create_token(organization_id: "stub", user_id: "stub")
|
|
18
|
+
refute_nil result
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Parameterized authentication error tests (one per endpoint).
|
|
22
|
+
[
|
|
23
|
+
{name: :create_token, verb: :post, url: %r{\Ahttps://api\.workos\.com/client/token(\?|\z)}, args: {organization_id: "stub", user_id: "stub"}}
|
|
24
|
+
].each do |spec|
|
|
25
|
+
define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do
|
|
26
|
+
stub_request(spec[:verb], spec[:url])
|
|
27
|
+
.to_return(body: '{"message": "Unauthorized"}', status: 401)
|
|
28
|
+
assert_raises(WorkOS::AuthenticationError) do
|
|
29
|
+
@client.client_api.send(spec[:name], **(spec[:args] || {}))
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -298,6 +298,58 @@ class ModelRoundTripTest < Minitest::Test
|
|
|
298
298
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
299
299
|
end
|
|
300
300
|
|
|
301
|
+
def test_create_group_role_assignment_round_trip
|
|
302
|
+
fixture = {
|
|
303
|
+
"role_slug" => "stub",
|
|
304
|
+
"resource_id" => "stub",
|
|
305
|
+
"resource_external_id" => "stub",
|
|
306
|
+
"resource_type_slug" => "stub"
|
|
307
|
+
}
|
|
308
|
+
model = WorkOS::CreateGroupRoleAssignment.new(fixture.to_json)
|
|
309
|
+
json = model.to_h
|
|
310
|
+
assert_kind_of Hash, json
|
|
311
|
+
assert_equal fixture["role_slug"], json[:role_slug]
|
|
312
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
def test_replace_group_role_assignment_entry_round_trip
|
|
316
|
+
fixture = {
|
|
317
|
+
"role_slug" => "stub",
|
|
318
|
+
"resource_id" => "stub",
|
|
319
|
+
"resource_external_id" => "stub",
|
|
320
|
+
"resource_type_slug" => "stub"
|
|
321
|
+
}
|
|
322
|
+
model = WorkOS::ReplaceGroupRoleAssignmentEntry.new(fixture.to_json)
|
|
323
|
+
json = model.to_h
|
|
324
|
+
assert_kind_of Hash, json
|
|
325
|
+
assert_equal fixture["role_slug"], json[:role_slug]
|
|
326
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
def test_replace_group_role_assignments_round_trip
|
|
330
|
+
fixture = {
|
|
331
|
+
"role_assignments" => []
|
|
332
|
+
}
|
|
333
|
+
model = WorkOS::ReplaceGroupRoleAssignments.new(fixture.to_json)
|
|
334
|
+
json = model.to_h
|
|
335
|
+
assert_kind_of Hash, json
|
|
336
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
def test_delete_group_role_assignments_by_criteria_round_trip
|
|
340
|
+
fixture = {
|
|
341
|
+
"role_slug" => "stub",
|
|
342
|
+
"resource_id" => "stub",
|
|
343
|
+
"resource_external_id" => "stub",
|
|
344
|
+
"resource_type_slug" => "stub"
|
|
345
|
+
}
|
|
346
|
+
model = WorkOS::DeleteGroupRoleAssignmentsByCriteria.new(fixture.to_json)
|
|
347
|
+
json = model.to_h
|
|
348
|
+
assert_kind_of Hash, json
|
|
349
|
+
assert_equal fixture["role_slug"], json[:role_slug]
|
|
350
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
351
|
+
end
|
|
352
|
+
|
|
301
353
|
def test_assign_role_round_trip
|
|
302
354
|
fixture = {
|
|
303
355
|
"role_slug" => "stub",
|
|
@@ -881,6 +933,19 @@ class ModelRoundTripTest < Minitest::Test
|
|
|
881
933
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
882
934
|
end
|
|
883
935
|
|
|
936
|
+
def test_client_api_token_round_trip
|
|
937
|
+
fixture = {
|
|
938
|
+
"organization_id" => "stub",
|
|
939
|
+
"user_id" => "stub"
|
|
940
|
+
}
|
|
941
|
+
model = WorkOS::ClientApiToken.new(fixture.to_json)
|
|
942
|
+
json = model.to_h
|
|
943
|
+
assert_kind_of Hash, json
|
|
944
|
+
assert_equal fixture["organization_id"], json[:organization_id]
|
|
945
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
946
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
947
|
+
end
|
|
948
|
+
|
|
884
949
|
def test_token_query_round_trip
|
|
885
950
|
fixture = {
|
|
886
951
|
"client_id" => "stub",
|
|
@@ -1489,6 +1554,26 @@ class ModelRoundTripTest < Minitest::Test
|
|
|
1489
1554
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1490
1555
|
end
|
|
1491
1556
|
|
|
1557
|
+
def test_group_role_assignment_round_trip
|
|
1558
|
+
fixture = {
|
|
1559
|
+
"object" => "group_role_assignment",
|
|
1560
|
+
"id" => "stub",
|
|
1561
|
+
"group_id" => "stub",
|
|
1562
|
+
"role" => {},
|
|
1563
|
+
"resource" => {},
|
|
1564
|
+
"created_at" => "stub",
|
|
1565
|
+
"updated_at" => "stub"
|
|
1566
|
+
}
|
|
1567
|
+
model = WorkOS::GroupRoleAssignment.new(fixture.to_json)
|
|
1568
|
+
json = model.to_h
|
|
1569
|
+
assert_kind_of Hash, json
|
|
1570
|
+
assert_equal fixture["id"], json[:id]
|
|
1571
|
+
assert_equal fixture["group_id"], json[:group_id]
|
|
1572
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1573
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
1574
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1575
|
+
end
|
|
1576
|
+
|
|
1492
1577
|
def test_user_role_assignment_round_trip
|
|
1493
1578
|
fixture = {
|
|
1494
1579
|
"object" => "role_assignment",
|
|
@@ -6241,6 +6326,74 @@ class ModelRoundTripTest < Minitest::Test
|
|
|
6241
6326
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
6242
6327
|
end
|
|
6243
6328
|
|
|
6329
|
+
def test_data_integration_credentials_round_trip
|
|
6330
|
+
fixture = {
|
|
6331
|
+
"credentials_type" => "stub",
|
|
6332
|
+
"has_credentials" => true,
|
|
6333
|
+
"client_id" => nil,
|
|
6334
|
+
"client_secret_last_four" => nil,
|
|
6335
|
+
"redirect_uri" => "stub"
|
|
6336
|
+
}
|
|
6337
|
+
model = WorkOS::DataIntegrationCredentials.new(fixture.to_json)
|
|
6338
|
+
json = model.to_h
|
|
6339
|
+
assert_kind_of Hash, json
|
|
6340
|
+
assert_equal fixture["has_credentials"], json[:has_credentials]
|
|
6341
|
+
assert_nil json[:client_id]
|
|
6342
|
+
assert_nil json[:client_secret_last_four]
|
|
6343
|
+
assert_equal fixture["redirect_uri"], json[:redirect_uri]
|
|
6344
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
6345
|
+
end
|
|
6346
|
+
|
|
6347
|
+
def test_data_integration_configuration_response_round_trip
|
|
6348
|
+
fixture = {
|
|
6349
|
+
"object" => "data_integration_configuration",
|
|
6350
|
+
"id" => "stub",
|
|
6351
|
+
"organization_id" => "stub",
|
|
6352
|
+
"slug" => "stub",
|
|
6353
|
+
"name" => "stub",
|
|
6354
|
+
"enabled" => true,
|
|
6355
|
+
"scopes" => nil,
|
|
6356
|
+
"created_at" => "stub",
|
|
6357
|
+
"updated_at" => "stub",
|
|
6358
|
+
"credentials" => {}
|
|
6359
|
+
}
|
|
6360
|
+
model = WorkOS::DataIntegrationConfigurationResponse.new(fixture.to_json)
|
|
6361
|
+
json = model.to_h
|
|
6362
|
+
assert_kind_of Hash, json
|
|
6363
|
+
assert_equal fixture["id"], json[:id]
|
|
6364
|
+
assert_equal fixture["organization_id"], json[:organization_id]
|
|
6365
|
+
assert_equal fixture["slug"], json[:slug]
|
|
6366
|
+
assert_equal fixture["name"], json[:name]
|
|
6367
|
+
assert_equal fixture["enabled"], json[:enabled]
|
|
6368
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
6369
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
6370
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
6371
|
+
end
|
|
6372
|
+
|
|
6373
|
+
def test_data_integration_configuration_list_response_round_trip
|
|
6374
|
+
fixture = {
|
|
6375
|
+
"object" => "list",
|
|
6376
|
+
"data" => []
|
|
6377
|
+
}
|
|
6378
|
+
model = WorkOS::DataIntegrationConfigurationListResponse.new(fixture.to_json)
|
|
6379
|
+
json = model.to_h
|
|
6380
|
+
assert_kind_of Hash, json
|
|
6381
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
6382
|
+
end
|
|
6383
|
+
|
|
6384
|
+
def test_configure_data_integration_body_round_trip
|
|
6385
|
+
fixture = {
|
|
6386
|
+
"enabled" => true,
|
|
6387
|
+
"scopes" => nil,
|
|
6388
|
+
"client_id" => "stub",
|
|
6389
|
+
"client_secret" => "stub"
|
|
6390
|
+
}
|
|
6391
|
+
model = WorkOS::ConfigureDataIntegrationBody.new(fixture.to_json)
|
|
6392
|
+
json = model.to_h
|
|
6393
|
+
assert_kind_of Hash, json
|
|
6394
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
6395
|
+
end
|
|
6396
|
+
|
|
6244
6397
|
def test_data_integration_authorize_url_response_round_trip
|
|
6245
6398
|
fixture = {
|
|
6246
6399
|
"url" => "stub"
|
|
@@ -6271,6 +6424,8 @@ class ModelRoundTripTest < Minitest::Test
|
|
|
6271
6424
|
"user_id" => nil,
|
|
6272
6425
|
"organization_id" => nil,
|
|
6273
6426
|
"scopes" => [],
|
|
6427
|
+
"auth_method" => "stub",
|
|
6428
|
+
"api_key_last_4" => nil,
|
|
6274
6429
|
"state" => "stub",
|
|
6275
6430
|
"created_at" => "stub",
|
|
6276
6431
|
"updated_at" => "stub"
|
|
@@ -6674,6 +6829,17 @@ class ModelRoundTripTest < Minitest::Test
|
|
|
6674
6829
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
6675
6830
|
end
|
|
6676
6831
|
|
|
6832
|
+
def test_client_api_token_response_round_trip
|
|
6833
|
+
fixture = {
|
|
6834
|
+
"token" => "stub"
|
|
6835
|
+
}
|
|
6836
|
+
model = WorkOS::ClientApiTokenResponse.new(fixture.to_json)
|
|
6837
|
+
json = model.to_h
|
|
6838
|
+
assert_kind_of Hash, json
|
|
6839
|
+
assert_equal fixture["token"], json[:token]
|
|
6840
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
6841
|
+
end
|
|
6842
|
+
|
|
6677
6843
|
def test_sso_authorize_url_response_round_trip
|
|
6678
6844
|
fixture = {
|
|
6679
6845
|
"url" => "stub"
|
|
@@ -6880,6 +7046,7 @@ class ModelRoundTripTest < Minitest::Test
|
|
|
6880
7046
|
"integration_type" => "stub",
|
|
6881
7047
|
"credentials_type" => "stub",
|
|
6882
7048
|
"scopes" => nil,
|
|
7049
|
+
"auth_methods" => [],
|
|
6883
7050
|
"ownership" => "stub",
|
|
6884
7051
|
"created_at" => "stub",
|
|
6885
7052
|
"updated_at" => "stub",
|
|
@@ -7121,6 +7288,21 @@ class ModelRoundTripTest < Minitest::Test
|
|
|
7121
7288
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
7122
7289
|
end
|
|
7123
7290
|
|
|
7291
|
+
def test_group_role_assignment_resource_round_trip
|
|
7292
|
+
fixture = {
|
|
7293
|
+
"id" => "stub",
|
|
7294
|
+
"external_id" => "stub",
|
|
7295
|
+
"resource_type_slug" => "stub"
|
|
7296
|
+
}
|
|
7297
|
+
model = WorkOS::GroupRoleAssignmentResource.new(fixture.to_json)
|
|
7298
|
+
json = model.to_h
|
|
7299
|
+
assert_kind_of Hash, json
|
|
7300
|
+
assert_equal fixture["id"], json[:id]
|
|
7301
|
+
assert_equal fixture["external_id"], json[:external_id]
|
|
7302
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
7303
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
7304
|
+
end
|
|
7305
|
+
|
|
7124
7306
|
def test_authentication_factor_sms_round_trip
|
|
7125
7307
|
fixture = {
|
|
7126
7308
|
"phone_number" => "stub"
|
|
@@ -7319,18 +7501,6 @@ class ModelRoundTripTest < Minitest::Test
|
|
|
7319
7501
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
7320
7502
|
end
|
|
7321
7503
|
|
|
7322
|
-
def test_data_integrations_get_user_token_request_round_trip
|
|
7323
|
-
fixture = {
|
|
7324
|
-
"user_id" => "stub",
|
|
7325
|
-
"organization_id" => "stub"
|
|
7326
|
-
}
|
|
7327
|
-
model = WorkOS::DataIntegrationsGetUserTokenRequest.new(fixture.to_json)
|
|
7328
|
-
json = model.to_h
|
|
7329
|
-
assert_kind_of Hash, json
|
|
7330
|
-
assert_equal fixture["user_id"], json[:user_id]
|
|
7331
|
-
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
7332
|
-
end
|
|
7333
|
-
|
|
7334
7504
|
def test_feature_flag_round_trip
|
|
7335
7505
|
fixture = {
|
|
7336
7506
|
"object" => "feature_flag",
|
|
@@ -7451,7 +7621,6 @@ class ModelRoundTripTest < Minitest::Test
|
|
|
7451
7621
|
json = model.to_h
|
|
7452
7622
|
assert_kind_of Hash, json
|
|
7453
7623
|
assert_equal fixture["client_id"], json[:client_id]
|
|
7454
|
-
assert_equal fixture["client_secret"], json[:client_secret]
|
|
7455
7624
|
assert_equal fixture["code"], json[:code]
|
|
7456
7625
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
7457
7626
|
end
|
|
@@ -7493,7 +7662,6 @@ class ModelRoundTripTest < Minitest::Test
|
|
|
7493
7662
|
json = model.to_h
|
|
7494
7663
|
assert_kind_of Hash, json
|
|
7495
7664
|
assert_equal fixture["client_id"], json[:client_id]
|
|
7496
|
-
assert_equal fixture["client_secret"], json[:client_secret]
|
|
7497
7665
|
assert_equal fixture["refresh_token"], json[:refresh_token]
|
|
7498
7666
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
7499
7667
|
end
|
|
@@ -7777,6 +7945,18 @@ class ModelRoundTripTest < Minitest::Test
|
|
|
7777
7945
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
7778
7946
|
end
|
|
7779
7947
|
|
|
7948
|
+
def test_data_integrations_get_user_token_request_round_trip
|
|
7949
|
+
fixture = {
|
|
7950
|
+
"user_id" => "stub",
|
|
7951
|
+
"organization_id" => nil
|
|
7952
|
+
}
|
|
7953
|
+
model = WorkOS::DataIntegrationsGetUserTokenRequest.new(fixture.to_json)
|
|
7954
|
+
json = model.to_h
|
|
7955
|
+
assert_kind_of Hash, json
|
|
7956
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
7957
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
7958
|
+
end
|
|
7959
|
+
|
|
7780
7960
|
def test_directory_metadata_user_round_trip
|
|
7781
7961
|
fixture = {
|
|
7782
7962
|
"active" => 1,
|
|
@@ -7797,6 +7977,8 @@ class ModelRoundTripTest < Minitest::Test
|
|
|
7797
7977
|
"user_id" => nil,
|
|
7798
7978
|
"organization_id" => nil,
|
|
7799
7979
|
"scopes" => [],
|
|
7980
|
+
"auth_method" => "stub",
|
|
7981
|
+
"api_key_last_4" => nil,
|
|
7800
7982
|
"state" => "stub",
|
|
7801
7983
|
"created_at" => "stub",
|
|
7802
7984
|
"updated_at" => "stub",
|
data/test/workos/test_pipes.rb
CHANGED
|
@@ -18,10 +18,10 @@ class PipesTest < Minitest::Test
|
|
|
18
18
|
refute_nil result
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def
|
|
21
|
+
def test_get_access_token_returns_expected_result
|
|
22
22
|
stub_request(:post, %r{\Ahttps://api\.workos\.com/data-integrations/stub/token(\?|\z)})
|
|
23
23
|
.to_return(body: "{}", status: 200)
|
|
24
|
-
result = @client.pipes.
|
|
24
|
+
result = @client.pipes.get_access_token(provider: "stub", user_id: "stub")
|
|
25
25
|
refute_nil result
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -49,7 +49,7 @@ class PipesTest < Minitest::Test
|
|
|
49
49
|
# Parameterized authentication error tests (one per endpoint).
|
|
50
50
|
[
|
|
51
51
|
{name: :authorize_data_integration, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/authorize(\?|\z)}, args: {slug: "stub", user_id: "stub"}},
|
|
52
|
-
{name: :
|
|
52
|
+
{name: :get_access_token, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/token(\?|\z)}, args: {provider: "stub", user_id: "stub"}},
|
|
53
53
|
{name: :get_user_connected_account, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}},
|
|
54
54
|
{name: :delete_user_connected_account, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}},
|
|
55
55
|
{name: :list_user_data_providers, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/data_providers(\?|\z)}, args: {user_id: "stub"}}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 PipesProviderTest < 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_data_integration_configurations_returns_expected_result
|
|
15
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/data_integration_configurations(\?|\z)})
|
|
16
|
+
.to_return(body: "{}", status: 200)
|
|
17
|
+
result = @client.pipes_provider.list_organization_data_integration_configurations(organization_id: "stub")
|
|
18
|
+
refute_nil result
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_update_organization_data_integration_configuration_returns_expected_result
|
|
22
|
+
stub_request(:put, %r{\Ahttps://api\.workos\.com/organizations/stub/data_integration_configurations/stub(\?|\z)})
|
|
23
|
+
.to_return(body: "{}", status: 200)
|
|
24
|
+
result = @client.pipes_provider.update_organization_data_integration_configuration(organization_id: "stub", slug: "stub")
|
|
25
|
+
refute_nil result
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Parameterized authentication error tests (one per endpoint).
|
|
29
|
+
[
|
|
30
|
+
{name: :list_organization_data_integration_configurations, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/data_integration_configurations(\?|\z)}, args: {organization_id: "stub"}},
|
|
31
|
+
{name: :update_organization_data_integration_configuration, verb: :put, url: %r{\Ahttps://api\.workos\.com/organizations/stub/data_integration_configurations/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}}
|
|
32
|
+
].each do |spec|
|
|
33
|
+
define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do
|
|
34
|
+
stub_request(spec[:verb], spec[:url])
|
|
35
|
+
.to_return(body: '{"message": "Unauthorized"}', status: 401)
|
|
36
|
+
assert_raises(WorkOS::AuthenticationError) do
|
|
37
|
+
@client.pipes_provider.send(spec[:name], **(spec[:args] || {}))
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|