workos 9.3.0 → 9.4.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 (100) hide show
  1. checksums.yaml +4 -4
  2. data/.last-synced-sha +1 -1
  3. data/.oagen-manifest.json +110 -1
  4. data/.release-please-manifest.json +1 -1
  5. data/CHANGELOG.md +123 -0
  6. data/Gemfile.lock +2 -2
  7. data/lib/workos/admin_portal/generate_link.rb +0 -3
  8. data/lib/workos/admin_portal.rb +0 -3
  9. data/lib/workos/authorization/user_role_assignment.rb +3 -0
  10. data/lib/workos/authorization/user_role_assignment_source.rb +22 -0
  11. data/lib/workos/pipes/connected_account_dto.rb +31 -0
  12. data/lib/workos/pipes/create_data_integration.rb +34 -0
  13. data/lib/workos/pipes/custom_provider_definition.rb +49 -0
  14. data/lib/workos/pipes/data_integration.rb +55 -0
  15. data/lib/workos/pipes/data_integration_credential.rb +25 -0
  16. data/lib/workos/pipes/data_integration_credentials_dto.rb +25 -0
  17. data/lib/workos/pipes/data_integration_credentials_response.rb +25 -0
  18. data/lib/workos/pipes/data_integration_credentials_response_credential.rb +34 -0
  19. data/lib/workos/pipes/data_integration_custom_provider.rb +49 -0
  20. data/lib/workos/pipes/data_integrations_upsert_api_key_request.rb +25 -0
  21. data/lib/workos/pipes/data_integrations_vend_credentials_request.rb +22 -0
  22. data/lib/workos/pipes/update_custom_provider_definition.rb +49 -0
  23. data/lib/workos/pipes/update_data_integration.rb +31 -0
  24. data/lib/workos/pipes.rb +304 -0
  25. data/lib/workos/radar/radar_standalone_assess_request.rb +5 -2
  26. data/lib/workos/radar.rb +5 -2
  27. data/lib/workos/shared/auth_method_mismatch_error.rb +22 -0
  28. data/lib/workos/types/audit_log_export_state.rb +2 -1
  29. data/lib/workos/types/connected_account_state.rb +1 -2
  30. data/lib/workos/types/create_webhook_endpoint_events.rb +8 -1
  31. data/lib/workos/types/custom_provider_definition_authenticate_via.rb +13 -0
  32. data/lib/workos/types/data_integration_credential_type.rb +13 -0
  33. data/lib/workos/types/data_integration_credentials_response_error.rb +9 -0
  34. data/lib/workos/types/data_integration_credentials_type.rb +9 -0
  35. data/lib/workos/types/data_integration_custom_provider_authenticate_via.rb +9 -0
  36. data/lib/workos/types/data_integration_state.rb +14 -0
  37. data/lib/workos/types/data_integrations_list_response_data_connected_account_state.rb +6 -1
  38. data/lib/workos/types/update_custom_provider_definition_authenticate_via.rb +9 -0
  39. data/lib/workos/types/user_role_assignment_source_type.rb +13 -0
  40. data/lib/workos/user_management/authorization_code_session_authenticate_request.rb +5 -2
  41. data/lib/workos/user_management/create_magic_code_and_return.rb +14 -2
  42. data/lib/workos/user_management/create_user.rb +9 -0
  43. data/lib/workos/user_management/magic_auth_code_session_authenticate_request.rb +5 -2
  44. data/lib/workos/user_management/magic_auth_send_magic_auth_code_and_return_response.rb +18 -0
  45. data/lib/workos/user_management/password_session_authenticate_request.rb +8 -2
  46. data/lib/workos/user_management/radar_email_challenge_code_session_authenticate_request.rb +43 -0
  47. data/lib/workos/user_management/radar_sms_challenge_code_session_authenticate_request.rb +46 -0
  48. data/lib/workos/user_management/send_radar_sms_challenge.rb +31 -0
  49. data/lib/workos/user_management/send_radar_sms_challenge_response.rb +22 -0
  50. data/lib/workos/user_management/user_create_response.rb +7 -0
  51. data/lib/workos/user_management.rb +165 -6
  52. data/lib/workos/version.rb +1 -1
  53. data/rbi/workos/admin_portal.rbi +1 -2
  54. data/rbi/workos/auth_method_mismatch_error.rbi +30 -0
  55. data/rbi/workos/authorization_code_session_authenticate_request.rbi +6 -0
  56. data/rbi/workos/connected_account_dto.rbi +48 -0
  57. data/rbi/workos/create_data_integration.rbi +54 -0
  58. data/rbi/workos/create_magic_code_and_return.rbi +24 -0
  59. data/rbi/workos/create_user.rbi +18 -0
  60. data/rbi/workos/custom_provider_definition.rbi +84 -0
  61. data/rbi/workos/data_integration.rbi +96 -0
  62. data/rbi/workos/data_integration_credential.rbi +36 -0
  63. data/rbi/workos/data_integration_credentials_dto.rbi +36 -0
  64. data/rbi/workos/data_integration_credentials_response.rbi +36 -0
  65. data/rbi/workos/data_integration_credentials_response_credential.rbi +54 -0
  66. data/rbi/workos/data_integration_custom_provider.rbi +84 -0
  67. data/rbi/workos/data_integrations_upsert_api_key_request.rbi +36 -0
  68. data/rbi/workos/data_integrations_vend_credentials_request.rbi +30 -0
  69. data/rbi/workos/generate_link.rbi +0 -6
  70. data/rbi/workos/magic_auth_code_session_authenticate_request.rbi +6 -0
  71. data/rbi/workos/magic_auth_send_magic_auth_code_and_return_response.rbi +24 -0
  72. data/rbi/workos/password_session_authenticate_request.rbi +12 -0
  73. data/rbi/workos/pipes.rbi +104 -0
  74. data/rbi/workos/radar.rbi +2 -1
  75. data/rbi/workos/radar_email_challenge_code_session_authenticate_request.rbi +72 -0
  76. data/rbi/workos/radar_sms_challenge_code_session_authenticate_request.rbi +78 -0
  77. data/rbi/workos/radar_standalone_assess_request.rbi +6 -0
  78. data/rbi/workos/send_radar_sms_challenge.rbi +48 -0
  79. data/rbi/workos/send_radar_sms_challenge_response.rbi +30 -0
  80. data/rbi/workos/update_custom_provider_definition.rbi +84 -0
  81. data/rbi/workos/update_data_integration.rbi +48 -0
  82. data/rbi/workos/user_create_response.rbi +24 -0
  83. data/rbi/workos/user_management.rbi +47 -5
  84. data/rbi/workos/user_role_assignment.rbi +6 -0
  85. data/rbi/workos/user_role_assignment_source.rbi +30 -0
  86. data/test/workos/test_admin_portal_model_round_trip.rb +33 -0
  87. data/test/workos/test_audit_logs_model_round_trip.rb +218 -0
  88. data/test/workos/test_authorization_model_round_trip.rb +456 -0
  89. data/test/workos/test_connect_model_round_trip.rb +30 -0
  90. data/test/workos/test_groups_model_round_trip.rb +33 -0
  91. data/test/workos/test_model_round_trip.rb +2 -7857
  92. data/test/workos/test_organizations_model_round_trip.rb +29 -0
  93. data/test/workos/test_pipes.rb +72 -0
  94. data/test/workos/test_pipes_model_round_trip.rb +389 -0
  95. data/test/workos/test_radar_model_round_trip.rb +85 -0
  96. data/test/workos/test_shared_model_round_trip.rb +92 -0
  97. data/test/workos/test_user_management.rb +24 -0
  98. data/test/workos/test_user_management_model_round_trip.rb +1048 -0
  99. data/test/workos/test_webhooks_model_round_trip.rb +53 -0
  100. metadata +62 -1
@@ -0,0 +1,456 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ require "test_helper"
6
+
7
+ class AuthorizationModelRoundTripTest < Minitest::Test
8
+ def test_check_authorization_round_trip
9
+ fixture = {
10
+ "permission_slug" => "stub",
11
+ "resource_id" => "stub",
12
+ "resource_external_id" => "stub",
13
+ "resource_type_slug" => "stub"
14
+ }
15
+ model = WorkOS::CheckAuthorization.new(fixture.to_json)
16
+ json = model.to_h
17
+ assert_kind_of Hash, json
18
+ assert_equal fixture["permission_slug"], json[:permission_slug]
19
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
20
+ end
21
+
22
+ def test_create_group_role_assignment_round_trip
23
+ fixture = {
24
+ "role_slug" => "stub",
25
+ "resource_id" => "stub",
26
+ "resource_external_id" => "stub",
27
+ "resource_type_slug" => "stub"
28
+ }
29
+ model = WorkOS::CreateGroupRoleAssignment.new(fixture.to_json)
30
+ json = model.to_h
31
+ assert_kind_of Hash, json
32
+ assert_equal fixture["role_slug"], json[:role_slug]
33
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
34
+ end
35
+
36
+ def test_replace_group_role_assignment_entry_round_trip
37
+ fixture = {
38
+ "role_slug" => "stub",
39
+ "resource_id" => "stub",
40
+ "resource_external_id" => "stub",
41
+ "resource_type_slug" => "stub"
42
+ }
43
+ model = WorkOS::ReplaceGroupRoleAssignmentEntry.new(fixture.to_json)
44
+ json = model.to_h
45
+ assert_kind_of Hash, json
46
+ assert_equal fixture["role_slug"], json[:role_slug]
47
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
48
+ end
49
+
50
+ def test_replace_group_role_assignments_round_trip
51
+ fixture = {
52
+ "role_assignments" => []
53
+ }
54
+ model = WorkOS::ReplaceGroupRoleAssignments.new(fixture.to_json)
55
+ json = model.to_h
56
+ assert_kind_of Hash, json
57
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
58
+ end
59
+
60
+ def test_delete_group_role_assignments_by_criteria_round_trip
61
+ fixture = {
62
+ "role_slug" => "stub",
63
+ "resource_id" => "stub",
64
+ "resource_external_id" => "stub",
65
+ "resource_type_slug" => "stub"
66
+ }
67
+ model = WorkOS::DeleteGroupRoleAssignmentsByCriteria.new(fixture.to_json)
68
+ json = model.to_h
69
+ assert_kind_of Hash, json
70
+ assert_equal fixture["role_slug"], json[:role_slug]
71
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
72
+ end
73
+
74
+ def test_assign_role_round_trip
75
+ fixture = {
76
+ "role_slug" => "stub",
77
+ "resource_id" => "stub",
78
+ "resource_external_id" => "stub",
79
+ "resource_type_slug" => "stub"
80
+ }
81
+ model = WorkOS::AssignRole.new(fixture.to_json)
82
+ json = model.to_h
83
+ assert_kind_of Hash, json
84
+ assert_equal fixture["role_slug"], json[:role_slug]
85
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
86
+ end
87
+
88
+ def test_remove_role_round_trip
89
+ fixture = {
90
+ "role_slug" => "stub",
91
+ "resource_id" => "stub",
92
+ "resource_external_id" => "stub",
93
+ "resource_type_slug" => "stub"
94
+ }
95
+ model = WorkOS::RemoveRole.new(fixture.to_json)
96
+ json = model.to_h
97
+ assert_kind_of Hash, json
98
+ assert_equal fixture["role_slug"], json[:role_slug]
99
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
100
+ end
101
+
102
+ def test_set_role_permissions_round_trip
103
+ fixture = {
104
+ "permissions" => []
105
+ }
106
+ model = WorkOS::SetRolePermissions.new(fixture.to_json)
107
+ json = model.to_h
108
+ assert_kind_of Hash, json
109
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
110
+ end
111
+
112
+ def test_add_role_permission_round_trip
113
+ fixture = {
114
+ "slug" => "stub"
115
+ }
116
+ model = WorkOS::AddRolePermission.new(fixture.to_json)
117
+ json = model.to_h
118
+ assert_kind_of Hash, json
119
+ assert_equal fixture["slug"], json[:slug]
120
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
121
+ end
122
+
123
+ def test_create_organization_role_round_trip
124
+ fixture = {
125
+ "slug" => "stub",
126
+ "name" => "stub",
127
+ "description" => nil,
128
+ "resource_type_slug" => "stub"
129
+ }
130
+ model = WorkOS::CreateOrganizationRole.new(fixture.to_json)
131
+ json = model.to_h
132
+ assert_kind_of Hash, json
133
+ assert_equal fixture["name"], json[:name]
134
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
135
+ end
136
+
137
+ def test_update_organization_role_round_trip
138
+ fixture = {
139
+ "name" => "stub",
140
+ "description" => nil
141
+ }
142
+ model = WorkOS::UpdateOrganizationRole.new(fixture.to_json)
143
+ json = model.to_h
144
+ assert_kind_of Hash, json
145
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
146
+ end
147
+
148
+ def test_create_authorization_permission_round_trip
149
+ fixture = {
150
+ "slug" => "stub",
151
+ "name" => "stub",
152
+ "description" => nil,
153
+ "resource_type_slug" => "stub"
154
+ }
155
+ model = WorkOS::CreateAuthorizationPermission.new(fixture.to_json)
156
+ json = model.to_h
157
+ assert_kind_of Hash, json
158
+ assert_equal fixture["slug"], json[:slug]
159
+ assert_equal fixture["name"], json[:name]
160
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
161
+ end
162
+
163
+ def test_update_authorization_permission_round_trip
164
+ fixture = {
165
+ "name" => "stub",
166
+ "description" => nil
167
+ }
168
+ model = WorkOS::UpdateAuthorizationPermission.new(fixture.to_json)
169
+ json = model.to_h
170
+ assert_kind_of Hash, json
171
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
172
+ end
173
+
174
+ def test_create_role_round_trip
175
+ fixture = {
176
+ "slug" => "stub",
177
+ "name" => "stub",
178
+ "description" => nil,
179
+ "resource_type_slug" => "stub"
180
+ }
181
+ model = WorkOS::CreateRole.new(fixture.to_json)
182
+ json = model.to_h
183
+ assert_kind_of Hash, json
184
+ assert_equal fixture["slug"], json[:slug]
185
+ assert_equal fixture["name"], json[:name]
186
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
187
+ end
188
+
189
+ def test_update_role_round_trip
190
+ fixture = {
191
+ "name" => "stub",
192
+ "description" => nil
193
+ }
194
+ model = WorkOS::UpdateRole.new(fixture.to_json)
195
+ json = model.to_h
196
+ assert_kind_of Hash, json
197
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
198
+ end
199
+
200
+ def test_update_authorization_resource_round_trip
201
+ fixture = {
202
+ "name" => "stub",
203
+ "description" => nil,
204
+ "parent_resource_id" => "stub",
205
+ "parent_resource_external_id" => "stub",
206
+ "parent_resource_type_slug" => "stub"
207
+ }
208
+ model = WorkOS::UpdateAuthorizationResource.new(fixture.to_json)
209
+ json = model.to_h
210
+ assert_kind_of Hash, json
211
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
212
+ end
213
+
214
+ def test_create_authorization_resource_round_trip
215
+ fixture = {
216
+ "external_id" => "stub",
217
+ "name" => "stub",
218
+ "description" => nil,
219
+ "resource_type_slug" => "stub",
220
+ "organization_id" => "stub",
221
+ "parent_resource_id" => nil,
222
+ "parent_resource_external_id" => "stub",
223
+ "parent_resource_type_slug" => "stub"
224
+ }
225
+ model = WorkOS::CreateAuthorizationResource.new(fixture.to_json)
226
+ json = model.to_h
227
+ assert_kind_of Hash, json
228
+ assert_equal fixture["external_id"], json[:external_id]
229
+ assert_equal fixture["name"], json[:name]
230
+ assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
231
+ assert_equal fixture["organization_id"], json[:organization_id]
232
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
233
+ end
234
+
235
+ def test_authorization_check_round_trip
236
+ fixture = {
237
+ "authorized" => true
238
+ }
239
+ model = WorkOS::AuthorizationCheck.new(fixture.to_json)
240
+ json = model.to_h
241
+ assert_kind_of Hash, json
242
+ assert_equal fixture["authorized"], json[:authorized]
243
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
244
+ end
245
+
246
+ def test_authorization_resource_round_trip
247
+ fixture = {
248
+ "object" => "authorization_resource",
249
+ "name" => "stub",
250
+ "description" => nil,
251
+ "organization_id" => "stub",
252
+ "parent_resource_id" => nil,
253
+ "id" => "stub",
254
+ "external_id" => "stub",
255
+ "resource_type_slug" => "stub",
256
+ "created_at" => "stub",
257
+ "updated_at" => "stub"
258
+ }
259
+ model = WorkOS::AuthorizationResource.new(fixture.to_json)
260
+ json = model.to_h
261
+ assert_kind_of Hash, json
262
+ assert_equal fixture["name"], json[:name]
263
+ assert_nil json[:description]
264
+ assert_equal fixture["organization_id"], json[:organization_id]
265
+ assert_nil json[:parent_resource_id]
266
+ assert_equal fixture["id"], json[:id]
267
+ assert_equal fixture["external_id"], json[:external_id]
268
+ assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
269
+ assert_equal fixture["created_at"], json[:created_at]
270
+ assert_equal fixture["updated_at"], json[:updated_at]
271
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
272
+ end
273
+
274
+ def test_authorization_permission_round_trip
275
+ fixture = {
276
+ "object" => "permission",
277
+ "id" => "stub",
278
+ "slug" => "stub",
279
+ "name" => "stub",
280
+ "description" => nil,
281
+ "system" => true,
282
+ "resource_type_slug" => "stub",
283
+ "created_at" => "stub",
284
+ "updated_at" => "stub"
285
+ }
286
+ model = WorkOS::AuthorizationPermission.new(fixture.to_json)
287
+ json = model.to_h
288
+ assert_kind_of Hash, json
289
+ assert_equal fixture["id"], json[:id]
290
+ assert_equal fixture["slug"], json[:slug]
291
+ assert_equal fixture["name"], json[:name]
292
+ assert_nil json[:description]
293
+ assert_equal fixture["system"], json[:system]
294
+ assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
295
+ assert_equal fixture["created_at"], json[:created_at]
296
+ assert_equal fixture["updated_at"], json[:updated_at]
297
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
298
+ end
299
+
300
+ def test_slim_role_round_trip
301
+ fixture = {
302
+ "slug" => "stub"
303
+ }
304
+ model = WorkOS::SlimRole.new(fixture.to_json)
305
+ json = model.to_h
306
+ assert_kind_of Hash, json
307
+ assert_equal fixture["slug"], json[:slug]
308
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
309
+ end
310
+
311
+ def test_group_role_assignment_round_trip
312
+ fixture = {
313
+ "object" => "group_role_assignment",
314
+ "id" => "stub",
315
+ "group_id" => "stub",
316
+ "role" => {},
317
+ "resource" => {},
318
+ "created_at" => "stub",
319
+ "updated_at" => "stub"
320
+ }
321
+ model = WorkOS::GroupRoleAssignment.new(fixture.to_json)
322
+ json = model.to_h
323
+ assert_kind_of Hash, json
324
+ assert_equal fixture["id"], json[:id]
325
+ assert_equal fixture["group_id"], json[:group_id]
326
+ assert_equal fixture["created_at"], json[:created_at]
327
+ assert_equal fixture["updated_at"], json[:updated_at]
328
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
329
+ end
330
+
331
+ def test_user_role_assignment_round_trip
332
+ fixture = {
333
+ "object" => "role_assignment",
334
+ "id" => "stub",
335
+ "organization_membership_id" => "stub",
336
+ "role" => {},
337
+ "resource" => {},
338
+ "source" => {},
339
+ "created_at" => "stub",
340
+ "updated_at" => "stub"
341
+ }
342
+ model = WorkOS::UserRoleAssignment.new(fixture.to_json)
343
+ json = model.to_h
344
+ assert_kind_of Hash, json
345
+ assert_equal fixture["id"], json[:id]
346
+ assert_equal fixture["organization_membership_id"], json[:organization_membership_id]
347
+ assert_equal fixture["created_at"], json[:created_at]
348
+ assert_equal fixture["updated_at"], json[:updated_at]
349
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
350
+ end
351
+
352
+ def test_role_round_trip
353
+ fixture = {
354
+ "slug" => "stub",
355
+ "object" => "role",
356
+ "id" => "stub",
357
+ "name" => "stub",
358
+ "description" => nil,
359
+ "type" => "stub",
360
+ "resource_type_slug" => "stub",
361
+ "permissions" => [],
362
+ "created_at" => "stub",
363
+ "updated_at" => "stub"
364
+ }
365
+ model = WorkOS::Role.new(fixture.to_json)
366
+ json = model.to_h
367
+ assert_kind_of Hash, json
368
+ assert_equal fixture["slug"], json[:slug]
369
+ assert_equal fixture["id"], json[:id]
370
+ assert_equal fixture["name"], json[:name]
371
+ assert_nil json[:description]
372
+ assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
373
+ assert_equal fixture["created_at"], json[:created_at]
374
+ assert_equal fixture["updated_at"], json[:updated_at]
375
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
376
+ end
377
+
378
+ def test_role_list_round_trip
379
+ fixture = {
380
+ "object" => "list",
381
+ "data" => []
382
+ }
383
+ model = WorkOS::RoleList.new(fixture.to_json)
384
+ json = model.to_h
385
+ assert_kind_of Hash, json
386
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
387
+ end
388
+
389
+ def test_user_role_assignment_resource_round_trip
390
+ fixture = {
391
+ "id" => "stub",
392
+ "external_id" => "stub",
393
+ "resource_type_slug" => "stub"
394
+ }
395
+ model = WorkOS::UserRoleAssignmentResource.new(fixture.to_json)
396
+ json = model.to_h
397
+ assert_kind_of Hash, json
398
+ assert_equal fixture["id"], json[:id]
399
+ assert_equal fixture["external_id"], json[:external_id]
400
+ assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
401
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
402
+ end
403
+
404
+ def test_user_role_assignment_source_round_trip
405
+ fixture = {
406
+ "type" => "stub",
407
+ "group_role_assignment_id" => nil
408
+ }
409
+ model = WorkOS::UserRoleAssignmentSource.new(fixture.to_json)
410
+ json = model.to_h
411
+ assert_kind_of Hash, json
412
+ assert_nil json[:group_role_assignment_id]
413
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
414
+ end
415
+
416
+ def test_group_role_assignment_resource_round_trip
417
+ fixture = {
418
+ "id" => "stub",
419
+ "external_id" => "stub",
420
+ "resource_type_slug" => "stub"
421
+ }
422
+ model = WorkOS::GroupRoleAssignmentResource.new(fixture.to_json)
423
+ json = model.to_h
424
+ assert_kind_of Hash, json
425
+ assert_equal fixture["id"], json[:id]
426
+ assert_equal fixture["external_id"], json[:external_id]
427
+ assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
428
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
429
+ end
430
+
431
+ def test_permission_round_trip
432
+ fixture = {
433
+ "object" => "permission",
434
+ "id" => "stub",
435
+ "slug" => "stub",
436
+ "name" => "stub",
437
+ "description" => nil,
438
+ "system" => true,
439
+ "resource_type_slug" => "stub",
440
+ "created_at" => "stub",
441
+ "updated_at" => "stub"
442
+ }
443
+ model = WorkOS::Permission.new(fixture.to_json)
444
+ json = model.to_h
445
+ assert_kind_of Hash, json
446
+ assert_equal fixture["id"], json[:id]
447
+ assert_equal fixture["slug"], json[:slug]
448
+ assert_equal fixture["name"], json[:name]
449
+ assert_nil json[:description]
450
+ assert_equal fixture["system"], json[:system]
451
+ assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
452
+ assert_equal fixture["created_at"], json[:created_at]
453
+ assert_equal fixture["updated_at"], json[:updated_at]
454
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
455
+ end
456
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ require "test_helper"
6
+
7
+ class ConnectModelRoundTripTest < Minitest::Test
8
+ def test_connect_application_round_trip
9
+ fixture = {
10
+ "object" => "connect_application",
11
+ "id" => "stub",
12
+ "client_id" => "stub",
13
+ "description" => nil,
14
+ "name" => "stub",
15
+ "scopes" => [],
16
+ "created_at" => "stub",
17
+ "updated_at" => "stub"
18
+ }
19
+ model = WorkOS::ConnectApplication.new(fixture.to_json)
20
+ json = model.to_h
21
+ assert_kind_of Hash, json
22
+ assert_equal fixture["id"], json[:id]
23
+ assert_equal fixture["client_id"], json[:client_id]
24
+ assert_nil json[:description]
25
+ assert_equal fixture["name"], json[:name]
26
+ assert_equal fixture["created_at"], json[:created_at]
27
+ assert_equal fixture["updated_at"], json[:updated_at]
28
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
29
+ end
30
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ require "test_helper"
6
+
7
+ class GroupsModelRoundTripTest < Minitest::Test
8
+ def test_user_organization_membership_base_list_data_round_trip
9
+ fixture = {
10
+ "object" => "organization_membership",
11
+ "id" => "stub",
12
+ "user_id" => "stub",
13
+ "organization_id" => "stub",
14
+ "status" => "stub",
15
+ "directory_managed" => true,
16
+ "organization_name" => "stub",
17
+ "custom_attributes" => {},
18
+ "created_at" => "stub",
19
+ "updated_at" => "stub",
20
+ "user" => {}
21
+ }
22
+ model = WorkOS::UserOrganizationMembershipBaseListData.new(fixture.to_json)
23
+ json = model.to_h
24
+ assert_kind_of Hash, json
25
+ assert_equal fixture["id"], json[:id]
26
+ assert_equal fixture["user_id"], json[:user_id]
27
+ assert_equal fixture["organization_id"], json[:organization_id]
28
+ assert_equal fixture["directory_managed"], json[:directory_managed]
29
+ assert_equal fixture["created_at"], json[:created_at]
30
+ assert_equal fixture["updated_at"], json[:updated_at]
31
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
32
+ end
33
+ end