workos 5.23.0 → 5.25.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 840052dd55f646d6ae09f2c0e0a4c91a6686d0f4fcb3b9da66b13fa3e4f835eb
4
- data.tar.gz: cb5807f1a8b0b1fe28f21e5c8cfa84fd3c75e68bf7e743f9f95a5ac1787efd55
3
+ metadata.gz: 86d12c42e6f45139b343d1f519807176eca7a9ac77dbd2d3de0287a9406c50c4
4
+ data.tar.gz: 3addd0959c8b7b8c2caae994b694bfda1eabe41499f540d76e71865e9ae9b35f
5
5
  SHA512:
6
- metadata.gz: fccea79a69343e4deeb1f25e076dfc19febbd5a540bd0e9e55ad6f4859ef3332a300e1f023e74c8bad7c16fe1c2b7266eb8bc5dfd600ddb0d40e036ff48d739f
7
- data.tar.gz: b49a2c19e2360811203f8b07806a198bd7b9307dc654b72fb266311ff7fbf881b0cb142159a67144c25057d340e3d4fdd11bba1fc42e509bf05fcf427dcd9a48
6
+ metadata.gz: e286d3aa2d010bbab396d9267795c9eee35cac00f7d3c4c95fb35d70b08df133d32b0081a5f83a1ecf1fe28d663f660947b27756b7225a22ed7b345d4e5d5898
7
+ data.tar.gz: 9571637a3bda0ce330a54ea0a8a09076905fdece0b2e85565a3dd9510d5c3f27d52021cca7a51372d7bc0c3de00a7aeaacb521e0522b9a849df8081d5c316828
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- workos (5.23.0)
4
+ workos (5.25.0)
5
5
  encryptor (~> 3.0)
6
6
  jwt (~> 2.8)
7
7
 
@@ -32,7 +32,6 @@ GEM
32
32
  rainbow (3.1.1)
33
33
  regexp_parser (2.10.0)
34
34
  rexml (3.4.1)
35
- strscan
36
35
  rspec (3.9.0)
37
36
  rspec-core (~> 3.9.0)
38
37
  rspec-expectations (~> 3.9.0)
@@ -59,11 +58,11 @@ GEM
59
58
  rubocop-ast (1.37.0)
60
59
  parser (>= 3.3.1.0)
61
60
  ruby-progressbar (1.13.0)
62
- strscan (3.1.0)
63
61
  unicode-display_width (3.1.4)
64
62
  unicode-emoji (~> 4.0, >= 4.0.4)
65
63
  unicode-emoji (4.0.4)
66
- vcr (5.0.0)
64
+ vcr (6.3.1)
65
+ base64
67
66
  webmock (3.23.0)
68
67
  addressable (>= 2.8.0)
69
68
  crack (>= 0.3.2)
@@ -76,7 +75,7 @@ DEPENDENCIES
76
75
  bundler (>= 2.0.1)
77
76
  rspec (~> 3.9.0)
78
77
  rubocop (~> 1.71)
79
- vcr (~> 5.0.0)
78
+ vcr (~> 6.0)
80
79
  webmock
81
80
  workos!
82
81
 
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WorkOS
4
+ # The FeatureFlag class provides a lightweight wrapper around
5
+ # a WorkOS Feature Flag resource. This class is not meant to be instantiated
6
+ # in user space, and is instantiated internally but exposed.
7
+ class FeatureFlag
8
+ include HashProvider
9
+
10
+ attr_accessor :id, :name, :slug, :description, :created_at, :updated_at
11
+
12
+ def initialize(json)
13
+ hash = JSON.parse(json, symbolize_names: true)
14
+
15
+ @id = hash[:id]
16
+ @name = hash[:name]
17
+ @slug = hash[:slug]
18
+ @description = hash[:description]
19
+ @created_at = hash[:created_at]
20
+ @updated_at = hash[:updated_at]
21
+ end
22
+
23
+ def to_json(*)
24
+ {
25
+ id: id,
26
+ name: name,
27
+ slug: slug,
28
+ description: description,
29
+ created_at: created_at,
30
+ updated_at: updated_at,
31
+ }
32
+ end
33
+ end
34
+ end
@@ -224,6 +224,46 @@ module WorkOS
224
224
  )
225
225
  end
226
226
 
227
+ # Retrieve a list of feature flags for the given organization.
228
+ #
229
+ # @param [String] organization_id The ID of the organization to fetch feature flags for.
230
+ # @param [Hash] options
231
+ # @option options [String] before A pagination argument used to request
232
+ # feature flags before the provided FeatureFlag ID.
233
+ # @option options [String] after A pagination argument used to request
234
+ # feature flags after the provided FeatureFlag ID.
235
+ # @option options [Integer] limit A pagination argument used to limit the number
236
+ # of listed FeatureFlags that are returned.
237
+ # @option options [String] order The order in which to paginate records
238
+ #
239
+ # @example
240
+ # WorkOS::Organizations.list_organization_feature_flags(organization_id: 'org_01EHZNVPK3SFK441A1RGBFSHRT')
241
+ # => #<WorkOS::Types::ListStruct data=[#<WorkOS::FeatureFlag id="flag_123" slug="new-feature"
242
+ # enabled=true ...>] ...>
243
+ #
244
+ # @return [WorkOS::Types::ListStruct] - Collection of FeatureFlag objects
245
+ def list_organization_feature_flags(organization_id:, options: {})
246
+ options[:order] ||= 'desc'
247
+ response = execute_request(
248
+ request: get_request(
249
+ path: "/organizations/#{organization_id}/feature-flags",
250
+ auth: true,
251
+ params: options,
252
+ ),
253
+ )
254
+
255
+ parsed_response = JSON.parse(response.body)
256
+
257
+ feature_flags = parsed_response['data'].map do |feature_flag|
258
+ WorkOS::FeatureFlag.new(feature_flag.to_json)
259
+ end
260
+
261
+ WorkOS::Types::ListStruct.new(
262
+ data: feature_flags,
263
+ list_metadata: parsed_response['list_metadata']&.transform_keys(&:to_sym),
264
+ )
265
+ end
266
+
227
267
  private
228
268
 
229
269
  def check_and_raise_organization_error(response:)
@@ -69,6 +69,8 @@ module WorkOS
69
69
  # that is preserved and available to the client in the response.
70
70
  # @param [String] login_hint Can be used to pre-fill the username/email address
71
71
  # field of the IdP sign-in page for the user, if you know their username ahead of time.
72
+ # @param [String] screen_hint Specify which AuthKit screen users should land on upon redirection
73
+ # (Only applicable when provider is 'authkit').
72
74
  # @param [String] domain_hint Can be used to pre-fill the domain field when
73
75
  # initiating authentication with Microsoft OAuth, or with a GoogleSAML connection type.
74
76
  # @param [Array<String>] provider_scopes An array of additional OAuth scopes to request from the provider.
@@ -94,6 +96,7 @@ module WorkOS
94
96
  client_id: nil,
95
97
  domain_hint: nil,
96
98
  login_hint: nil,
99
+ screen_hint: nil,
97
100
  provider: nil,
98
101
  connection_id: nil,
99
102
  organization_id: nil,
@@ -114,6 +117,7 @@ module WorkOS
114
117
  state: state,
115
118
  domain_hint: domain_hint,
116
119
  login_hint: login_hint,
120
+ screen_hint: screen_hint,
117
121
  provider: provider,
118
122
  connection_id: connection_id,
119
123
  organization_id: organization_id,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WorkOS
4
- VERSION = '5.23.0'
4
+ VERSION = '5.25.0'
5
5
  end
data/lib/workos.rb CHANGED
@@ -59,6 +59,7 @@ module WorkOS
59
59
  autoload :Event, 'workos/event'
60
60
  autoload :Events, 'workos/events'
61
61
  autoload :Factor, 'workos/factor'
62
+ autoload :FeatureFlag, 'workos/feature_flag'
62
63
  autoload :Impersonator, 'workos/impersonator'
63
64
  autoload :Invitation, 'workos/invitation'
64
65
  autoload :MagicAuth, 'workos/magic_auth'
@@ -450,4 +450,120 @@ describe WorkOS::Organizations do
450
450
  end
451
451
  end
452
452
  end
453
+
454
+ describe '.list_organization_feature_flags' do
455
+ context 'with no options' do
456
+ it 'returns feature flags for organization' do
457
+ expected_metadata = {
458
+ after: nil,
459
+ before: nil,
460
+ }
461
+
462
+ VCR.use_cassette 'organization/list_organization_feature_flags' do
463
+ feature_flags = described_class.list_organization_feature_flags(
464
+ organization_id: 'org_01HX7Q7R12H1JMAKN75SH2G529',
465
+ )
466
+
467
+ expect(feature_flags.data.size).to eq(2)
468
+ expect(feature_flags.list_metadata).to eq(expected_metadata)
469
+ end
470
+ end
471
+ end
472
+
473
+ context 'with the before option' do
474
+ it 'forms the proper request to the API' do
475
+ request_args = [
476
+ '/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?before=before-id&'\
477
+ 'order=desc',
478
+ 'Content-Type' => 'application/json'
479
+ ]
480
+
481
+ expected_request = Net::HTTP::Get.new(*request_args)
482
+
483
+ expect(Net::HTTP::Get).to receive(:new).with(*request_args).
484
+ and_return(expected_request)
485
+
486
+ VCR.use_cassette 'organization/list_organization_feature_flags', match_requests_on: [:path] do
487
+ feature_flags = described_class.list_organization_feature_flags(
488
+ organization_id: 'org_01HX7Q7R12H1JMAKN75SH2G529',
489
+ options: { before: 'before-id' },
490
+ )
491
+
492
+ expect(feature_flags.data.size).to eq(2)
493
+ end
494
+ end
495
+ end
496
+
497
+ context 'with the after option' do
498
+ it 'forms the proper request to the API' do
499
+ request_args = [
500
+ '/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?after=after-id&'\
501
+ 'order=desc',
502
+ 'Content-Type' => 'application/json'
503
+ ]
504
+
505
+ expected_request = Net::HTTP::Get.new(*request_args)
506
+
507
+ expect(Net::HTTP::Get).to receive(:new).with(*request_args).
508
+ and_return(expected_request)
509
+
510
+ VCR.use_cassette 'organization/list_organization_feature_flags', match_requests_on: [:path] do
511
+ feature_flags = described_class.list_organization_feature_flags(
512
+ organization_id: 'org_01HX7Q7R12H1JMAKN75SH2G529',
513
+ options: { after: 'after-id' },
514
+ )
515
+
516
+ expect(feature_flags.data.size).to eq(2)
517
+ end
518
+ end
519
+ end
520
+
521
+ context 'with the limit option' do
522
+ it 'forms the proper request to the API' do
523
+ request_args = [
524
+ '/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?limit=10&'\
525
+ 'order=desc',
526
+ 'Content-Type' => 'application/json'
527
+ ]
528
+
529
+ expected_request = Net::HTTP::Get.new(*request_args)
530
+
531
+ expect(Net::HTTP::Get).to receive(:new).with(*request_args).
532
+ and_return(expected_request)
533
+
534
+ VCR.use_cassette 'organization/list_organization_feature_flags', match_requests_on: [:path] do
535
+ feature_flags = described_class.list_organization_feature_flags(
536
+ organization_id: 'org_01HX7Q7R12H1JMAKN75SH2G529',
537
+ options: { limit: 10 },
538
+ )
539
+
540
+ expect(feature_flags.data.size).to eq(2)
541
+ end
542
+ end
543
+ end
544
+
545
+ context 'with multiple pagination options' do
546
+ it 'forms the proper request to the API' do
547
+ request_args = [
548
+ '/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?after=after-id&'\
549
+ 'limit=5&order=asc',
550
+ 'Content-Type' => 'application/json'
551
+ ]
552
+
553
+ expected_request = Net::HTTP::Get.new(*request_args)
554
+
555
+ expect(Net::HTTP::Get).to receive(:new).with(*request_args).
556
+ and_return(expected_request)
557
+
558
+ VCR.use_cassette 'organization/list_organization_feature_flags', match_requests_on: [:path] do
559
+ feature_flags = described_class.list_organization_feature_flags(
560
+ organization_id: 'org_01HX7Q7R12H1JMAKN75SH2G529',
561
+ options: { after: 'after-id', limit: 5, order: 'asc' },
562
+ )
563
+
564
+ expect(feature_flags.data.size).to eq(2)
565
+ end
566
+ end
567
+ end
568
+ end
453
569
  end
@@ -202,6 +202,41 @@ describe WorkOS::UserManagement do
202
202
  end
203
203
  end
204
204
 
205
+ context 'with a screen hint' do
206
+ let(:args) do
207
+ {
208
+ provider: 'authkit',
209
+ screen_hint: 'sign_up',
210
+ client_id: 'workos-proj-123',
211
+ redirect_uri: 'foo.com/auth/callback',
212
+ state: {
213
+ next_page: '/dashboard/edit',
214
+ }.to_s,
215
+ }
216
+ end
217
+ it 'returns a valid URL' do
218
+ authorization_url = described_class.authorization_url(**args)
219
+
220
+ expect(URI.parse(authorization_url)).to be_a URI
221
+ end
222
+
223
+ it 'returns the expected hostname' do
224
+ authorization_url = described_class.authorization_url(**args)
225
+
226
+ expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname)
227
+ end
228
+
229
+ it 'returns the expected query string' do
230
+ authorization_url = described_class.authorization_url(**args)
231
+
232
+ expect(URI.parse(authorization_url).query).to eq(
233
+ 'client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback' \
234
+ '&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F' \
235
+ 'edit%22%7D&screen_hint=sign_up&provider=authkit',
236
+ )
237
+ end
238
+ end
239
+
205
240
  context 'with neither connection_id, organization_id or provider' do
206
241
  let(:args) do
207
242
  {
@@ -0,0 +1,78 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.workos.com/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?order=desc
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.1.4; arm64-darwin24; v5.24.0
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Mon, 04 Aug 2025 18:37:04 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ Cf-Ray:
34
+ - 96a029f4191e2f57-LAX
35
+ Cf-Cache-Status:
36
+ - DYNAMIC
37
+ Etag:
38
+ - W/"1f7-g5rU0vT2OhGT9sAPsywR3YS8ePw"
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
+ - 9cd52998-5106-40cf-9080-82c07528c672
65
+ X-Xss-Protection:
66
+ - '0'
67
+ Set-Cookie:
68
+ - _cfuvid=_9dbE_0fDVZ45WXvgEp8frEFOIlVDyARPbMk3AffOcs-1754332624329-0.0.1.1-604800000;
69
+ path=/; domain=.workos.com; HttpOnly; Secure; SameSite=None
70
+ Server:
71
+ - cloudflare
72
+ body:
73
+ encoding: ASCII-8BIT
74
+ string: '{"object":"list","data":[{"object":"feature_flag","id":"flag_01K1V04FV94RNDSN5GKSZVQMYN","slug":"new-sidebar-layout","name":"New
75
+ Sidebar Layout","description":"","created_at":"2025-08-04T16:55:15.557Z","updated_at":"2025-08-04T16:55:15.557Z"},{"object":"feature_flag","id":"flag_01K1V02KNS6WHYXKG0DWB87THK","slug":"dark-mode-toggle","name":"Dark
76
+ Mode Toggle","description":"","created_at":"2025-08-04T16:54:13.942Z","updated_at":"2025-08-04T16:54:13.942Z"}],"list_metadata":{"before":null,"after":null}}'
77
+ recorded_at: Mon, 04 Aug 2025 18:37:04 GMT
78
+ recorded_with: VCR 6.3.1
data/workos.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency 'bundler', '>= 2.0.1'
28
28
  spec.add_development_dependency 'rspec', '~> 3.9.0'
29
29
  spec.add_development_dependency 'rubocop', '~> 1.71'
30
- spec.add_development_dependency 'vcr', '~> 5.0.0'
30
+ spec.add_development_dependency 'vcr', '~> 6.0'
31
31
  spec.add_development_dependency 'webmock'
32
32
 
33
33
  spec.required_ruby_version = '>= 3.1'
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: 5.23.0
4
+ version: 5.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - WorkOS
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-23 00:00:00.000000000 Z
11
+ date: 2025-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: encryptor
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 5.0.0
89
+ version: '6.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 5.0.0
96
+ version: '6.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: webmock
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -153,6 +153,7 @@ files:
153
153
  - lib/workos/event.rb
154
154
  - lib/workos/events.rb
155
155
  - lib/workos/factor.rb
156
+ - lib/workos/feature_flag.rb
156
157
  - lib/workos/hash_provider.rb
157
158
  - lib/workos/impersonator.rb
158
159
  - lib/workos/invitation.rb
@@ -274,6 +275,7 @@ files:
274
275
  - spec/support/fixtures/vcr_cassettes/organization/get.yml
275
276
  - spec/support/fixtures/vcr_cassettes/organization/get_invalid.yml
276
277
  - spec/support/fixtures/vcr_cassettes/organization/list.yml
278
+ - spec/support/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml
277
279
  - spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml
278
280
  - spec/support/fixtures/vcr_cassettes/organization/update.yml
279
281
  - spec/support/fixtures/vcr_cassettes/organization/update_with_external_id.yml
@@ -504,6 +506,7 @@ test_files:
504
506
  - spec/support/fixtures/vcr_cassettes/organization/get.yml
505
507
  - spec/support/fixtures/vcr_cassettes/organization/get_invalid.yml
506
508
  - spec/support/fixtures/vcr_cassettes/organization/list.yml
509
+ - spec/support/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml
507
510
  - spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml
508
511
  - spec/support/fixtures/vcr_cassettes/organization/update.yml
509
512
  - spec/support/fixtures/vcr_cassettes/organization/update_with_external_id.yml