workos 3.1.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.semaphore/semaphore.yml +1 -1
  3. data/Gemfile.lock +1 -1
  4. data/lib/workos/authentication_response.rb +11 -1
  5. data/lib/workos/directory_sync.rb +3 -0
  6. data/lib/workos/impersonator.rb +26 -0
  7. data/lib/workos/organization_membership.rb +4 -1
  8. data/lib/workos/organizations.rb +1 -0
  9. data/lib/workos/refresh_authentication_response.rb +27 -0
  10. data/lib/workos/sso.rb +1 -0
  11. data/lib/workos/types/organization_membership_struct.rb +2 -1
  12. data/lib/workos/user_management.rb +103 -0
  13. data/lib/workos/version.rb +1 -1
  14. data/lib/workos.rb +2 -0
  15. data/spec/lib/workos/directory_sync_spec.rb +30 -15
  16. data/spec/lib/workos/organizations_spec.rb +6 -3
  17. data/spec/lib/workos/sso_spec.rb +12 -6
  18. data/spec/lib/workos/user_management_spec.rb +72 -15
  19. data/spec/spec_helper.rb +6 -0
  20. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_after.yml +1 -1
  21. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_before.yml +1 -1
  22. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_domain.yml +1 -1
  23. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_limit.yml +1 -1
  24. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_no_options.yml +1 -1
  25. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_search.yml +1 -1
  26. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml +1 -1
  27. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml +1 -1
  28. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml +1 -1
  29. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_limit.yml +1 -1
  30. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_no_options.yml +1 -1
  31. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml +1 -1
  32. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_after.yml +1 -1
  33. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml +1 -1
  34. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml +1 -1
  35. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_group.yml +1 -1
  36. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_limit.yml +1 -1
  37. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_no_options.yml +72 -71
  38. data/spec/support/fixtures/vcr_cassettes/organization/list.yml +1 -1
  39. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_after.yml +1 -1
  40. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_before.yml +1 -1
  41. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_connection_type.yml +1 -1
  42. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_domain.yml +1 -1
  43. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_limit.yml +1 -1
  44. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_no_options.yml +1 -1
  45. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_organization_id.yml +1 -1
  46. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid.yml +1 -1
  47. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_impersonator.yml +80 -0
  48. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/valid.yml +1 -1
  49. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/valid.yml +1 -1
  50. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml +1 -1
  51. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml +1 -1
  52. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_code/invalid.yml +81 -0
  53. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml +81 -0
  54. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml +1 -1
  55. data/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml +1 -1
  56. data/spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml +1 -1
  57. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml +1 -1
  58. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml +1 -1
  59. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml +1 -1
  60. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml +1 -1
  61. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml +1 -1
  62. data/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml +2 -2
  63. data/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml +1 -1
  64. data/spec/support/fixtures/vcr_cassettes/user_management/list_users/no_options.yml +1 -1
  65. metadata +10 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ad84077c20052b97407464d2d226f58f15633fc075ad94da6072e60258ffb89
4
- data.tar.gz: 8d740970f9e7def49c1faeb4f3eddf7da2e8289a6ad8d7e6f1f9e2f730899a7e
3
+ metadata.gz: '0828780b58051c7e4da7d76717a9eb71209803a508c71ca287a99dabcb0cc55a'
4
+ data.tar.gz: 5da4147318e6c1f9947b50f69e8bf37dfbed7fd936deda7c46c9a072abfed99f
5
5
  SHA512:
6
- metadata.gz: cff690a42ec04e6ff9ebfe23564573165d0ac39764ed0c8f6b62abb7b19365b1e86d8fe86e19d405cc4529f9104d64f2c6526ec053d8d536037eff9088c1edfc
7
- data.tar.gz: 4afff676be0ba3eed8c6c5ce657d9fb6944a55eda0c165e027f34e9362f6ffd5a6cb17363b010682b702f5223e478687bdefa7cd3fa3440cd3d7677584d79a48
6
+ metadata.gz: '0916ae54fc3f1e30edf8f03dab9a75382062122a5b554aeefbaea26b39edc2e4d6415a9bdda25e53f19c5b82e6bb6e5e675c7c4ba1bc971a689346e6af997935'
7
+ data.tar.gz: 232a18c18b3c58181dd3f3a16c8c8f16a9f7aa7d1dc5ac088dbda986b9fd86347fe41def6a27d3d19ca7ff2867f03353daefa611c6df175ad5b9464539cadfff
@@ -4,7 +4,7 @@ name: Ruby
4
4
  agent:
5
5
  machine:
6
6
  type: e1-standard-2
7
- os_image: ubuntu1804
7
+ os_image: ubuntu2004
8
8
 
9
9
  blocks:
10
10
  - name: Run Sorbet 🍦
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- workos (3.1.0)
4
+ workos (4.1.0)
5
5
  sorbet-runtime (~> 0.5)
6
6
 
7
7
  GEM
@@ -8,19 +8,29 @@ module WorkOS
8
8
  include HashProvider
9
9
  extend T::Sig
10
10
 
11
- attr_accessor :user, :organization_id
11
+ attr_accessor :user, :organization_id, :impersonator, :access_token, :refresh_token
12
12
 
13
13
  sig { params(authentication_response_json: String).void }
14
14
  def initialize(authentication_response_json)
15
15
  json = JSON.parse(authentication_response_json, symbolize_names: true)
16
16
  @user = WorkOS::User.new(json[:user].to_json)
17
17
  @organization_id = T.let(json[:organization_id], T.nilable(String))
18
+ @impersonator =
19
+ if (impersonator_json = json[:impersonator])
20
+ Impersonator.new(email: impersonator_json[:email],
21
+ reason: impersonator_json[:reason],)
22
+ end
23
+ @access_token = T.let(json[:access_token], String)
24
+ @refresh_token = T.let(json[:refresh_token], String)
18
25
  end
19
26
 
20
27
  def to_json(*)
21
28
  {
22
29
  user: user.to_json,
23
30
  organization_id: organization_id,
31
+ impersonator: impersonator.to_json,
32
+ access_token: access_token,
33
+ refresh_token: refresh_token,
24
34
  }
25
35
  end
26
36
  end
@@ -35,6 +35,7 @@ module WorkOS
35
35
  ).returns(WorkOS::Types::ListStruct)
36
36
  end
37
37
  def list_directories(options = {})
38
+ options[:order] ||= 'desc'
38
39
  response = execute_request(
39
40
  request: get_request(
40
41
  path: '/directories',
@@ -104,6 +105,7 @@ module WorkOS
104
105
  ).returns(WorkOS::Types::ListStruct)
105
106
  end
106
107
  def list_groups(options = {})
108
+ options[:order] ||= 'desc'
107
109
  response = execute_request(
108
110
  request: get_request(
109
111
  path: '/directory_groups',
@@ -144,6 +146,7 @@ module WorkOS
144
146
  ).returns(WorkOS::Types::ListStruct)
145
147
  end
146
148
  def list_users(options = {})
149
+ options[:order] ||= 'desc'
147
150
  response = execute_request(
148
151
  request: get_request(
149
152
  path: '/directory_users',
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+ # typed: true
3
+
4
+ module WorkOS
5
+ # Contains information about a WorkOS Dashboard user impersonating
6
+ # a User Management user.
7
+ class Impersonator
8
+ include HashProvider
9
+ extend T::Sig
10
+
11
+ attr_accessor :email, :reason
12
+
13
+ sig { params(email: String, reason: T.nilable(String)).void }
14
+ def initialize(email:, reason:)
15
+ @email = email
16
+ @reason = reason
17
+ end
18
+
19
+ def to_json(*)
20
+ {
21
+ email: email,
22
+ reason: reason,
23
+ }
24
+ end
25
+ end
26
+ end
@@ -9,7 +9,7 @@ module WorkOS
9
9
  include HashProvider
10
10
  extend T::Sig
11
11
 
12
- attr_accessor :id, :user_id, :organization_id, :created_at, :updated_at
12
+ attr_accessor :id, :user_id, :organization_id, :status, :created_at, :updated_at
13
13
 
14
14
  sig { params(json: String).void }
15
15
  def initialize(json)
@@ -18,6 +18,7 @@ module WorkOS
18
18
  @id = T.let(raw.id, String)
19
19
  @user_id = T.let(raw.user_id, String)
20
20
  @organization_id = raw.organization_id
21
+ @status = T.let(raw.status, String)
21
22
  @created_at = T.let(raw.created_at, String)
22
23
  @updated_at = T.let(raw.updated_at, String)
23
24
  end
@@ -27,6 +28,7 @@ module WorkOS
27
28
  id: id,
28
29
  user_id: user_id,
29
30
  organization_id: organization_id,
31
+ status: status,
30
32
  created_at: created_at,
31
33
  updated_at: updated_at,
32
34
  }
@@ -42,6 +44,7 @@ module WorkOS
42
44
  id: hash[:id],
43
45
  user_id: hash[:user_id],
44
46
  organization_id: hash[:organization_id],
47
+ status: hash[:status],
45
48
  created_at: hash[:created_at],
46
49
  updated_at: hash[:updated_at],
47
50
  )
@@ -28,6 +28,7 @@ module WorkOS
28
28
  ).returns(WorkOS::Types::ListStruct)
29
29
  end
30
30
  def list_organizations(options = {})
31
+ options[:order] ||= 'desc'
31
32
  response = execute_request(
32
33
  request: get_request(
33
34
  path: '/organizations',
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+ # typed: true
3
+
4
+ module WorkOS
5
+ # The RefreshAuthenticationResponse contains response data from a successful
6
+ # `UserManagement.authenticate_with_refresh_token` call
7
+ class RefreshAuthenticationResponse
8
+ include HashProvider
9
+ extend T::Sig
10
+
11
+ attr_accessor :access_token, :refresh_token
12
+
13
+ sig { params(authentication_response_json: String).void }
14
+ def initialize(authentication_response_json)
15
+ json = JSON.parse(authentication_response_json, symbolize_names: true)
16
+ @access_token = T.let(json[:access_token], String)
17
+ @refresh_token = T.let(json[:refresh_token], String)
18
+ end
19
+
20
+ def to_json(*)
21
+ {
22
+ access_token: access_token,
23
+ refresh_token: refresh_token,
24
+ }
25
+ end
26
+ end
27
+ end
data/lib/workos/sso.rb CHANGED
@@ -175,6 +175,7 @@ module WorkOS
175
175
  ).returns(WorkOS::Types::ListStruct)
176
176
  end
177
177
  def list_connections(options = {})
178
+ options[:order] ||= 'desc'
178
179
  response = execute_request(
179
180
  request: get_request(
180
181
  path: '/connections',
@@ -7,7 +7,8 @@ module WorkOS
7
7
  class OrganizationMembershipStruct < T::Struct
8
8
  const :id, String
9
9
  const :user_id, String
10
- const :organization_id, String
10
+ const :organization_id, T.nilable(String)
11
+ const :status, String
11
12
  const :created_at, String
12
13
  const :updated_at, String
13
14
  end
@@ -157,6 +157,7 @@ module WorkOS
157
157
  ).returns(WorkOS::Types::ListStruct)
158
158
  end
159
159
  def list_users(options = {})
160
+ options[:order] ||= 'desc'
160
161
  response = execute_request(
161
162
  request: get_request(
162
163
  path: '/user_management/users',
@@ -365,6 +366,46 @@ module WorkOS
365
366
  WorkOS::AuthenticationResponse.new(response.body)
366
367
  end
367
368
 
369
+ # Authenticate a user using a refresh token.
370
+ #
371
+ # @param [String] refresh_token The refresh token previously obtained from a successful authentication call
372
+ # @param [String] client_id The WorkOS client ID for the environment
373
+ # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate.
374
+ # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate.
375
+ #
376
+ # @return WorkOS::RefreshAuthenticationResponse
377
+
378
+ sig do
379
+ params(
380
+ refresh_token: String,
381
+ client_id: String,
382
+ ip_address: T.nilable(String),
383
+ user_agent: T.nilable(String),
384
+ ).returns(WorkOS::RefreshAuthenticationResponse)
385
+ end
386
+ def authenticate_with_refresh_token(
387
+ refresh_token:,
388
+ client_id:,
389
+ ip_address: nil,
390
+ user_agent: nil
391
+ )
392
+ response = execute_request(
393
+ request: post_request(
394
+ path: '/user_management/authenticate',
395
+ body: {
396
+ refresh_token: refresh_token,
397
+ client_id: client_id,
398
+ client_secret: WorkOS.config.key!,
399
+ ip_address: ip_address,
400
+ user_agent: user_agent,
401
+ grant_type: 'refresh_token',
402
+ },
403
+ ),
404
+ )
405
+
406
+ WorkOS::RefreshAuthenticationResponse.new(response.body)
407
+ end
408
+
368
409
  # Authenticate user by Magic Auth Code.
369
410
  #
370
411
  # @param [String] code The one-time code that was emailed to the user.
@@ -553,6 +594,66 @@ module WorkOS
553
594
  WorkOS::AuthenticationResponse.new(response.body)
554
595
  end
555
596
 
597
+ # Get the logout URL for a session
598
+ #
599
+ # The user's browser should be navigated to this URL
600
+ #
601
+ # @param [String] session_id The session ID can be found in the `sid`
602
+ # claim of the access token
603
+ #
604
+ # @return String
605
+ sig do
606
+ params(
607
+ session_id: String,
608
+ ).returns(String)
609
+ end
610
+ def get_logout_url(session_id:)
611
+ URI::HTTPS.build(
612
+ host: WorkOS.config.api_hostname,
613
+ path: '/user_management/sessions/logout',
614
+ query: "session_id=#{session_id}",
615
+ ).to_s
616
+ end
617
+
618
+ # Revokes a session
619
+ #
620
+ # @param [String] session_id The session ID can be found in the `sid`
621
+ # claim of the access token
622
+ sig do
623
+ params(
624
+ session_id: String,
625
+ ).void
626
+ end
627
+ def revoke_session(session_id:)
628
+ execute_request(
629
+ request: post_request(
630
+ path: '/user_management/sessions/revoke',
631
+ body: {
632
+ session_id: session_id,
633
+ },
634
+ ),
635
+ )
636
+ end
637
+
638
+ # Get the JWKS URL
639
+ #
640
+ # The JWKS can be used to validate the access token returned upon successful authentication
641
+ #
642
+ # @param [String] client_id The WorkOS client ID for the environment
643
+ #
644
+ # @return String
645
+ sig do
646
+ params(
647
+ client_id: String,
648
+ ).returns(String)
649
+ end
650
+ def get_jwks_url(client_id)
651
+ URI::HTTPS.build(
652
+ host: WorkOS.config.api_hostname,
653
+ path: "/sso/jwks/#{client_id}",
654
+ ).to_s
655
+ end
656
+
556
657
  # Create a one-time Magic Auth code and emails it to the user.
557
658
  #
558
659
  # @param [String] email The email address the one-time code will be sent to.
@@ -783,6 +884,7 @@ module WorkOS
783
884
  ).returns(WorkOS::Types::ListStruct)
784
885
  end
785
886
  def list_organization_memberships(options = {})
887
+ options[:order] ||= 'desc'
786
888
  response = execute_request(
787
889
  request: get_request(
788
890
  path: '/user_management/organization_memberships',
@@ -889,6 +991,7 @@ module WorkOS
889
991
  ).returns(WorkOS::Types::ListStruct)
890
992
  end
891
993
  def list_invitations(options = {})
994
+ options[:order] ||= 'desc'
892
995
  response = execute_request(
893
996
  request: get_request(
894
997
  path: '/user_management/invitations',
@@ -2,5 +2,5 @@
2
2
  # typed: strong
3
3
 
4
4
  module WorkOS
5
- VERSION = '3.1.0'
5
+ VERSION = '4.1.0'
6
6
  end
data/lib/workos.rb CHANGED
@@ -58,6 +58,7 @@ module WorkOS
58
58
  autoload :Event, 'workos/event'
59
59
  autoload :Events, 'workos/events'
60
60
  autoload :Factor, 'workos/factor'
61
+ autoload :Impersonator, 'workos/impersonator'
61
62
  autoload :Invitation, 'workos/invitation'
62
63
  autoload :MFA, 'workos/mfa'
63
64
  autoload :Organization, 'workos/organization'
@@ -67,6 +68,7 @@ module WorkOS
67
68
  autoload :Portal, 'workos/portal'
68
69
  autoload :Profile, 'workos/profile'
69
70
  autoload :ProfileAndToken, 'workos/profile_and_token'
71
+ autoload :RefreshAuthenticationResponse, 'workos/refresh_authentication_response'
70
72
  autoload :SSO, 'workos/sso'
71
73
  autoload :Types, 'workos/types'
72
74
  autoload :User, 'workos/user'
@@ -24,7 +24,8 @@ describe WorkOS::DirectorySync do
24
24
  context 'with domain option' do
25
25
  it 'forms the proper request to the API' do
26
26
  request_args = [
27
- '/directories?domain=foo-corp.com',
27
+ '/directories?domain=foo-corp.com&'\
28
+ 'order=desc',
28
29
  'Content-Type' => 'application/json'
29
30
  ]
30
31
 
@@ -46,7 +47,8 @@ describe WorkOS::DirectorySync do
46
47
  context 'with search option' do
47
48
  it 'forms the proper request to the API' do
48
49
  request_args = [
49
- '/directories?search=Testing',
50
+ '/directories?search=Testing&'\
51
+ 'order=desc',
50
52
  'Content-Type' => 'application/json'
51
53
  ]
52
54
 
@@ -69,7 +71,8 @@ describe WorkOS::DirectorySync do
69
71
  context 'with the before option' do
70
72
  it 'forms the proper request to the API' do
71
73
  request_args = [
72
- '/directories?before=directory_01FGCPNV312FHFRCX0BYWHVSE1',
74
+ '/directories?before=directory_01FGCPNV312FHFRCX0BYWHVSE1&'\
75
+ 'order=desc',
73
76
  'Content-Type' => 'application/json'
74
77
  ]
75
78
 
@@ -91,7 +94,8 @@ describe WorkOS::DirectorySync do
91
94
  context 'with the after option' do
92
95
  it 'forms the proper request to the API' do
93
96
  request_args = [
94
- '/directories?after=directory_01FGCPNV312FHFRCX0BYWHVSE1',
97
+ '/directories?after=directory_01FGCPNV312FHFRCX0BYWHVSE1&'\
98
+ 'order=desc',
95
99
  'Content-Type' => 'application/json'
96
100
  ]
97
101
 
@@ -111,7 +115,8 @@ describe WorkOS::DirectorySync do
111
115
  context 'with the limit option' do
112
116
  it 'forms the proper request to the API' do
113
117
  request_args = [
114
- '/directories?limit=2',
118
+ '/directories?limit=2&'\
119
+ 'order=desc',
115
120
  'Content-Type' => 'application/json'
116
121
  ]
117
122
 
@@ -189,7 +194,8 @@ describe WorkOS::DirectorySync do
189
194
  context 'with directory option' do
190
195
  it 'forms the proper request to the API' do
191
196
  request_args = [
192
- '/directory_groups?directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT',
197
+ '/directory_groups?directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&'\
198
+ 'order=desc',
193
199
  'Content-Type' => 'application/json'
194
200
  ]
195
201
 
@@ -212,7 +218,8 @@ describe WorkOS::DirectorySync do
212
218
  context 'with user option' do
213
219
  it 'forms the proper request to the API' do
214
220
  request_args = [
215
- '/directory_groups?user=directory_user_01G2Z8D4FDB28ZNSRRBVCF2E0P',
221
+ '/directory_groups?user=directory_user_01G2Z8D4FDB28ZNSRRBVCF2E0P&'\
222
+ 'order=desc',
216
223
  'Content-Type' => 'application/json'
217
224
  ]
218
225
 
@@ -235,7 +242,8 @@ describe WorkOS::DirectorySync do
235
242
  it 'forms the proper request to the API' do
236
243
  request_args = [
237
244
  '/directory_groups?before=directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG&' \
238
- 'directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT',
245
+ 'directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&'\
246
+ 'order=desc',
239
247
  'Content-Type' => 'application/json'
240
248
  ]
241
249
 
@@ -259,7 +267,8 @@ describe WorkOS::DirectorySync do
259
267
  it 'forms the proper request to the API' do
260
268
  request_args = [
261
269
  '/directory_groups?after=directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG&' \
262
- 'directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT',
270
+ 'directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&'\
271
+ 'order=desc',
263
272
  'Content-Type' => 'application/json'
264
273
  ]
265
274
 
@@ -283,7 +292,8 @@ describe WorkOS::DirectorySync do
283
292
  it 'forms the proper request to the API' do
284
293
  request_args = [
285
294
  '/directory_groups?limit=2&' \
286
- 'directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT',
295
+ 'directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&'\
296
+ 'order=desc',
287
297
  'Content-Type' => 'application/json'
288
298
  ]
289
299
 
@@ -318,7 +328,8 @@ describe WorkOS::DirectorySync do
318
328
  context 'with directory option' do
319
329
  it 'forms the proper request to the API' do
320
330
  request_args = [
321
- '/directory_users?directory=directory_01FAZYMST676QMTFN1DDJZZX87',
331
+ '/directory_users?directory=directory_01FAZYMST676QMTFN1DDJZZX87&'\
332
+ 'order=desc',
322
333
  'Content-Type' => 'application/json'
323
334
  ]
324
335
 
@@ -341,7 +352,8 @@ describe WorkOS::DirectorySync do
341
352
  context 'with group option' do
342
353
  it 'forms the proper request to the API' do
343
354
  request_args = [
344
- '/directory_users?group=directory_group_01FBXGP79EJAYKW0WS9JCK1V6E',
355
+ '/directory_users?group=directory_group_01FBXGP79EJAYKW0WS9JCK1V6E&'\
356
+ 'order=desc',
345
357
  'Content-Type' => 'application/json'
346
358
  ]
347
359
 
@@ -364,7 +376,8 @@ describe WorkOS::DirectorySync do
364
376
  it 'forms the proper request to the API' do
365
377
  request_args = [
366
378
  '/directory_users?before=directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF&'\
367
- 'directory=directory_01FAZYMST676QMTFN1DDJZZX87',
379
+ 'directory=directory_01FAZYMST676QMTFN1DDJZZX87&'\
380
+ 'order=desc',
368
381
  'Content-Type' => 'application/json'
369
382
  ]
370
383
 
@@ -388,7 +401,8 @@ describe WorkOS::DirectorySync do
388
401
  it 'forms the proper request to the API' do
389
402
  request_args = [
390
403
  '/directory_users?after=directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF&' \
391
- 'directory=directory_01FAZYMST676QMTFN1DDJZZX87',
404
+ 'directory=directory_01FAZYMST676QMTFN1DDJZZX87&'\
405
+ 'order=desc',
392
406
  'Content-Type' => 'application/json'
393
407
  ]
394
408
 
@@ -412,7 +426,8 @@ describe WorkOS::DirectorySync do
412
426
  it 'forms the proper request to the API' do
413
427
  request_args = [
414
428
  '/directory_users?limit=2&' \
415
- 'directory=directory_01FAZYMST676QMTFN1DDJZZX87',
429
+ 'directory=directory_01FAZYMST676QMTFN1DDJZZX87&'\
430
+ 'order=desc',
416
431
  'Content-Type' => 'application/json'
417
432
  ]
418
433
 
@@ -121,7 +121,8 @@ describe WorkOS::Organizations do
121
121
  context 'with the before option' do
122
122
  it 'forms the proper request to the API' do
123
123
  request_args = [
124
- '/organizations?before=before-id',
124
+ '/organizations?before=before-id&'\
125
+ 'order=desc',
125
126
  'Content-Type' => 'application/json'
126
127
  ]
127
128
 
@@ -143,7 +144,8 @@ describe WorkOS::Organizations do
143
144
  context 'with the after option' do
144
145
  it 'forms the proper request to the API' do
145
146
  request_args = [
146
- '/organizations?after=after-id',
147
+ '/organizations?after=after-id&'\
148
+ 'order=desc',
147
149
  'Content-Type' => 'application/json'
148
150
  ]
149
151
 
@@ -163,7 +165,8 @@ describe WorkOS::Organizations do
163
165
  context 'with the limit option' do
164
166
  it 'forms the proper request to the API' do
165
167
  request_args = [
166
- '/organizations?limit=10',
168
+ '/organizations?limit=10&'\
169
+ 'order=desc',
167
170
  'Content-Type' => 'application/json'
168
171
  ]
169
172
 
@@ -457,7 +457,8 @@ describe WorkOS::SSO do
457
457
  context 'with connection_type option' do
458
458
  it 'forms the proper request to the API' do
459
459
  request_args = [
460
- '/connections?connection_type=OktaSAML',
460
+ '/connections?connection_type=OktaSAML&'\
461
+ 'order=desc',
461
462
  'Content-Type' => 'application/json'
462
463
  ]
463
464
 
@@ -480,7 +481,8 @@ describe WorkOS::SSO do
480
481
  context 'with domain option' do
481
482
  it 'forms the proper request to the API' do
482
483
  request_args = [
483
- '/connections?domain=foo-corp.com',
484
+ '/connections?domain=foo-corp.com&'\
485
+ 'order=desc',
484
486
  'Content-Type' => 'application/json'
485
487
  ]
486
488
 
@@ -502,7 +504,8 @@ describe WorkOS::SSO do
502
504
  context 'with organization_id option' do
503
505
  it 'forms the proper request to the API' do
504
506
  request_args = [
505
- '/connections?organization_id=org_01F9293WD2PDEEV4Y625XPZVG7',
507
+ '/connections?organization_id=org_01F9293WD2PDEEV4Y625XPZVG7&'\
508
+ 'order=desc',
506
509
  'Content-Type' => 'application/json'
507
510
  ]
508
511
 
@@ -527,7 +530,8 @@ describe WorkOS::SSO do
527
530
  context 'with limit option' do
528
531
  it 'forms the proper request to the API' do
529
532
  request_args = [
530
- '/connections?limit=2',
533
+ '/connections?limit=2&'\
534
+ 'order=desc',
531
535
  'Content-Type' => 'application/json'
532
536
  ]
533
537
 
@@ -549,7 +553,8 @@ describe WorkOS::SSO do
549
553
  context 'with before option' do
550
554
  it 'forms the proper request to the API' do
551
555
  request_args = [
552
- '/connections?before=conn_01FA3WGCWPCCY1V2FGES2FDNP7',
556
+ '/connections?before=conn_01FA3WGCWPCCY1V2FGES2FDNP7&'\
557
+ 'order=desc',
553
558
  'Content-Type' => 'application/json'
554
559
  ]
555
560
 
@@ -571,7 +576,8 @@ describe WorkOS::SSO do
571
576
  context 'with after option' do
572
577
  it 'forms the proper request to the API' do
573
578
  request_args = [
574
- '/connections?after=conn_01FA3WGCWPCCY1V2FGES2FDNP7',
579
+ '/connections?after=conn_01FA3WGCWPCCY1V2FGES2FDNP7&'\
580
+ 'order=desc',
575
581
  'Content-Type' => 'application/json'
576
582
  ]
577
583