workos 0.11.0 → 1.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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/.semaphore/semaphore.yml +2 -2
  4. data/Gemfile.lock +2 -2
  5. data/LICENSE +1 -1
  6. data/README.md +13 -230
  7. data/lib/workos.rb +2 -0
  8. data/lib/workos/client.rb +21 -3
  9. data/lib/workos/connection.rb +5 -1
  10. data/lib/workos/directory_user.rb +4 -1
  11. data/lib/workos/organizations.rb +171 -0
  12. data/lib/workos/passwordless.rb +4 -0
  13. data/lib/workos/portal.rb +0 -80
  14. data/lib/workos/profile.rb +8 -10
  15. data/lib/workos/profile_and_token.rb +28 -0
  16. data/lib/workos/sso.rb +25 -100
  17. data/lib/workos/types/connection_struct.rb +1 -0
  18. data/lib/workos/types/directory_user_struct.rb +1 -0
  19. data/lib/workos/version.rb +1 -1
  20. data/spec/lib/workos/organizations_spec.rb +191 -0
  21. data/spec/lib/workos/portal_spec.rb +0 -113
  22. data/spec/lib/workos/sso_spec.rb +35 -115
  23. data/spec/support/fixtures/vcr_cassettes/organization/delete.yml +72 -0
  24. data/spec/support/fixtures/vcr_cassettes/organization/delete_invalid.yml +72 -0
  25. data/spec/support/fixtures/vcr_cassettes/organization/get.yml +73 -0
  26. data/spec/support/fixtures/vcr_cassettes/{sso/create_connection_with_invalid_source.yml → organization/get_invalid.yml} +26 -12
  27. data/spec/support/fixtures/vcr_cassettes/organization/update.yml +73 -0
  28. data/spec/support/fixtures/vcr_cassettes/organization/update_invalid.yml +73 -0
  29. data/spec/support/fixtures/vcr_cassettes/sso/profile.yml +74 -0
  30. data/workos.gemspec +1 -1
  31. metadata +23 -9
  32. data/spec/support/fixtures/vcr_cassettes/sso/create_connection_with_valid_source.yml +0 -63
@@ -0,0 +1,72 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: delete
5
+ uri: https://api.workos.com/organizations/org_01F4A8TD0B4N1Y9SJ8SH635HDB
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/3.0.1; x86_64-darwin19; v1.1.0
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 202
23
+ message: Accepted
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
+ Content-Security-Policy:
34
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
35
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
36
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
37
+ X-Dns-Prefetch-Control:
38
+ - 'off'
39
+ Expect-Ct:
40
+ - max-age=0
41
+ X-Frame-Options:
42
+ - SAMEORIGIN
43
+ Strict-Transport-Security:
44
+ - max-age=15552000; includeSubDomains
45
+ X-Download-Options:
46
+ - noopen
47
+ X-Content-Type-Options:
48
+ - nosniff
49
+ X-Permitted-Cross-Domain-Policies:
50
+ - none
51
+ Referrer-Policy:
52
+ - no-referrer
53
+ X-Xss-Protection:
54
+ - '0'
55
+ X-Request-Id:
56
+ -
57
+ Content-Type:
58
+ - text/plain; charset=utf-8
59
+ Content-Length:
60
+ - '8'
61
+ Etag:
62
+ - W/"8-YaBXLEiT7zQxEyDYTILfiL6oPhE"
63
+ Date:
64
+ - Mon, 24 May 2021 21:07:34 GMT
65
+ Via:
66
+ - 1.1 vegur
67
+ body:
68
+ encoding: UTF-8
69
+ string: Accepted
70
+ http_version:
71
+ recorded_at: Mon, 24 May 2021 21:07:34 GMT
72
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,72 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: delete
5
+ uri: https://api.workos.com/organizations/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/3.0.1; x86_64-darwin19; v1.1.0
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
+ Content-Security-Policy:
34
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
35
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
36
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
37
+ X-Dns-Prefetch-Control:
38
+ - 'off'
39
+ Expect-Ct:
40
+ - max-age=0
41
+ X-Frame-Options:
42
+ - SAMEORIGIN
43
+ Strict-Transport-Security:
44
+ - max-age=15552000; includeSubDomains
45
+ X-Download-Options:
46
+ - noopen
47
+ X-Content-Type-Options:
48
+ - nosniff
49
+ X-Permitted-Cross-Domain-Policies:
50
+ - none
51
+ Referrer-Policy:
52
+ - no-referrer
53
+ X-Xss-Protection:
54
+ - '0'
55
+ X-Request-Id:
56
+ -
57
+ Content-Type:
58
+ - application/json; charset=utf-8
59
+ Content-Length:
60
+ - '23'
61
+ Etag:
62
+ - W/"17-SuRA/yvUWUo8rK6x7dKURLeBo+0"
63
+ Date:
64
+ - Mon, 24 May 2021 21:07:34 GMT
65
+ Via:
66
+ - 1.1 vegur
67
+ body:
68
+ encoding: UTF-8
69
+ string: '{"message":"Not Found"}'
70
+ http_version:
71
+ recorded_at: Mon, 24 May 2021 21:07:34 GMT
72
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,73 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.workos.com/organizations/org_01EZDF20TZEJXKPSX2BJRN6TV6
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/3.0.1; x86_64-darwin19; v0.11.1
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
+ Content-Security-Policy:
34
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
35
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
36
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
37
+ X-Dns-Prefetch-Control:
38
+ - 'off'
39
+ Expect-Ct:
40
+ - max-age=0
41
+ X-Frame-Options:
42
+ - SAMEORIGIN
43
+ Strict-Transport-Security:
44
+ - max-age=15552000; includeSubDomains
45
+ X-Download-Options:
46
+ - noopen
47
+ X-Content-Type-Options:
48
+ - nosniff
49
+ X-Permitted-Cross-Domain-Policies:
50
+ - none
51
+ Referrer-Policy:
52
+ - no-referrer
53
+ X-Xss-Protection:
54
+ - '0'
55
+ X-Request-Id:
56
+ - 06e7c714-c492-4f4e-8fbf-41b0367531ff
57
+ Content-Type:
58
+ - application/json; charset=utf-8
59
+ Content-Length:
60
+ - '312'
61
+ Etag:
62
+ - W/"138-g/hQHq1azVQbQRpF7ECy/AbaJ8E"
63
+ Date:
64
+ - Mon, 10 May 2021 17:21:42 GMT
65
+ Via:
66
+ - 1.1 vegur
67
+ body:
68
+ encoding: UTF-8
69
+ string: '{"object":"organization","id":"org_01EZDF20TZEJXKPSX2BJRN6TV6","name":"Foo
70
+ Corp","domains":[{"object":"organization_domain","id":"org_domain_01EZDF20V4VAME34TF0B3DPK49","domain":"foo-corp.com"},{"object":"organization_domain","id":"org_domain_01F2PYX1XMS5ZQW1E8FZ57GPQN","domain":"blairworkos.onmicrosoft.com"}]}'
71
+ http_version:
72
+ recorded_at: Mon, 10 May 2021 17:21:42 GMT
73
+ recorded_with: VCR 5.0.0
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  http_interactions:
3
3
  - request:
4
- method: post
5
- uri: https://api.workos.com/connections
4
+ method: get
5
+ uri: https://api.workos.com/organizations/invalid
6
6
  body:
7
- encoding: UTF-8
8
- string: '{"source":"invalid"}'
7
+ encoding: US-ASCII
8
+ string: ''
9
9
  headers:
10
10
  Content-Type:
11
11
  - application/json
@@ -14,7 +14,7 @@ http_interactions:
14
14
  Accept:
15
15
  - "*/*"
16
16
  User-Agent:
17
- - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.2.2
17
+ - WorkOS; ruby/3.0.1; x86_64-darwin19; v0.11.1
18
18
  Authorization:
19
19
  - Bearer <API_KEY>
20
20
  response:
@@ -22,12 +22,22 @@ http_interactions:
22
22
  code: 404
23
23
  message: Not Found
24
24
  headers:
25
+ Server:
26
+ - Cowboy
27
+ Connection:
28
+ - keep-alive
25
29
  Vary:
26
30
  - Origin, Accept-Encoding
27
31
  Access-Control-Allow-Credentials:
28
32
  - 'true'
33
+ Content-Security-Policy:
34
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
35
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
36
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
29
37
  X-Dns-Prefetch-Control:
30
38
  - 'off'
39
+ Expect-Ct:
40
+ - max-age=0
31
41
  X-Frame-Options:
32
42
  - SAMEORIGIN
33
43
  Strict-Transport-Security:
@@ -36,10 +46,14 @@ http_interactions:
36
46
  - noopen
37
47
  X-Content-Type-Options:
38
48
  - nosniff
49
+ X-Permitted-Cross-Domain-Policies:
50
+ - none
51
+ Referrer-Policy:
52
+ - no-referrer
39
53
  X-Xss-Protection:
40
- - 1; mode=block
54
+ - '0'
41
55
  X-Request-Id:
42
- - ''
56
+ -
43
57
  Content-Type:
44
58
  - application/json; charset=utf-8
45
59
  Content-Length:
@@ -47,12 +61,12 @@ http_interactions:
47
61
  Etag:
48
62
  - W/"17-SuRA/yvUWUo8rK6x7dKURLeBo+0"
49
63
  Date:
50
- - Fri, 24 Apr 2020 02:16:27 GMT
51
- Connection:
52
- - keep-alive
64
+ - Mon, 10 May 2021 17:21:43 GMT
65
+ Via:
66
+ - 1.1 vegur
53
67
  body:
54
68
  encoding: UTF-8
55
69
  string: '{"message":"Not Found"}'
56
- http_version:
57
- recorded_at: Fri, 24 Apr 2020 02:16:27 GMT
70
+ http_version:
71
+ recorded_at: Mon, 10 May 2021 17:21:43 GMT
58
72
  recorded_with: VCR 5.0.0
@@ -0,0 +1,73 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: https://api.workos.com/organizations/org_01F29YJ068E52HGEB8ZQGC9MJG
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"domains":["example.me"],"name":"Test Organization"}'
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/3.0.1; x86_64-darwin19; v0.11.1
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
+ Content-Security-Policy:
34
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
35
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
36
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
37
+ X-Dns-Prefetch-Control:
38
+ - 'off'
39
+ Expect-Ct:
40
+ - max-age=0
41
+ X-Frame-Options:
42
+ - SAMEORIGIN
43
+ Strict-Transport-Security:
44
+ - max-age=15552000; includeSubDomains
45
+ X-Download-Options:
46
+ - noopen
47
+ X-Content-Type-Options:
48
+ - nosniff
49
+ X-Permitted-Cross-Domain-Policies:
50
+ - none
51
+ Referrer-Policy:
52
+ - no-referrer
53
+ X-Xss-Protection:
54
+ - '0'
55
+ X-Request-Id:
56
+ - 9acc2cae-063a-485f-8a36-df21816b66bf
57
+ Content-Type:
58
+ - application/json; charset=utf-8
59
+ Content-Length:
60
+ - '202'
61
+ Etag:
62
+ - W/"ca-cUBZaGl5MJlERA8SKJ9+GrSHPM0"
63
+ Date:
64
+ - Wed, 05 May 2021 22:14:09 GMT
65
+ Via:
66
+ - 1.1 vegur
67
+ body:
68
+ encoding: UTF-8
69
+ string: '{"object":"organization","id":"org_01F29YJ068E52HGEB8ZQGC9MJG","name":"Test
70
+ Organization","domains":[{"object":"organization_domain","id":"org_domain_01F4Z9GXPP2BEH019613C72E4Y","domain":"example.me"}]}'
71
+ http_version:
72
+ recorded_at: Wed, 05 May 2021 22:14:09 GMT
73
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,73 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: https://api.workos.com/organizations/org_01F29YJ068E52HGEB8ZQGC9MJG
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"domains":["example.com"],"name":"Test Organization 2"}'
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/3.0.1; x86_64-darwin19; v0.11.1
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
+ Content-Security-Policy:
34
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
35
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
36
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
37
+ X-Dns-Prefetch-Control:
38
+ - 'off'
39
+ Expect-Ct:
40
+ - max-age=0
41
+ X-Frame-Options:
42
+ - SAMEORIGIN
43
+ Strict-Transport-Security:
44
+ - max-age=15552000; includeSubDomains
45
+ X-Download-Options:
46
+ - noopen
47
+ X-Content-Type-Options:
48
+ - nosniff
49
+ X-Permitted-Cross-Domain-Policies:
50
+ - none
51
+ Referrer-Policy:
52
+ - no-referrer
53
+ X-Xss-Protection:
54
+ - '0'
55
+ X-Request-Id:
56
+ - 6ba2cbf9-76e3-4a6a-8ebe-d25edb366ed0
57
+ Content-Type:
58
+ - application/json; charset=utf-8
59
+ Content-Length:
60
+ - '205'
61
+ Etag:
62
+ - W/"cd-mlRMlyyz/LtzInRhAghs1B+BT4s"
63
+ Date:
64
+ - Wed, 05 May 2021 22:14:10 GMT
65
+ Via:
66
+ - 1.1 vegur
67
+ body:
68
+ encoding: UTF-8
69
+ string: '{"object":"organization","id":"org_01F29YJ068E52HGEB8ZQGC9MJG","name":"Test
70
+ Organization 2","domains":[{"object":"organization_domain","id":"org_domain_01F4Z9GY3089GV4SENXWZ9RBX1","domain":"example.com"}]}'
71
+ http_version:
72
+ recorded_at: Wed, 05 May 2021 22:14:10 GMT
73
+ recorded_with: VCR 5.0.0