workos 0.2.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/.ruby-version +1 -1
  4. data/.semaphore/semaphore.yml +13 -6
  5. data/Gemfile.lock +6 -6
  6. data/README.md +1 -1
  7. data/lib/workos.rb +2 -0
  8. data/lib/workos/audit_trail.rb +0 -16
  9. data/lib/workos/client.rb +43 -4
  10. data/lib/workos/connection.rb +48 -0
  11. data/lib/workos/directory_sync.rb +128 -0
  12. data/lib/workos/profile.rb +6 -7
  13. data/lib/workos/sso.rb +48 -35
  14. data/lib/workos/types.rb +2 -2
  15. data/lib/workos/types/connection_struct.rb +15 -0
  16. data/lib/workos/types/profile_struct.rb +2 -3
  17. data/lib/workos/types/provider_enum.rb +0 -1
  18. data/lib/workos/version.rb +1 -1
  19. data/sorbet/rbi/hidden-definitions/errors.txt +1416 -321
  20. data/sorbet/rbi/hidden-definitions/hidden.rbi +2490 -597
  21. data/sorbet/rbi/sorbet-typed/lib/rainbow/all/rainbow.rbi +36 -14
  22. data/sorbet/rbi/todo.rbi +1 -6
  23. data/spec/lib/workos/directory_sync_spec.rb +139 -0
  24. data/spec/lib/workos/sso_spec.rb +50 -4
  25. data/spec/support/fixtures/vcr_cassettes/directory_sync/get_group.yml +62 -0
  26. data/spec/support/fixtures/vcr_cassettes/directory_sync/get_group_with_invalid_id.yml +62 -0
  27. data/spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml +62 -0
  28. data/spec/support/fixtures/vcr_cassettes/directory_sync/get_user_with_invalid_id.yml +62 -0
  29. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories.yml +62 -0
  30. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories_with_domain_param.yml +63 -0
  31. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups.yml +64 -0
  32. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups_with_directory_param.yml +62 -0
  33. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users.yml +64 -0
  34. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users_with_directory_param.yml +62 -0
  35. data/spec/support/fixtures/vcr_cassettes/sso/create_connection_with_invalid_source.yml +58 -0
  36. data/spec/support/fixtures/vcr_cassettes/sso/create_connection_with_valid_source.yml +63 -0
  37. data/workos.gemspec +14 -11
  38. metadata +35 -5
@@ -0,0 +1,62 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.workos.com/directory_users/directory_usr_01E64QS50EAY48S0XJ1AA4WX4D
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
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/2.7.1; x86_64-darwin19; v0.2.3
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Connection:
28
+ - keep-alive
29
+ Vary:
30
+ - Origin, Accept-Encoding
31
+ Access-Control-Allow-Credentials:
32
+ - 'true'
33
+ X-Dns-Prefetch-Control:
34
+ - 'off'
35
+ X-Frame-Options:
36
+ - SAMEORIGIN
37
+ Strict-Transport-Security:
38
+ - max-age=15552000; includeSubDomains
39
+ X-Download-Options:
40
+ - noopen
41
+ X-Content-Type-Options:
42
+ - nosniff
43
+ X-Xss-Protection:
44
+ - 1; mode=block
45
+ X-Request-Id:
46
+ - fe3f582a-b944-4f2c-a225-ae3a7f099fa0
47
+ Content-Type:
48
+ - application/json; charset=utf-8
49
+ Content-Length:
50
+ - '368'
51
+ Etag:
52
+ - W/"170-JjGTDHa7GqXeAwXcua+s3+2z/oA"
53
+ Date:
54
+ - Thu, 30 Apr 2020 04:43:14 GMT
55
+ Via:
56
+ - 1.1 vegur
57
+ body:
58
+ encoding: UTF-8
59
+ string: '{"id":"directory_usr_01E64QS50EAY48S0XJ1AA4WX4D","raw_attributes":{"name":{"givenName":"Mark","familyName":"Tran"},"emails":[{"value":"mark@foo-corp.com","primary":true}],"userName":"mark@foo-corp.com","externalId":"118325297729072421906"},"first_name":"Mark","emails":[{"value":"mark@foo-corp.com","primary":true}],"username":"mark@foo-corp.com","last_name":"Tran"}'
60
+ http_version:
61
+ recorded_at: Thu, 30 Apr 2020 04:43:15 GMT
62
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,62 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.workos.com/directory_users/invalid
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
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/2.7.1; x86_64-darwin19; v0.2.3
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 404
23
+ message: Not Found
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Connection:
28
+ - keep-alive
29
+ Vary:
30
+ - Origin, Accept-Encoding
31
+ Access-Control-Allow-Credentials:
32
+ - 'true'
33
+ X-Dns-Prefetch-Control:
34
+ - 'off'
35
+ X-Frame-Options:
36
+ - SAMEORIGIN
37
+ Strict-Transport-Security:
38
+ - max-age=15552000; includeSubDomains
39
+ X-Download-Options:
40
+ - noopen
41
+ X-Content-Type-Options:
42
+ - nosniff
43
+ X-Xss-Protection:
44
+ - 1; mode=block
45
+ X-Request-Id:
46
+ - 19dfa905-2015-44fb-8d5f-46f2d6c49826
47
+ Content-Type:
48
+ - application/json; charset=utf-8
49
+ Content-Length:
50
+ - '23'
51
+ Etag:
52
+ - W/"17-SuRA/yvUWUo8rK6x7dKURLeBo+0"
53
+ Date:
54
+ - Thu, 30 Apr 2020 04:45:35 GMT
55
+ Via:
56
+ - 1.1 vegur
57
+ body:
58
+ encoding: UTF-8
59
+ string: '{"message":"Not Found"}'
60
+ http_version:
61
+ recorded_at: Thu, 30 Apr 2020 04:45:35 GMT
62
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,62 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.workos.com/directories
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
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/2.7.1; x86_64-darwin19; v0.2.3
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Connection:
28
+ - keep-alive
29
+ Vary:
30
+ - Origin, Accept-Encoding
31
+ Access-Control-Allow-Credentials:
32
+ - 'true'
33
+ X-Dns-Prefetch-Control:
34
+ - 'off'
35
+ X-Frame-Options:
36
+ - SAMEORIGIN
37
+ Strict-Transport-Security:
38
+ - max-age=15552000; includeSubDomains
39
+ X-Download-Options:
40
+ - noopen
41
+ X-Content-Type-Options:
42
+ - nosniff
43
+ X-Xss-Protection:
44
+ - 1; mode=block
45
+ X-Request-Id:
46
+ - 53c53a76-1f3f-43bb-85a3-8faef43db375
47
+ Content-Type:
48
+ - application/json; charset=utf-8
49
+ Etag:
50
+ - W/"b53-vfsK4+PwHsj4f+pAs0MzdO3odVo"
51
+ Date:
52
+ - Thu, 30 Apr 2020 03:11:45 GMT
53
+ Transfer-Encoding:
54
+ - chunked
55
+ Via:
56
+ - 1.1 vegur
57
+ body:
58
+ encoding: ASCII-8BIT
59
+ string: '{"object":"list","listMetadata":{"before":"directory_edp_01E44H95QPBGZ6A4D89VYZ0WX1","after":null},"data":[{"object":"directory","id":"directory_edp_01E64QQVQTCB0DECJ9CFNXEWDW","external_key":"lA3gS1kCZMCkk82E","state":"linked","type":"gsuite directory","name":"Foo Corp","bearer_token":null,"project_id":"project_01DFYCG8RCB1DB6DKFTGXF4Q9F","domain":"foo-corp.com"}]}'
60
+ http_version:
61
+ recorded_at: Thu, 30 Apr 2020 03:11:45 GMT
62
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,63 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.workos.com/directories?domain=foo-corp.com
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
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/2.7.1; x86_64-darwin19; v0.2.3
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Connection:
28
+ - keep-alive
29
+ Vary:
30
+ - Origin, Accept-Encoding
31
+ Access-Control-Allow-Credentials:
32
+ - 'true'
33
+ X-Dns-Prefetch-Control:
34
+ - 'off'
35
+ X-Frame-Options:
36
+ - SAMEORIGIN
37
+ Strict-Transport-Security:
38
+ - max-age=15552000; includeSubDomains
39
+ X-Download-Options:
40
+ - noopen
41
+ X-Content-Type-Options:
42
+ - nosniff
43
+ X-Xss-Protection:
44
+ - 1; mode=block
45
+ X-Request-Id:
46
+ - '08feb93b-22e8-4955-b17d-0e5efa1ed6a4'
47
+ Content-Type:
48
+ - application/json; charset=utf-8
49
+ Content-Length:
50
+ - '330'
51
+ Etag:
52
+ - W/"14a-Q+U+kuKWjl8FQwSosUsvUraY82A"
53
+ Date:
54
+ - Thu, 30 Apr 2020 03:42:20 GMT
55
+ Via:
56
+ - 1.1 vegur
57
+ body:
58
+ encoding: UTF-8
59
+ string: '{"object":"list","listMetadata":{"before":null,"after":null},"data":[{"object":"directory","id":"directory_edp_01E64QQVQTCB0DECJ9CFNXEWDW","external_key":"lA3gS1kCZMCkk82E","state":"linked","type":"gsuite
60
+ directory","name":"Foo Corp","bearer_token":null,"project_id":"project_01DFYCG8RCB1DB6DKFTGXF4Q9F","domain":"foo-corp.com"}]}'
61
+ http_version:
62
+ recorded_at: Thu, 30 Apr 2020 03:42:20 GMT
63
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,64 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.workos.com/directory_groups
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
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/2.7.1; x86_64-darwin19; v0.2.3
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 422
23
+ message: Unprocessable Entity
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Connection:
28
+ - keep-alive
29
+ Vary:
30
+ - Origin, Accept-Encoding
31
+ Access-Control-Allow-Credentials:
32
+ - 'true'
33
+ X-Dns-Prefetch-Control:
34
+ - 'off'
35
+ X-Frame-Options:
36
+ - SAMEORIGIN
37
+ Strict-Transport-Security:
38
+ - max-age=15552000; includeSubDomains
39
+ X-Download-Options:
40
+ - noopen
41
+ X-Content-Type-Options:
42
+ - nosniff
43
+ X-Xss-Protection:
44
+ - 1; mode=block
45
+ X-Request-Id:
46
+ - 3ffb5dc0-7dbe-453f-9514-6e50363b413e
47
+ Content-Type:
48
+ - application/json; charset=utf-8
49
+ Content-Length:
50
+ - '219'
51
+ Etag:
52
+ - W/"db-gphk1TAe8P3eXtQnl1v8qxKQjZs"
53
+ Date:
54
+ - Thu, 30 Apr 2020 06:24:08 GMT
55
+ Via:
56
+ - 1.1 vegur
57
+ body:
58
+ encoding: UTF-8
59
+ string: '{"message":"Validation failed","errors":[{"field":"directory","code":"Please
60
+ provide either \"directory\" or \"user\" parameters."},{"field":"user","code":"Please
61
+ provide either \"directory\" or \"user\" parameters."}]}'
62
+ http_version:
63
+ recorded_at: Thu, 30 Apr 2020 06:24:08 GMT
64
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,62 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.workos.com/directory_groups?directory=directory_edp_01E64QQVQTCB0DECJ9CFNXEWDW
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
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/2.7.1; x86_64-darwin19; v0.2.3
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Connection:
28
+ - keep-alive
29
+ Vary:
30
+ - Origin, Accept-Encoding
31
+ Access-Control-Allow-Credentials:
32
+ - 'true'
33
+ X-Dns-Prefetch-Control:
34
+ - 'off'
35
+ X-Frame-Options:
36
+ - SAMEORIGIN
37
+ Strict-Transport-Security:
38
+ - max-age=15552000; includeSubDomains
39
+ X-Download-Options:
40
+ - noopen
41
+ X-Content-Type-Options:
42
+ - nosniff
43
+ X-Xss-Protection:
44
+ - 1; mode=block
45
+ X-Request-Id:
46
+ - 87133408-9847-42ef-a6da-183280e6402c
47
+ Content-Type:
48
+ - application/json; charset=utf-8
49
+ Content-Length:
50
+ - '813'
51
+ Etag:
52
+ - W/"32d-Pi2S8kCjmY/SVPoMmwh0JNvHbgY"
53
+ Date:
54
+ - Thu, 30 Apr 2020 04:31:47 GMT
55
+ Via:
56
+ - 1.1 vegur
57
+ body:
58
+ encoding: UTF-8
59
+ string: '{"object":"list","listMetadata":{"before":"directory_grp_01E64QTDHHE80V9N03ZTDV5SXD","after":null},"data":[{"id":"directory_grp_01E64QTDNS0EGJ0FMCVY9BWGZT","name":"Walrus"},{"id":"directory_grp_01E64QTDJTE8P0S3JKM7KV848A","name":"Design team"}]}'
60
+ http_version:
61
+ recorded_at: Thu, 30 Apr 2020 04:31:47 GMT
62
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,64 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.workos.com/directory_users
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
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/2.7.1; x86_64-darwin19; v0.2.3
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 422
23
+ message: Unprocessable Entity
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Connection:
28
+ - keep-alive
29
+ Vary:
30
+ - Origin, Accept-Encoding
31
+ Access-Control-Allow-Credentials:
32
+ - 'true'
33
+ X-Dns-Prefetch-Control:
34
+ - 'off'
35
+ X-Frame-Options:
36
+ - SAMEORIGIN
37
+ Strict-Transport-Security:
38
+ - max-age=15552000; includeSubDomains
39
+ X-Download-Options:
40
+ - noopen
41
+ X-Content-Type-Options:
42
+ - nosniff
43
+ X-Xss-Protection:
44
+ - 1; mode=block
45
+ X-Request-Id:
46
+ - 67a36a16-8d82-495d-a4cd-11a42e6c111e
47
+ Content-Type:
48
+ - application/json; charset=utf-8
49
+ Content-Length:
50
+ - '222'
51
+ Etag:
52
+ - W/"de-33B+CY27z2HlOGKZPu4nzUVQpuI"
53
+ Date:
54
+ - Thu, 30 Apr 2020 06:23:44 GMT
55
+ Via:
56
+ - 1.1 vegur
57
+ body:
58
+ encoding: UTF-8
59
+ string: '{"message":"Validation failed","errors":[{"field":"directory","code":"Please
60
+ provide either \"directory\" or \"group\" parameters."},{"field":"group","code":"Please
61
+ provide either \"directory\" or \"group\" parameters."}]}'
62
+ http_version:
63
+ recorded_at: Thu, 30 Apr 2020 06:23:44 GMT
64
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,62 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.workos.com/directory_users?directory=directory_edp_01E64QQVQTCB0DECJ9CFNXEWDW
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
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/2.7.1; x86_64-darwin19; v0.2.3
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Connection:
28
+ - keep-alive
29
+ Vary:
30
+ - Origin, Accept-Encoding
31
+ Access-Control-Allow-Credentials:
32
+ - 'true'
33
+ X-Dns-Prefetch-Control:
34
+ - 'off'
35
+ X-Frame-Options:
36
+ - SAMEORIGIN
37
+ Strict-Transport-Security:
38
+ - max-age=15552000; includeSubDomains
39
+ X-Download-Options:
40
+ - noopen
41
+ X-Content-Type-Options:
42
+ - nosniff
43
+ X-Xss-Protection:
44
+ - 1; mode=block
45
+ X-Request-Id:
46
+ - 91802a43-3053-41e6-9a71-44fe88321224
47
+ Content-Type:
48
+ - application/json; charset=utf-8
49
+ Etag:
50
+ - W/"e55-P0NG6CugY3cr6/bL+B4xBkwDGns"
51
+ Date:
52
+ - Thu, 30 Apr 2020 04:36:02 GMT
53
+ Transfer-Encoding:
54
+ - chunked
55
+ Via:
56
+ - 1.1 vegur
57
+ body:
58
+ encoding: ASCII-8BIT
59
+ string: '{"object":"list","listMetadata":{"before":null,"after":null},"data":[{"id":"directory_usr_01E64QS50EAY48S0XJ1AA4WX4D","raw_attributes":{"name":{"givenName":"Mark","familyName":"Tran"},"emails":[{"value":"mark@foo-corp.com","primary":true}],"userName":"mark@foo-corp.com","externalId":"118325297729072421906"},"first_name":"Mark","emails":[{"value":"mark@foo-corp.com","primary":true}],"username":"mark@foo-corp.com","last_name":"Tran"}]}'
60
+ http_version:
61
+ recorded_at: Thu, 30 Apr 2020 04:36:02 GMT
62
+ recorded_with: VCR 5.0.0