workos 4.2.0 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7010166c9732e20f33a78674e669c1f583fda9695ddbce0b998b666166cbb60b
4
- data.tar.gz: 642d0e92afe77f1aec7404fffdfec5af386d05807ee43c6bfa3201c11fe45cd7
3
+ metadata.gz: 6e9c735f7fc4cc9a411de3ae0a3587a65eafb86d5abea06deebda9af4557b7d5
4
+ data.tar.gz: 0527add6ca64c5be1d9c38a4e205af1974c0b6407e2a9eea2358b6cd9a9328df
5
5
  SHA512:
6
- metadata.gz: b65ccc5817fc14633a235b12e2f3c25be1b04b6f1c07d9b781fd5d131cad89d7528dd0ab6326f100d542425261de9d1a81d28e89c1e30158a7e2a05291cdb8dd
7
- data.tar.gz: 94b2b2d3e59882de00b1ff7c01d2a0c5284357d52fa4e8418f86eff9ea37b0c0d0ef2c197b88ad0497ca56b872f2ab3309a4598feab6a80aa6b1f55114bc57e4
6
+ metadata.gz: 0ee30e5ed0c50be86a2ec193f81b1eb8a9c5900fdac6b124b7a642b874e1e88244bba23df08c60673e9ee23c35f6713e17ccfb9d6f26e3413fb2e0f48696245d
7
+ data.tar.gz: 1f5cbc0d1f2a61945b3fd0a28feb56bc2dff908d14cb78ad737d2ca3af0197391aff26e763b64e9d0b6577c0c987ab122667b2a92ce61eb54f95114d99d73d73
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- workos (4.2.0)
4
+ workos (4.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -45,6 +45,19 @@ end
45
45
 
46
46
  For our SDKs WorkOS follows a Semantic Versioning ([SemVer](https://semver.org/)) process where all releases will have a version X.Y.Z (like 1.0.0) pattern wherein Z would be a bug fix (e.g., 1.0.1), Y would be a minor release (1.1.0) and X would be a major release (2.0.0). We permit any breaking changes to only be released in major versions and strongly recommend reading changelogs before making any major version upgrades.
47
47
 
48
+ ## Beta Releases
49
+
50
+ WorkOS has features in Beta that can be accessed via Beta releases. We would love for you to try these
51
+ and share feedback with us before these features reach general availability (GA). To install a Beta version,
52
+ please follow the [installation steps](#installation) above using the Beta release version.
53
+
54
+ > Note: there can be breaking changes between Beta versions. Therefore, we recommend pinning the package version to a
55
+ > specific version. This way you can install the same version each time without breaking changes unless you are
56
+ > intentionally looking for the latest Beta version.
57
+
58
+ We highly recommend keeping an eye on when the Beta feature you are interested in goes from Beta to stable so that you
59
+ can move to using the stable version.
60
+
48
61
  ## More Information
49
62
 
50
63
  * [Single Sign-On Guide](https://workos.com/docs/sso/guide)
data/lib/workos/events.rb CHANGED
@@ -15,7 +15,7 @@ module WorkOS
15
15
  #
16
16
  # @param [Hash] options An options hash
17
17
  # @option options [String] event The type of event
18
- # retrieved.
18
+ # @option options [String] organization_id Limit scope of events to an organization
19
19
  # @option options [String] limit Maximum number of records to return.
20
20
  # @option options [String] after Pagination cursor to receive records
21
21
  # after a provided Event ID.
@@ -510,14 +510,17 @@ module WorkOS
510
510
  # @param [String] session_id The session ID can be found in the `sid`
511
511
  # claim of the access token
512
512
  def revoke_session(session_id:)
513
- execute_request(
513
+ response = execute_request(
514
514
  request: post_request(
515
515
  path: '/user_management/sessions/revoke',
516
516
  body: {
517
517
  session_id: session_id,
518
518
  },
519
+ auth: true,
519
520
  ),
520
521
  )
522
+
523
+ response.is_a? Net::HTTPSuccess
521
524
  end
522
525
 
523
526
  # Get the JWKS URL
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WorkOS
4
- VERSION = '4.2.0'
4
+ VERSION = '4.3.0'
5
5
  end
@@ -83,5 +83,27 @@ describe WorkOS::Events do
83
83
  end
84
84
  end
85
85
  end
86
+
87
+ context 'with the organization_id option' do
88
+ it 'forms the proper request to the API' do
89
+ request_args = [
90
+ '/events?organization_id=org_1234',
91
+ 'Content-Type' => 'application/json'
92
+ ]
93
+
94
+ expected_request = Net::HTTP::Get.new(*request_args)
95
+
96
+ expect(Net::HTTP::Get).to receive(:new).with(*request_args).
97
+ and_return(expected_request)
98
+
99
+ VCR.use_cassette 'events/list_events_with_organization_id' do
100
+ events = described_class.list_events(
101
+ organization_id: 'org_1234',
102
+ )
103
+
104
+ expect(events.data.size).to eq(1)
105
+ end
106
+ end
107
+ end
86
108
  end
87
109
  end
@@ -1145,4 +1145,33 @@ describe WorkOS::UserManagement do
1145
1145
  end
1146
1146
  end
1147
1147
  end
1148
+
1149
+ describe '.revoke_session' do
1150
+ context 'with valid payload' do
1151
+ it 'revokes session' do
1152
+ VCR.use_cassette 'user_management/revoke_session/valid' do
1153
+ result = described_class.revoke_session(
1154
+ session_id: 'session_01HRX85ATNADY1GQ053AHRFFN6',
1155
+ )
1156
+
1157
+ expect(result).to be true
1158
+ end
1159
+ end
1160
+ end
1161
+
1162
+ context 'with a non-existant session' do
1163
+ it 'returns an error' do
1164
+ VCR.use_cassette 'user_management/revoke_session/not_found' do
1165
+ expect do
1166
+ described_class.revoke_session(
1167
+ session_id: 'session_01H5JQDV7R7ATEYZDEG0W5PRYS',
1168
+ )
1169
+ end.to raise_error(
1170
+ WorkOS::APIError,
1171
+ /Session not found/,
1172
+ )
1173
+ end
1174
+ end
1175
+ end
1176
+ end
1148
1177
  end
@@ -0,0 +1,80 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.workos.com/events?organization_id=org_1234
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.2; arm64-darwin21; v2.3.0
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Thu, 14 Jul 2022 16:46:23 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - '616'
31
+ Connection:
32
+ - keep-alive
33
+ Access-Control-Allow-Credentials:
34
+ - 'true'
35
+ Content-Security-Policy:
36
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
37
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
38
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
39
+ Etag:
40
+ - W/"680-NPvBik348v8xg6EE7iZMYwD5UXw"
41
+ Expect-Ct:
42
+ - max-age=0
43
+ Referrer-Policy:
44
+ - no-referrer
45
+ Strict-Transport-Security:
46
+ - max-age=15552000; includeSubDomains
47
+ Vary:
48
+ - Origin, Accept-Encoding
49
+ Via:
50
+ - 1.1 spaces-router (b642bf20b975)
51
+ X-Content-Type-Options:
52
+ - nosniff
53
+ X-Dns-Prefetch-Control:
54
+ - 'off'
55
+ X-Download-Options:
56
+ - noopen
57
+ X-Frame-Options:
58
+ - SAMEORIGIN
59
+ X-Permitted-Cross-Domain-Policies:
60
+ - none
61
+ X-Request-Id:
62
+ - 51a82273-b413-cead-b968-c07ba4d6fd08
63
+ X-Xss-Protection:
64
+ - '0'
65
+ Cf-Cache-Status:
66
+ - DYNAMIC
67
+ Report-To:
68
+ - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=OS7ELJ3A8tkzMafvaIThD%2B5JlYmul1puZlAXTxEKYBLlq%2B6DCtqDqAi4dtr4yRP3khNmg6MwPiuLqtdOXRmPOtag9Ti%2FGK8ra%2BJOlpwkFjD965CNBfzao4EJtExDkbS3"}],"group":"cf-nel","max_age":604800}'
69
+ Nel:
70
+ - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
71
+ Server:
72
+ - cloudflare
73
+ Cf-Ray:
74
+ - 72abbbf2b93e8ca5-EWR
75
+ body:
76
+ encoding: ASCII-8BIT
77
+ string: '{"object":"list","data":[{"object":"event","id":"event_01FK3HFFGMC2WF32RR8SKWC8KA","event":"dsync.user.created","created_at":"2021-10-28T13:29:54.451Z","data":{"email":"foo@foocorp.com"}}], "list_metadata":{"after":null}}'
78
+ http_version:
79
+ recorded_at: Thu, 14 Jul 2022 16:46:23 GMT
80
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,80 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.workos.com/user_management/sessions/revoke
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"session_id":"session_01H5JQDV7R7ATEYZDEG0W5PRYS"}'
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.1.4; arm64-darwin22; v4.2.0
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 404
23
+ message: Not Found
24
+ headers:
25
+ Date:
26
+ - Thu, 11 Apr 2024 22:36:42 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ Cf-Ray:
34
+ - 872e74fd9ed6db9e-LAX
35
+ Cf-Cache-Status:
36
+ - DYNAMIC
37
+ Etag:
38
+ - W/"91-9u3slgvENRDVFp/62vKalhPzVuw"
39
+ Strict-Transport-Security:
40
+ - max-age=15552000; includeSubDomains
41
+ Vary:
42
+ - Origin, Accept-Encoding
43
+ Access-Control-Allow-Credentials:
44
+ - 'true'
45
+ Content-Security-Policy:
46
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
47
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
48
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
49
+ Expect-Ct:
50
+ - max-age=0
51
+ Referrer-Policy:
52
+ - no-referrer
53
+ X-Content-Type-Options:
54
+ - nosniff
55
+ X-Dns-Prefetch-Control:
56
+ - 'off'
57
+ X-Download-Options:
58
+ - noopen
59
+ X-Frame-Options:
60
+ - SAMEORIGIN
61
+ X-Permitted-Cross-Domain-Policies:
62
+ - none
63
+ X-Request-Id:
64
+ - bc0771a4-8d66-4b34-809c-d3d8976af390
65
+ X-Xss-Protection:
66
+ - '0'
67
+ Set-Cookie:
68
+ - __cf_bm=iJMFbMBT_gDvh2ZbVYwAWHii9wrMPSJJeFQ3sXKSNNw-1712875002-1.0.1.1-d0033NtW0ShwCrgulDZg60Nw0yfEROthaCZQWVIAnWbbmaoa5HDqSkl4DsECxoAaZNdoLWqOxi9YXtZx9FqVSA;
69
+ path=/; expires=Thu, 11-Apr-24 23:06:42 GMT; domain=.workos.com; HttpOnly;
70
+ Secure; SameSite=None
71
+ - __cfruid=c2a61e4869ba7669d8dd1d11a8e59bba189e21ba-1712875002; path=/; domain=.workos.com;
72
+ HttpOnly; Secure; SameSite=None
73
+ Server:
74
+ - cloudflare
75
+ body:
76
+ encoding: ASCII-8BIT
77
+ string: '{"message":"Session not found: ''session_01H5JQDV7R7ATEYZDEG0W5PRYS''.","code":"entity_not_found","entity_id":"session_01H5JQDV7R7ATEYZDEG0W5PRYS"}'
78
+ http_version:
79
+ recorded_at: Thu, 11 Apr 2024 22:36:42 GMT
80
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,76 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.workos.com/user_management/sessions/revoke
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"session_id":"session_01HRX85ATNADY1GQ053AHRFFN6"}'
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.1.4; arm64-darwin22; v4.2.0
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Thu, 11 Apr 2024 22:36:42 GMT
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Cf-Ray:
32
+ - 872e74fc2ee3092d-LAX
33
+ Cf-Cache-Status:
34
+ - DYNAMIC
35
+ Strict-Transport-Security:
36
+ - max-age=15552000; includeSubDomains
37
+ Vary:
38
+ - Origin, Accept-Encoding
39
+ Access-Control-Allow-Credentials:
40
+ - 'true'
41
+ Content-Security-Policy:
42
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
43
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
44
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
45
+ Expect-Ct:
46
+ - max-age=0
47
+ Referrer-Policy:
48
+ - no-referrer
49
+ X-Content-Type-Options:
50
+ - nosniff
51
+ X-Dns-Prefetch-Control:
52
+ - 'off'
53
+ X-Download-Options:
54
+ - noopen
55
+ X-Frame-Options:
56
+ - SAMEORIGIN
57
+ X-Permitted-Cross-Domain-Policies:
58
+ - none
59
+ X-Request-Id:
60
+ - 1b04e560-4438-40ba-97d2-05ae571aeedf
61
+ X-Xss-Protection:
62
+ - '0'
63
+ Set-Cookie:
64
+ - __cf_bm=lXssAzjuk1ajbWnDLtD_SUYIufESNBd9WVxCY8MCxJU-1712875002-1.0.1.1-oBbEhifco.kAMIrc30VrsrzW8tP4OpouniBD3jTd.5UowyS_IWs6ah59yKeFO9X6IqMLjlJt6n5O9lTpN0.2fw;
65
+ path=/; expires=Thu, 11-Apr-24 23:06:42 GMT; domain=.workos.com; HttpOnly;
66
+ Secure; SameSite=None
67
+ - __cfruid=c2a61e4869ba7669d8dd1d11a8e59bba189e21ba-1712875002; path=/; domain=.workos.com;
68
+ HttpOnly; Secure; SameSite=None
69
+ Server:
70
+ - cloudflare
71
+ body:
72
+ encoding: UTF-8
73
+ string: ''
74
+ http_version:
75
+ recorded_at: Thu, 11 Apr 2024 22:36:42 GMT
76
+ 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: 4.2.0
4
+ version: 4.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: 2024-04-11 00:00:00.000000000 Z
11
+ date: 2024-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -201,6 +201,7 @@ files:
201
201
  - spec/support/fixtures/vcr_cassettes/events/list_events_with_after.yml
202
202
  - spec/support/fixtures/vcr_cassettes/events/list_events_with_event.yml
203
203
  - spec/support/fixtures/vcr_cassettes/events/list_events_with_no_options.yml
204
+ - spec/support/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml
204
205
  - spec/support/fixtures/vcr_cassettes/events/list_events_with_range.yml
205
206
  - spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_generic_valid.yml
206
207
  - spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_sms_valid.yml
@@ -292,6 +293,8 @@ files:
292
293
  - spec/support/fixtures/vcr_cassettes/user_management/reset_password/valid.yml
293
294
  - spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/invalid.yml
294
295
  - spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml
296
+ - spec/support/fixtures/vcr_cassettes/user_management/revoke_session/not_found.yml
297
+ - spec/support/fixtures/vcr_cassettes/user_management/revoke_session/valid.yml
295
298
  - spec/support/fixtures/vcr_cassettes/user_management/send_invitation/invalid.yml
296
299
  - spec/support/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml
297
300
  - spec/support/fixtures/vcr_cassettes/user_management/send_magic_auth_code/valid.yml
@@ -389,6 +392,7 @@ test_files:
389
392
  - spec/support/fixtures/vcr_cassettes/events/list_events_with_after.yml
390
393
  - spec/support/fixtures/vcr_cassettes/events/list_events_with_event.yml
391
394
  - spec/support/fixtures/vcr_cassettes/events/list_events_with_no_options.yml
395
+ - spec/support/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml
392
396
  - spec/support/fixtures/vcr_cassettes/events/list_events_with_range.yml
393
397
  - spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_generic_valid.yml
394
398
  - spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_sms_valid.yml
@@ -480,6 +484,8 @@ test_files:
480
484
  - spec/support/fixtures/vcr_cassettes/user_management/reset_password/valid.yml
481
485
  - spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/invalid.yml
482
486
  - spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml
487
+ - spec/support/fixtures/vcr_cassettes/user_management/revoke_session/not_found.yml
488
+ - spec/support/fixtures/vcr_cassettes/user_management/revoke_session/valid.yml
483
489
  - spec/support/fixtures/vcr_cassettes/user_management/send_invitation/invalid.yml
484
490
  - spec/support/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml
485
491
  - spec/support/fixtures/vcr_cassettes/user_management/send_magic_auth_code/valid.yml