workos 0.2.2 → 0.3.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.
Files changed (37) 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/audit_trail.rb +0 -16
  8. data/lib/workos/client.rb +43 -4
  9. data/lib/workos/connection.rb +48 -0
  10. data/lib/workos/directory_sync.rb +128 -0
  11. data/lib/workos/profile.rb +6 -7
  12. data/lib/workos/sso.rb +45 -32
  13. data/lib/workos/types/connection_struct.rb +15 -0
  14. data/lib/workos/types/profile_struct.rb +0 -1
  15. data/lib/workos/types/provider_enum.rb +0 -1
  16. data/lib/workos/types.rb +2 -2
  17. data/lib/workos/version.rb +1 -1
  18. data/lib/workos.rb +2 -0
  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 +46 -0
  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. metadata +31 -2
@@ -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
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.workos.com/connections
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"source":"invalid"}'
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.2
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 404
23
+ message: Not Found
24
+ headers:
25
+ Vary:
26
+ - Origin, Accept-Encoding
27
+ Access-Control-Allow-Credentials:
28
+ - 'true'
29
+ X-Dns-Prefetch-Control:
30
+ - 'off'
31
+ X-Frame-Options:
32
+ - SAMEORIGIN
33
+ Strict-Transport-Security:
34
+ - max-age=15552000; includeSubDomains
35
+ X-Download-Options:
36
+ - noopen
37
+ X-Content-Type-Options:
38
+ - nosniff
39
+ X-Xss-Protection:
40
+ - 1; mode=block
41
+ X-Request-Id:
42
+ - ''
43
+ Content-Type:
44
+ - application/json; charset=utf-8
45
+ Content-Length:
46
+ - '23'
47
+ Etag:
48
+ - W/"17-SuRA/yvUWUo8rK6x7dKURLeBo+0"
49
+ Date:
50
+ - Fri, 24 Apr 2020 02:16:27 GMT
51
+ Connection:
52
+ - keep-alive
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"message":"Not Found"}'
56
+ http_version:
57
+ recorded_at: Fri, 24 Apr 2020 02:16:27 GMT
58
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,63 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.workos.com/connections
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"source":"draft_conn_01E6PK87QP6NQ29RRX0G100YGV"}'
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.2
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: Created
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
+ - 8cd03fab-ca1a-4c0b-9953-1f918849a9de
47
+ Content-Type:
48
+ - application/json; charset=utf-8
49
+ Etag:
50
+ - W/"55a-z00MNCfGmS/7RWJwhsBrAXo09Ls"
51
+ Date:
52
+ - Fri, 24 Apr 2020 17:20:52 GMT
53
+ Transfer-Encoding:
54
+ - chunked
55
+ Via:
56
+ - 1.1 vegur
57
+ body:
58
+ encoding: ASCII-8BIT
59
+ string: '{"object":"connection","id":"conn_01E4F9T2YWZFD218DN04KVFDSY","status":"unlinked","name":"Foo Corp","connection_type":"GoogleOAuth","oauth_uid":"demo
60
+ client id","oauth_secret":"demo client secret","oauth_redirect_uri":"https://auth.workos.com/sso/oauth/google/gcrSPYSytyQeZKkwKs6Ye4ogM/callback","saml_entity_id":null,"saml_idp_url":null,"saml_relying_party_trust_cert":null,"saml_x509_certs":null,"domains":[{"object":"connection_domain","id":"domain_01E6PK9N3XMD8RHWF7S66380AR","domain":"example.com"}]}'
61
+ http_version:
62
+ recorded_at: Fri, 24 Apr 2020 17:20:52 GMT
63
+ recorded_with: VCR 5.0.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - WorkOS
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-08 00:00:00.000000000 Z
11
+ date: 2020-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime
@@ -210,10 +210,13 @@ files:
210
210
  - lib/workos/audit_trail.rb
211
211
  - lib/workos/base.rb
212
212
  - lib/workos/client.rb
213
+ - lib/workos/connection.rb
214
+ - lib/workos/directory_sync.rb
213
215
  - lib/workos/errors.rb
214
216
  - lib/workos/profile.rb
215
217
  - lib/workos/sso.rb
216
218
  - lib/workos/types.rb
219
+ - lib/workos/types/connection_struct.rb
217
220
  - lib/workos/types/profile_struct.rb
218
221
  - lib/workos/types/provider_enum.rb
219
222
  - lib/workos/version.rb
@@ -228,6 +231,7 @@ files:
228
231
  - sorbet/rbi/todo.rbi
229
232
  - spec/lib/workos/audit_trail_spec.rb
230
233
  - spec/lib/workos/base_spec.rb
234
+ - spec/lib/workos/directory_sync_spec.rb
231
235
  - spec/lib/workos/sso_spec.rb
232
236
  - spec/spec_helper.rb
233
237
  - spec/support/fixtures/vcr_cassettes/audit_trail/create_event.yml
@@ -236,6 +240,18 @@ files:
236
240
  - spec/support/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_and_payload.yml
237
241
  - spec/support/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_different_payload.yml
238
242
  - spec/support/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml
243
+ - spec/support/fixtures/vcr_cassettes/directory_sync/get_group.yml
244
+ - spec/support/fixtures/vcr_cassettes/directory_sync/get_group_with_invalid_id.yml
245
+ - spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml
246
+ - spec/support/fixtures/vcr_cassettes/directory_sync/get_user_with_invalid_id.yml
247
+ - spec/support/fixtures/vcr_cassettes/directory_sync/list_directories.yml
248
+ - spec/support/fixtures/vcr_cassettes/directory_sync/list_directories_with_domain_param.yml
249
+ - spec/support/fixtures/vcr_cassettes/directory_sync/list_groups.yml
250
+ - spec/support/fixtures/vcr_cassettes/directory_sync/list_groups_with_directory_param.yml
251
+ - spec/support/fixtures/vcr_cassettes/directory_sync/list_users.yml
252
+ - spec/support/fixtures/vcr_cassettes/directory_sync/list_users_with_directory_param.yml
253
+ - spec/support/fixtures/vcr_cassettes/sso/create_connection_with_invalid_source.yml
254
+ - spec/support/fixtures/vcr_cassettes/sso/create_connection_with_valid_source.yml
239
255
  - spec/support/profile.txt
240
256
  - workos.gemspec
241
257
  homepage: https://github.com/workos/workos-ruby
@@ -264,6 +280,7 @@ summary: API client for WorkOS
264
280
  test_files:
265
281
  - spec/lib/workos/audit_trail_spec.rb
266
282
  - spec/lib/workos/base_spec.rb
283
+ - spec/lib/workos/directory_sync_spec.rb
267
284
  - spec/lib/workos/sso_spec.rb
268
285
  - spec/spec_helper.rb
269
286
  - spec/support/fixtures/vcr_cassettes/audit_trail/create_event.yml
@@ -272,4 +289,16 @@ test_files:
272
289
  - spec/support/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_and_payload.yml
273
290
  - spec/support/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_different_payload.yml
274
291
  - spec/support/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml
292
+ - spec/support/fixtures/vcr_cassettes/directory_sync/get_group.yml
293
+ - spec/support/fixtures/vcr_cassettes/directory_sync/get_group_with_invalid_id.yml
294
+ - spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml
295
+ - spec/support/fixtures/vcr_cassettes/directory_sync/get_user_with_invalid_id.yml
296
+ - spec/support/fixtures/vcr_cassettes/directory_sync/list_directories.yml
297
+ - spec/support/fixtures/vcr_cassettes/directory_sync/list_directories_with_domain_param.yml
298
+ - spec/support/fixtures/vcr_cassettes/directory_sync/list_groups.yml
299
+ - spec/support/fixtures/vcr_cassettes/directory_sync/list_groups_with_directory_param.yml
300
+ - spec/support/fixtures/vcr_cassettes/directory_sync/list_users.yml
301
+ - spec/support/fixtures/vcr_cassettes/directory_sync/list_users_with_directory_param.yml
302
+ - spec/support/fixtures/vcr_cassettes/sso/create_connection_with_invalid_source.yml
303
+ - spec/support/fixtures/vcr_cassettes/sso/create_connection_with_valid_source.yml
275
304
  - spec/support/profile.txt