workos 0.10.3 → 0.11.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/.ruby-version +1 -1
- data/.semaphore/semaphore.yml +8 -2
- data/Gemfile.lock +49 -36
- data/lib/workos.rb +3 -0
- data/lib/workos/client.rb +3 -3
- data/lib/workos/connection.rb +8 -1
- data/lib/workos/directory.rb +53 -0
- data/lib/workos/directory_group.rb +44 -0
- data/lib/workos/directory_sync.rb +63 -7
- data/lib/workos/directory_user.rb +60 -0
- data/lib/workos/profile.rb +1 -2
- data/lib/workos/sso.rb +10 -2
- data/lib/workos/types.rb +3 -0
- data/lib/workos/types/connection_struct.rb +2 -0
- data/lib/workos/types/directory_group_struct.rb +13 -0
- data/lib/workos/types/directory_struct.rb +16 -0
- data/lib/workos/types/directory_user_struct.rb +18 -0
- data/lib/workos/version.rb +1 -1
- data/sorbet/rbi/gems/addressable.rbi +199 -0
- data/sorbet/rbi/gems/ast.rbi +49 -0
- data/sorbet/rbi/gems/codecov.rbi +37 -0
- data/sorbet/rbi/gems/crack.rbi +62 -0
- data/sorbet/rbi/gems/docile.rbi +36 -0
- data/sorbet/rbi/gems/hashdiff.rbi +66 -0
- data/sorbet/rbi/gems/parallel.rbi +83 -0
- data/sorbet/rbi/gems/parser.rbi +1429 -0
- data/sorbet/rbi/gems/public_suffix.rbi +104 -0
- data/sorbet/rbi/gems/rainbow.rbi +118 -0
- data/sorbet/rbi/gems/rake.rbi +644 -0
- data/sorbet/rbi/gems/regexp_parser.rbi +926 -0
- data/sorbet/rbi/gems/rexml.rbi +628 -0
- data/sorbet/rbi/gems/rspec-core.rbi +1898 -0
- data/sorbet/rbi/gems/rspec-expectations.rbi +1127 -0
- data/sorbet/rbi/gems/rspec-mocks.rbi +1099 -0
- data/sorbet/rbi/gems/rspec-support.rbi +280 -0
- data/sorbet/rbi/gems/rspec.rbi +15 -0
- data/sorbet/rbi/gems/rubocop-ast.rbi +1355 -0
- data/sorbet/rbi/gems/rubocop.rbi +7253 -0
- data/sorbet/rbi/gems/ruby-progressbar.rbi +304 -0
- data/sorbet/rbi/gems/simplecov-html.rbi +35 -0
- data/sorbet/rbi/gems/simplecov.rbi +406 -0
- data/sorbet/rbi/gems/unicode-display_width.rbi +17 -0
- data/sorbet/rbi/gems/vcr.rbi +572 -0
- data/sorbet/rbi/gems/webmock.rbi +556 -0
- data/sorbet/rbi/gems/yard.rbi +1165 -0
- data/sorbet/rbi/sorbet-typed/lib/rake/all/rake.rbi +645 -0
- data/sorbet/rbi/sorbet-typed/lib/rspec-core/all/rspec-core.rbi +1891 -0
- data/sorbet/rbi/sorbet-typed/lib/rubocop/~>0.85/rubocop.rbi +2072 -0
- data/sorbet/rbi/sorbet-typed/lib/yard/all/yard.rbi +1214 -0
- data/sorbet/rbi/todo.rbi +1 -3
- data/spec/lib/workos/directory_sync_spec.rb +347 -32
- data/spec/lib/workos/sso_spec.rb +106 -31
- data/spec/spec_helper.rb +1 -1
- data/spec/support/fixtures/vcr_cassettes/directory_sync/delete_directory.yml +72 -0
- data/spec/support/fixtures/vcr_cassettes/{sso/list_connections.yml → directory_sync/list_directories/with_after.yml} +7 -7
- data/spec/support/fixtures/vcr_cassettes/{sso/list_connections_with_limit_param.yml → directory_sync/list_directories/with_before.yml} +8 -8
- data/spec/support/fixtures/vcr_cassettes/{sso/list_connections_with_connection_type_param.yml → directory_sync/list_directories/with_domain.yml} +11 -10
- data/spec/support/fixtures/vcr_cassettes/{sso/list_connections_with_after_param.yml → directory_sync/list_directories/with_limit.yml} +12 -10
- data/spec/support/fixtures/vcr_cassettes/directory_sync/{list_directories.yml → list_directories/with_no_options.yml} +1 -1
- data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_search.yml +73 -0
- data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml +76 -0
- data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml +74 -0
- data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml +78 -0
- data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_limit.yml +74 -0
- data/spec/support/fixtures/vcr_cassettes/directory_sync/{list_groups.yml → list_groups/with_no_options.yml} +16 -6
- data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml +72 -0
- data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_after.yml +86 -0
- data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml +75 -0
- data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml +93 -0
- data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_group.yml +76 -0
- data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_limit.yml +75 -0
- data/spec/support/fixtures/vcr_cassettes/directory_sync/{list_users.yml → list_users/with_no_options.yml} +16 -6
- data/spec/support/fixtures/vcr_cassettes/sso/create_connection_with_valid_source.yml +3 -3
- data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_after.yml +73 -0
- data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_before.yml +73 -0
- data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_connection_type.yml +73 -0
- data/spec/support/fixtures/vcr_cassettes/sso/{list_connections_with_domain_param.yml → list_connections/with_domain.yml} +6 -6
- data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_limit.yml +74 -0
- data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_no_options.yml +73 -0
- data/spec/support/fixtures/vcr_cassettes/sso/{list_connections_with_organization_id_param.yml → list_connections/with_organization_id.yml} +6 -6
- data/workos.gemspec +2 -0
- metadata +97 -40
- data/sorbet/rbi/hidden-definitions/errors.txt +0 -24896
- data/sorbet/rbi/hidden-definitions/hidden.rbi +0 -38411
- data/sorbet/rbi/sorbet-typed/lib/bundler/all/bundler.rbi +0 -8684
- data/sorbet/rbi/sorbet-typed/lib/ruby/all/gem.rbi +0 -4222
- data/sorbet/rbi/sorbet-typed/lib/ruby/all/open3.rbi +0 -111
- data/sorbet/rbi/sorbet-typed/lib/ruby/all/resolv.rbi +0 -543
- data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories_with_domain_param.yml +0 -63
- data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups_with_directory_param.yml +0 -62
- data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users_with_directory_param.yml +0 -62
- data/spec/support/fixtures/vcr_cassettes/sso/list_connections_with_before_param.yml +0 -73
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 40285726466960ebdf92e8c851d172bc9387a0941579c1f2e4fb9b1b262ea071
|
|
4
|
+
data.tar.gz: 3ceb76e02b50a129e077bc99822b0bc79615a2a8f4df1315c210766feb6333cb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 27d9e22ba5b80d6dcfdcdd68886c64b720d7f94ee0724007599a4d2410e56b778771978046930e24a480f1bac0de4823d2dd39c1669cdbc36a4629547a84e9f6
|
|
7
|
+
data.tar.gz: f750566f656fc734d9d112bb99285de9f371e64212fdfa404dae62f77473f97cc735990b157cc03e5f10032fe139a48d9a68533cd0f75b81f98d631408e17685
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3.0.1
|
data/.semaphore/semaphore.yml
CHANGED
|
@@ -60,10 +60,16 @@ blocks:
|
|
|
60
60
|
- sem-version ruby 2.6.5
|
|
61
61
|
- bundle install
|
|
62
62
|
- bundle exec rspec
|
|
63
|
-
- name: Ruby 2.7.
|
|
63
|
+
- name: Ruby 2.7.3
|
|
64
64
|
commands:
|
|
65
65
|
- checkout
|
|
66
|
-
- sem-version ruby 2.7.
|
|
66
|
+
- sem-version ruby 2.7.3
|
|
67
|
+
- bundle install
|
|
68
|
+
- bundle exec rspec
|
|
69
|
+
- name: Ruby 3.0.1
|
|
70
|
+
commands:
|
|
71
|
+
- checkout
|
|
72
|
+
- sem-version ruby 3.0.1
|
|
67
73
|
- bundle install
|
|
68
74
|
- bundle exec rspec
|
|
69
75
|
promotions:
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
workos (0.
|
|
4
|
+
workos (0.11.0)
|
|
5
5
|
sorbet-runtime (~> 0.5)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
@@ -9,60 +9,73 @@ GEM
|
|
|
9
9
|
specs:
|
|
10
10
|
addressable (2.7.0)
|
|
11
11
|
public_suffix (>= 2.0.2, < 5.0)
|
|
12
|
-
ast (2.4.
|
|
13
|
-
codecov (0.2.
|
|
12
|
+
ast (2.4.2)
|
|
13
|
+
codecov (0.2.12)
|
|
14
14
|
json
|
|
15
15
|
simplecov
|
|
16
|
-
crack (0.4.
|
|
17
|
-
|
|
18
|
-
diff-lcs (1.
|
|
19
|
-
docile (1.3.
|
|
20
|
-
hashdiff (1.0.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
public_suffix (4.0.2)
|
|
16
|
+
crack (0.4.5)
|
|
17
|
+
rexml
|
|
18
|
+
diff-lcs (1.4.4)
|
|
19
|
+
docile (1.3.5)
|
|
20
|
+
hashdiff (1.0.1)
|
|
21
|
+
json (2.5.1)
|
|
22
|
+
parallel (1.20.1)
|
|
23
|
+
parser (3.0.1.0)
|
|
24
|
+
ast (~> 2.4.1)
|
|
25
|
+
public_suffix (4.0.6)
|
|
27
26
|
rainbow (3.0.0)
|
|
28
|
-
rake (13.0.
|
|
27
|
+
rake (13.0.3)
|
|
28
|
+
regexp_parser (2.1.1)
|
|
29
|
+
rexml (3.2.5)
|
|
29
30
|
rspec (3.9.0)
|
|
30
31
|
rspec-core (~> 3.9.0)
|
|
31
32
|
rspec-expectations (~> 3.9.0)
|
|
32
33
|
rspec-mocks (~> 3.9.0)
|
|
33
|
-
rspec-core (3.9.
|
|
34
|
-
rspec-support (~> 3.9.
|
|
35
|
-
rspec-expectations (3.9.
|
|
34
|
+
rspec-core (3.9.3)
|
|
35
|
+
rspec-support (~> 3.9.3)
|
|
36
|
+
rspec-expectations (3.9.4)
|
|
36
37
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
37
38
|
rspec-support (~> 3.9.0)
|
|
38
|
-
rspec-mocks (3.9.
|
|
39
|
+
rspec-mocks (3.9.1)
|
|
39
40
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
40
41
|
rspec-support (~> 3.9.0)
|
|
41
|
-
rspec-support (3.9.
|
|
42
|
-
rubocop (0.
|
|
43
|
-
jaro_winkler (~> 1.5.1)
|
|
42
|
+
rspec-support (3.9.4)
|
|
43
|
+
rubocop (0.93.1)
|
|
44
44
|
parallel (~> 1.10)
|
|
45
|
-
parser (>= 2.
|
|
45
|
+
parser (>= 2.7.1.5)
|
|
46
46
|
rainbow (>= 2.2.2, < 4.0)
|
|
47
|
+
regexp_parser (>= 1.8)
|
|
48
|
+
rexml
|
|
49
|
+
rubocop-ast (>= 0.6.0)
|
|
47
50
|
ruby-progressbar (~> 1.7)
|
|
48
|
-
unicode-display_width (>= 1.4.0, <
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
|
52
|
+
rubocop-ast (1.4.1)
|
|
53
|
+
parser (>= 2.7.1.5)
|
|
54
|
+
ruby-progressbar (1.11.0)
|
|
55
|
+
simplecov (0.21.2)
|
|
52
56
|
docile (~> 1.1)
|
|
53
57
|
simplecov-html (~> 0.11)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
sorbet
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
simplecov_json_formatter (~> 0.1)
|
|
59
|
+
simplecov-html (0.12.3)
|
|
60
|
+
simplecov_json_formatter (0.1.2)
|
|
61
|
+
sorbet (0.5.6388)
|
|
62
|
+
sorbet-static (= 0.5.6388)
|
|
63
|
+
sorbet-runtime (0.5.6391)
|
|
64
|
+
sorbet-static (0.5.6388-universal-darwin-14)
|
|
65
|
+
sorbet-static (0.5.6388-universal-darwin-15)
|
|
66
|
+
sorbet-static (0.5.6388-universal-darwin-16)
|
|
67
|
+
sorbet-static (0.5.6388-universal-darwin-17)
|
|
68
|
+
sorbet-static (0.5.6388-universal-darwin-18)
|
|
69
|
+
sorbet-static (0.5.6388-universal-darwin-19)
|
|
70
|
+
sorbet-static (0.5.6388-universal-darwin-20)
|
|
71
|
+
sorbet-static (0.5.6388-x86_64-linux)
|
|
72
|
+
unicode-display_width (1.7.0)
|
|
60
73
|
vcr (5.0.0)
|
|
61
|
-
webmock (3.
|
|
74
|
+
webmock (3.12.2)
|
|
62
75
|
addressable (>= 2.3.6)
|
|
63
76
|
crack (>= 0.3.2)
|
|
64
77
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
65
|
-
yard (0.9.
|
|
78
|
+
yard (0.9.26)
|
|
66
79
|
|
|
67
80
|
PLATFORMS
|
|
68
81
|
ruby
|
|
@@ -80,4 +93,4 @@ DEPENDENCIES
|
|
|
80
93
|
yard
|
|
81
94
|
|
|
82
95
|
BUNDLED WITH
|
|
83
|
-
2.
|
|
96
|
+
2.2.16
|
data/lib/workos.rb
CHANGED
|
@@ -32,11 +32,14 @@ module WorkOS
|
|
|
32
32
|
autoload :AuditTrail, 'workos/audit_trail'
|
|
33
33
|
autoload :Connection, 'workos/connection'
|
|
34
34
|
autoload :DirectorySync, 'workos/directory_sync'
|
|
35
|
+
autoload :Directory, 'workos/directory'
|
|
36
|
+
autoload :DirectoryGroup, 'workos/directory_group'
|
|
35
37
|
autoload :Organization, 'workos/organization'
|
|
36
38
|
autoload :Passwordless, 'workos/passwordless'
|
|
37
39
|
autoload :Portal, 'workos/portal'
|
|
38
40
|
autoload :Profile, 'workos/profile'
|
|
39
41
|
autoload :SSO, 'workos/sso'
|
|
42
|
+
autoload :DirectoryUser, 'workos/directory_user'
|
|
40
43
|
|
|
41
44
|
# Errors
|
|
42
45
|
autoload :APIError, 'workos/errors'
|
data/lib/workos/client.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
# typed:
|
|
2
|
+
# typed: false
|
|
3
3
|
|
|
4
4
|
module WorkOS
|
|
5
5
|
# A Net::HTTP based API client for interacting with the WorkOS API
|
|
@@ -102,7 +102,7 @@ module WorkOS
|
|
|
102
102
|
].join('; ')
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
-
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
|
105
|
+
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
|
106
106
|
sig { params(response: ::T.untyped).void }
|
|
107
107
|
def handle_error_response(response:)
|
|
108
108
|
http_status = response.code.to_i
|
|
@@ -139,7 +139,7 @@ module WorkOS
|
|
|
139
139
|
)
|
|
140
140
|
end
|
|
141
141
|
end
|
|
142
|
-
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
|
|
142
|
+
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
|
|
143
143
|
|
|
144
144
|
private
|
|
145
145
|
|
data/lib/workos/connection.rb
CHANGED
|
@@ -8,7 +8,8 @@ module WorkOS
|
|
|
8
8
|
class Connection
|
|
9
9
|
extend T::Sig
|
|
10
10
|
|
|
11
|
-
attr_accessor :id, :name, :connection_type, :domains
|
|
11
|
+
attr_accessor :id, :name, :connection_type, :domains, :organization_id,
|
|
12
|
+
:status
|
|
12
13
|
|
|
13
14
|
sig { params(json: String).void }
|
|
14
15
|
def initialize(json)
|
|
@@ -18,6 +19,8 @@ module WorkOS
|
|
|
18
19
|
@name = T.let(raw.name, String)
|
|
19
20
|
@connection_type = T.let(raw.connection_type, String)
|
|
20
21
|
@domains = T.let(raw.domains, Array)
|
|
22
|
+
@organization_id = T.let(raw.organization_id, String)
|
|
23
|
+
@status = T.let(raw.status, String)
|
|
21
24
|
end
|
|
22
25
|
|
|
23
26
|
def to_json(*)
|
|
@@ -26,6 +29,8 @@ module WorkOS
|
|
|
26
29
|
name: name,
|
|
27
30
|
connection_type: connection_type,
|
|
28
31
|
domains: domains,
|
|
32
|
+
organization_id: organization_id,
|
|
33
|
+
status: status,
|
|
29
34
|
}
|
|
30
35
|
end
|
|
31
36
|
|
|
@@ -40,6 +45,8 @@ module WorkOS
|
|
|
40
45
|
name: hash[:name],
|
|
41
46
|
connection_type: hash[:connection_type],
|
|
42
47
|
domains: hash[:domains],
|
|
48
|
+
organization_id: hash[:organization_id],
|
|
49
|
+
status: hash[:status],
|
|
43
50
|
)
|
|
44
51
|
end
|
|
45
52
|
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: true
|
|
3
|
+
|
|
4
|
+
module WorkOS
|
|
5
|
+
# The Directory class provides a lightweight wrapper around
|
|
6
|
+
# a WorkOS Directory resource. This class is not meant to be instantiated
|
|
7
|
+
# in user space, and is instantiated internally but exposed.
|
|
8
|
+
class Directory
|
|
9
|
+
extend T::Sig
|
|
10
|
+
|
|
11
|
+
attr_accessor :id, :domain, :name, :type, :state
|
|
12
|
+
|
|
13
|
+
sig { params(json: String).void }
|
|
14
|
+
def initialize(json)
|
|
15
|
+
raw = parse_json(json)
|
|
16
|
+
|
|
17
|
+
@id = T.let(raw.id, String)
|
|
18
|
+
@name = T.let(raw.name, String)
|
|
19
|
+
@domain = T.let(raw.domain, String)
|
|
20
|
+
@type = T.let(raw.type, String)
|
|
21
|
+
@state = T.let(raw.state, String)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def to_json(*)
|
|
25
|
+
{
|
|
26
|
+
id: id,
|
|
27
|
+
name: name,
|
|
28
|
+
domain: domain,
|
|
29
|
+
type: type,
|
|
30
|
+
state: state,
|
|
31
|
+
}
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
sig do
|
|
37
|
+
params(
|
|
38
|
+
json_string: String,
|
|
39
|
+
).returns(WorkOS::Types::DirectoryStruct)
|
|
40
|
+
end
|
|
41
|
+
def parse_json(json_string)
|
|
42
|
+
hash = JSON.parse(json_string, symbolize_names: true)
|
|
43
|
+
|
|
44
|
+
WorkOS::Types::DirectoryStruct.new(
|
|
45
|
+
id: hash[:id],
|
|
46
|
+
name: hash[:name],
|
|
47
|
+
domain: hash[:domain],
|
|
48
|
+
type: hash[:type],
|
|
49
|
+
state: hash[:state],
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: true
|
|
3
|
+
|
|
4
|
+
module WorkOS
|
|
5
|
+
# The DirectoryGroup class provides a lightweight wrapper around
|
|
6
|
+
# a WorkOS DirectoryGroup resource. This class is not meant to be instantiated
|
|
7
|
+
# in user space, and is instantiated internally but exposed.
|
|
8
|
+
class DirectoryGroup
|
|
9
|
+
extend T::Sig
|
|
10
|
+
|
|
11
|
+
attr_accessor :id, :name
|
|
12
|
+
|
|
13
|
+
sig { params(json: String).void }
|
|
14
|
+
def initialize(json)
|
|
15
|
+
raw = parse_json(json)
|
|
16
|
+
|
|
17
|
+
@id = T.let(raw.id, String)
|
|
18
|
+
@name = T.let(raw.name, String)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def to_json(*)
|
|
22
|
+
{
|
|
23
|
+
id: id,
|
|
24
|
+
name: name,
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
sig do
|
|
31
|
+
params(
|
|
32
|
+
json_string: String,
|
|
33
|
+
).returns(WorkOS::Types::DirectoryGroupStruct)
|
|
34
|
+
end
|
|
35
|
+
def parse_json(json_string)
|
|
36
|
+
hash = JSON.parse(json_string, symbolize_names: true)
|
|
37
|
+
|
|
38
|
+
WorkOS::Types::DirectoryGroupStruct.new(
|
|
39
|
+
id: hash[:id],
|
|
40
|
+
name: hash[:name],
|
|
41
|
+
)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
# typed:
|
|
2
|
+
# typed: strict
|
|
3
3
|
|
|
4
4
|
require 'net/http'
|
|
5
5
|
|
|
@@ -21,12 +21,17 @@ module WorkOS
|
|
|
21
21
|
# @option options [String] domain The domain of the directory to be
|
|
22
22
|
# retrieved.
|
|
23
23
|
# @option options [String] search A search term for direcory names.
|
|
24
|
+
# @option options [String] limit Maximum number of records to return.
|
|
25
|
+
# @option options [String] before Pagination cursor to receive records
|
|
26
|
+
# before a provided Directory ID.
|
|
27
|
+
# @option options [String] after Pagination cursor to receive records
|
|
28
|
+
# before a provided Directory ID.
|
|
24
29
|
#
|
|
25
30
|
# @return [Hash]
|
|
26
31
|
sig do
|
|
27
32
|
params(
|
|
28
33
|
options: T::Hash[Symbol, String],
|
|
29
|
-
).returns(
|
|
34
|
+
).returns(WorkOS::Types::ListStruct)
|
|
30
35
|
end
|
|
31
36
|
def list_directories(options = {})
|
|
32
37
|
response = execute_request(
|
|
@@ -37,7 +42,15 @@ module WorkOS
|
|
|
37
42
|
),
|
|
38
43
|
)
|
|
39
44
|
|
|
40
|
-
JSON.parse(response.body)
|
|
45
|
+
parsed_response = JSON.parse(response.body)
|
|
46
|
+
directories = parsed_response['data'].map do |directory|
|
|
47
|
+
::WorkOS::Directory.new(directory.to_json)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
WorkOS::Types::ListStruct.new(
|
|
51
|
+
data: directories,
|
|
52
|
+
list_metadata: parsed_response['listMetadata'],
|
|
53
|
+
)
|
|
41
54
|
end
|
|
42
55
|
|
|
43
56
|
# Retrieve directory groups.
|
|
@@ -47,12 +60,17 @@ module WorkOS
|
|
|
47
60
|
# directory groups will be retrieved.
|
|
48
61
|
# @option options [String] user The ID of the directory user whose
|
|
49
62
|
# directory groups will be retrieved.
|
|
63
|
+
# @option options [String] limit Maximum number of records to return.
|
|
64
|
+
# @option options [String] before Pagination cursor to receive records
|
|
65
|
+
# before a provided Directory Group ID.
|
|
66
|
+
# @option options [String] after Pagination cursor to receive records
|
|
67
|
+
# before a provided Directory Group ID.
|
|
50
68
|
#
|
|
51
69
|
# @return [Hash]
|
|
52
70
|
sig do
|
|
53
71
|
params(
|
|
54
72
|
options: T::Hash[Symbol, String],
|
|
55
|
-
).returns(
|
|
73
|
+
).returns(WorkOS::Types::ListStruct)
|
|
56
74
|
end
|
|
57
75
|
def list_groups(options = {})
|
|
58
76
|
response = execute_request(
|
|
@@ -63,7 +81,15 @@ module WorkOS
|
|
|
63
81
|
),
|
|
64
82
|
)
|
|
65
83
|
|
|
66
|
-
JSON.parse(response.body)
|
|
84
|
+
parsed_response = JSON.parse(response.body)
|
|
85
|
+
groups = parsed_response['data'].map do |group|
|
|
86
|
+
::WorkOS::DirectoryGroup.new(group.to_json)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
WorkOS::Types::ListStruct.new(
|
|
90
|
+
data: groups,
|
|
91
|
+
list_metadata: parsed_response['listMetadata'],
|
|
92
|
+
)
|
|
67
93
|
end
|
|
68
94
|
|
|
69
95
|
# Retrieve directory users.
|
|
@@ -73,12 +99,17 @@ module WorkOS
|
|
|
73
99
|
# directory users will be retrieved.
|
|
74
100
|
# @option options [String] user The ID of the directory group whose
|
|
75
101
|
# directory users will be retrieved.
|
|
102
|
+
# @option options [String] limit Maximum number of records to return.
|
|
103
|
+
# @option options [String] before Pagination cursor to receive records
|
|
104
|
+
# before a provided Directory User ID.
|
|
105
|
+
# @option options [String] after Pagination cursor to receive records
|
|
106
|
+
# before a provided Directory User ID.
|
|
76
107
|
#
|
|
77
108
|
# @return [Hash]
|
|
78
109
|
sig do
|
|
79
110
|
params(
|
|
80
111
|
options: T::Hash[Symbol, String],
|
|
81
|
-
).returns(
|
|
112
|
+
).returns(WorkOS::Types::ListStruct)
|
|
82
113
|
end
|
|
83
114
|
def list_users(options = {})
|
|
84
115
|
response = execute_request(
|
|
@@ -89,7 +120,15 @@ module WorkOS
|
|
|
89
120
|
),
|
|
90
121
|
)
|
|
91
122
|
|
|
92
|
-
JSON.parse(response.body)
|
|
123
|
+
parsed_response = JSON.parse(response.body)
|
|
124
|
+
users = parsed_response['data'].map do |user|
|
|
125
|
+
::WorkOS::DirectoryUser.new(user.to_json)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
WorkOS::Types::ListStruct.new(
|
|
129
|
+
data: users,
|
|
130
|
+
list_metadata: parsed_response['listMetadata'],
|
|
131
|
+
)
|
|
93
132
|
end
|
|
94
133
|
|
|
95
134
|
# Retrieve the directory group with the given ID.
|
|
@@ -125,6 +164,23 @@ module WorkOS
|
|
|
125
164
|
|
|
126
165
|
JSON.parse(response.body)
|
|
127
166
|
end
|
|
167
|
+
|
|
168
|
+
# Delete the directory with the given ID.
|
|
169
|
+
#
|
|
170
|
+
# @param [String] id The ID of the directory.
|
|
171
|
+
#
|
|
172
|
+
# @return Boolean
|
|
173
|
+
sig { params(id: String).returns(T::Boolean) }
|
|
174
|
+
def delete_directory(id)
|
|
175
|
+
request = delete_request(
|
|
176
|
+
auth: true,
|
|
177
|
+
path: "/directories/#{id}",
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
response = execute_request(request: request)
|
|
181
|
+
|
|
182
|
+
response.is_a? Net::HTTPSuccess
|
|
183
|
+
end
|
|
128
184
|
end
|
|
129
185
|
end
|
|
130
186
|
end
|