workos 9.5.0 → 10.0.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 (195) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/block-generated-edits.yml +13 -0
  3. data/.github/workflows/ci.yml +1 -1
  4. data/.github/workflows/docs.yml +1 -1
  5. data/.github/workflows/lint.yml +1 -1
  6. data/.github/workflows/release-please.yml +7 -1
  7. data/.github/workflows/release.yml +1 -1
  8. data/.last-synced-sha +1 -1
  9. data/.oagen-manifest.json +197 -75
  10. data/.release-please-manifest.json +1 -1
  11. data/CHANGELOG.md +87 -0
  12. data/Gemfile.lock +2 -2
  13. data/README.md +15 -14
  14. data/lib/workos/agents/agent_admin_link_claim_attempt_to_external_user_request.rb +28 -0
  15. data/lib/workos/agents/agent_admin_link_claim_attempt_to_external_user_request_user.rb +22 -0
  16. data/lib/workos/agents/agent_admin_validate_credential_request.rb +25 -0
  17. data/lib/workos/agents/agent_credential_validation.rb +25 -0
  18. data/lib/workos/agents/agent_registration.rb +40 -0
  19. data/lib/workos/agents/agent_registration_agent_identity.rb +28 -0
  20. data/lib/workos/agents/agent_registration_claim.rb +31 -0
  21. data/lib/workos/agents/agent_registration_claim_claim_completion.rb +31 -0
  22. data/lib/workos/agents/claim_view_response.rb +28 -0
  23. data/lib/workos/agents/claim_view_response_organization.rb +7 -0
  24. data/lib/workos/agents.rb +93 -0
  25. data/lib/workos/api_keys/api_key_validation_response.rb +6 -2
  26. data/lib/workos/api_keys.rb +3 -4
  27. data/lib/workos/authorization/permission_created_data.rb +1 -34
  28. data/lib/workos/authorization/permission_deleted_data.rb +1 -1
  29. data/lib/workos/authorization/permission_updated_data.rb +1 -1
  30. data/lib/workos/authorization.rb +24 -24
  31. data/lib/workos/base_client.rb +4 -4
  32. data/lib/workos/client.rb +4 -0
  33. data/lib/workos/connect.rb +23 -19
  34. data/lib/workos/directory_sync.rb +10 -2
  35. data/lib/workos/groups.rb +7 -7
  36. data/lib/workos/inflections.rb +0 -1
  37. data/lib/workos/organization_domains.rb +4 -4
  38. data/lib/workos/organizations/organization_authorized_connect_application_list_data.rb +34 -0
  39. data/lib/workos/organizations.rb +57 -10
  40. data/lib/workos/pipes/api_key_installation.rb +25 -0
  41. data/lib/workos/pipes/{connected_account_dto.rb → connected_account_input.rb} +1 -1
  42. data/lib/workos/pipes/create_data_integration.rb +7 -1
  43. data/lib/workos/pipes/data_integration.rb +6 -0
  44. data/lib/workos/pipes/{data_integration_credentials_dto.rb → data_integration_credentials_input.rb} +1 -1
  45. data/lib/workos/pipes/data_integration_installation.rb +28 -0
  46. data/lib/workos/pipes/data_integrations_upsert_api_key_request.rb +1 -19
  47. data/lib/workos/pipes/update_data_integration.rb +4 -1
  48. data/lib/workos/pipes.rb +25 -16
  49. data/lib/workos/pipes_provider.rb +2 -2
  50. data/lib/workos/shared/access_token_agent_registration_credential_issued_data_detail.rb +25 -0
  51. data/lib/workos/shared/agent_registration_claim_attempt_created.rb +34 -0
  52. data/lib/workos/shared/agent_registration_claim_attempt_created_data.rb +40 -0
  53. data/lib/workos/shared/agent_registration_claim_completed.rb +34 -0
  54. data/lib/workos/shared/agent_registration_claim_completed_data.rb +40 -0
  55. data/lib/workos/shared/agent_registration_claim_completed_data_claimed_by.rb +22 -0
  56. data/lib/workos/shared/agent_registration_created.rb +34 -0
  57. data/lib/workos/{organization_domains/organization_domain_stand_alone.rb → shared/agent_registration_created_data.rb} +13 -16
  58. data/lib/workos/shared/agent_registration_created_data_agent_identity.rb +25 -0
  59. data/lib/workos/shared/agent_registration_credential_issued.rb +34 -0
  60. data/lib/workos/shared/agent_registration_credential_issued_data.rb +34 -0
  61. data/lib/workos/shared/agent_registration_credential_issued_data_detail.rb +22 -0
  62. data/lib/workos/shared/agent_registration_deleted.rb +34 -0
  63. data/lib/workos/shared/agent_registration_deleted_data.rb +18 -0
  64. data/lib/workos/shared/agent_registration_expired.rb +34 -0
  65. data/lib/workos/shared/agent_registration_expired_data.rb +7 -0
  66. data/lib/workos/shared/agent_registration_organization_switched.rb +34 -0
  67. data/lib/workos/shared/agent_registration_organization_switched_data.rb +25 -0
  68. data/lib/workos/shared/agent_registration_revoked.rb +34 -0
  69. data/lib/workos/shared/agent_registration_revoked_data.rb +7 -0
  70. data/lib/workos/shared/pipes_connected_account_connection_failed.rb +34 -0
  71. data/lib/workos/shared/pipes_connected_account_connection_failed_data.rb +46 -0
  72. data/lib/workos/shared/radar_challenge_created.rb +34 -0
  73. data/lib/workos/shared/radar_challenge_created_data.rb +28 -0
  74. data/lib/workos/sso/connection.rb +3 -3
  75. data/lib/workos/types/agent_admin_validate_credential_request_type.rb +13 -0
  76. data/lib/workos/types/agent_registration_created_data_kind.rb +14 -0
  77. data/lib/workos/types/agent_registration_created_data_method.rb +14 -0
  78. data/lib/workos/types/agent_registration_created_data_status.rb +15 -0
  79. data/lib/workos/types/{data_integration_credentials_type.rb → agent_registration_kind.rb} +1 -1
  80. data/lib/workos/types/{organization_domain_stand_alone_state.rb → agent_registration_status.rb} +1 -1
  81. data/lib/workos/types/applications_registration_types.rb +13 -0
  82. data/lib/workos/types/{organization_domain_stand_alone_verification_strategy.rb → claim_view_response_status.rb} +1 -1
  83. data/lib/workos/types/connected_account_input_state.rb +13 -0
  84. data/lib/workos/types/connected_account_state.rb +2 -1
  85. data/lib/workos/types/create_data_integration_auth_methods.rb +9 -0
  86. data/lib/workos/types/create_user_password_hash_type.rb +2 -1
  87. data/lib/workos/types/create_webhook_endpoint_events.rb +5 -1
  88. data/lib/workos/types/data_integration_auth_methods.rb +9 -0
  89. data/lib/workos/types/data_integration_credentials_input_type.rb +9 -0
  90. data/lib/workos/types/data_integrations_list_response_data_connected_account_state.rb +1 -6
  91. data/lib/workos/types/pipe_connected_account_state.rb +1 -5
  92. data/lib/workos/types/vault_kek_deleted_data_actor_source.rb +9 -0
  93. data/lib/workos/user_management/authentication_reauthentication_succeeded.rb +34 -0
  94. data/lib/workos/user_management/authentication_reauthentication_succeeded_data.rb +34 -0
  95. data/lib/workos/user_management/radar_challenge.rb +43 -0
  96. data/lib/workos/user_management.rb +59 -23
  97. data/lib/workos/vault/vault_kek_deleted.rb +34 -0
  98. data/lib/workos/vault/vault_kek_deleted_data.rb +31 -0
  99. data/lib/workos/vault.rb +4 -4
  100. data/lib/workos/version.rb +1 -1
  101. data/lib/workos/widgets.rb +2 -2
  102. data/lib/workos.rb +11 -0
  103. data/rbi/workos/access_token_agent_registration_credential_issued_data_detail.rbi +36 -0
  104. data/rbi/workos/agent_admin_link_claim_attempt_to_external_user_request.rbi +42 -0
  105. data/rbi/workos/agent_admin_link_claim_attempt_to_external_user_request_user.rbi +30 -0
  106. data/rbi/workos/agent_admin_validate_credential_request.rbi +36 -0
  107. data/rbi/workos/{sso_intent_options.rbi → agent_credential_validation.rbi} +11 -5
  108. data/rbi/workos/agent_registration.rbi +66 -0
  109. data/rbi/workos/agent_registration_agent_identity.rbi +42 -0
  110. data/rbi/workos/agent_registration_claim.rbi +48 -0
  111. data/rbi/workos/agent_registration_claim_attempt_created.rbi +54 -0
  112. data/rbi/workos/agent_registration_claim_attempt_created_data.rbi +66 -0
  113. data/rbi/workos/agent_registration_claim_claim_completion.rbi +48 -0
  114. data/rbi/workos/agent_registration_claim_completed.rbi +54 -0
  115. data/rbi/workos/agent_registration_claim_completed_data.rbi +66 -0
  116. data/rbi/workos/agent_registration_claim_completed_data_claimed_by.rbi +30 -0
  117. data/rbi/workos/agent_registration_created.rbi +54 -0
  118. data/rbi/workos/agent_registration_created_data.rbi +72 -0
  119. data/rbi/workos/agent_registration_created_data_agent_identity.rbi +36 -0
  120. data/rbi/workos/agent_registration_credential_issued.rbi +54 -0
  121. data/rbi/workos/agent_registration_credential_issued_data.rbi +54 -0
  122. data/rbi/workos/agent_registration_credential_issued_data_detail.rbi +30 -0
  123. data/rbi/workos/agent_registration_deleted.rbi +54 -0
  124. data/rbi/workos/{connection_option.rbi → agent_registration_deleted_data.rbi} +5 -5
  125. data/rbi/workos/agent_registration_expired.rbi +54 -0
  126. data/rbi/workos/{domain_verification_intent_options.rbi → agent_registration_expired_data.rbi} +5 -5
  127. data/rbi/workos/agent_registration_organization_switched.rbi +54 -0
  128. data/rbi/workos/agent_registration_organization_switched_data.rbi +36 -0
  129. data/rbi/workos/agent_registration_revoked.rbi +54 -0
  130. data/rbi/workos/agent_registration_revoked_data.rbi +24 -0
  131. data/rbi/workos/agents.rbi +42 -0
  132. data/rbi/workos/api_key_installation.rbi +36 -0
  133. data/rbi/workos/api_key_validation_response.rbi +6 -0
  134. data/rbi/workos/authentication_reauthentication_succeeded.rbi +54 -0
  135. data/rbi/workos/authentication_reauthentication_succeeded_data.rbi +54 -0
  136. data/rbi/workos/claim_view_response.rbi +42 -0
  137. data/rbi/workos/claim_view_response_organization.rbi +30 -0
  138. data/rbi/workos/client.rbi +3 -0
  139. data/rbi/workos/connect.rbi +2 -1
  140. data/rbi/workos/{connected_account_dto.rbi → connected_account_input.rbi} +1 -1
  141. data/rbi/workos/connection.rbi +4 -4
  142. data/rbi/workos/create_data_integration.rbi +14 -2
  143. data/rbi/workos/data_integration.rbi +12 -0
  144. data/rbi/workos/{data_integration_credentials_dto.rbi → data_integration_credentials_input.rbi} +1 -1
  145. data/rbi/workos/data_integration_installation.rbi +42 -0
  146. data/rbi/workos/directory_sync.rbi +3 -1
  147. data/rbi/workos/organization_authorized_connect_application_list_data.rbi +54 -0
  148. data/rbi/workos/organization_domains.rbi +2 -2
  149. data/rbi/workos/organizations.rbi +12 -0
  150. data/rbi/workos/permission_created_data.rbi +6 -0
  151. data/rbi/workos/permission_deleted_data.rbi +6 -0
  152. data/rbi/workos/permission_updated_data.rbi +6 -0
  153. data/rbi/workos/pipes.rbi +7 -4
  154. data/rbi/workos/pipes_connected_account_connection_failed.rbi +54 -0
  155. data/rbi/workos/{organization_domain_stand_alone.rbi → pipes_connected_account_connection_failed_data.rbi} +23 -23
  156. data/rbi/workos/radar_challenge.rbi +72 -0
  157. data/rbi/workos/radar_challenge_created.rbi +54 -0
  158. data/rbi/workos/radar_challenge_created_data.rbi +42 -0
  159. data/rbi/workos/update_data_integration.rbi +8 -2
  160. data/rbi/workos/user_management.rbi +16 -0
  161. data/rbi/workos/vault_kek_deleted.rbi +54 -0
  162. data/rbi/workos/vault_kek_deleted_data.rbi +48 -0
  163. data/rbi/workos/widget_session_token.rbi +2 -2
  164. data/rbi/workos/widgets.rbi +1 -1
  165. data/test/workos/test_agents.rb +49 -0
  166. data/test/workos/test_agents_model_round_trip.rb +165 -0
  167. data/test/workos/test_api_keys_model_round_trip.rb +307 -0
  168. data/test/workos/test_authorization_model_round_trip.rb +237 -0
  169. data/test/workos/test_base_client.rb +27 -0
  170. data/test/workos/test_client_api_model_round_trip.rb +31 -0
  171. data/test/workos/test_connect_model_round_trip.rb +175 -0
  172. data/test/workos/test_directory_sync_model_round_trip.rb +579 -0
  173. data/test/workos/test_feature_flags_model_round_trip.rb +580 -0
  174. data/test/workos/test_groups_model_round_trip.rb +56 -0
  175. data/test/workos/test_multi_factor_auth_model_round_trip.rb +192 -0
  176. data/test/workos/test_organization_domains_model_round_trip.rb +260 -0
  177. data/test/workos/test_organization_membership_model_round_trip.rb +89 -0
  178. data/test/workos/test_organizations.rb +9 -1
  179. data/test/workos/test_organizations_model_round_trip.rb +602 -0
  180. data/test/workos/test_pipes_model_round_trip.rb +40 -4
  181. data/test/workos/test_pipes_provider_model_round_trip.rb +75 -0
  182. data/test/workos/test_shared_model_round_trip.rb +787 -0
  183. data/test/workos/test_sso_model_round_trip.rb +422 -0
  184. data/test/workos/test_user_management.rb +16 -0
  185. data/test/workos/test_user_management_model_round_trip.rb +1501 -0
  186. data/test/workos/test_vault_model_round_trip.rb +571 -0
  187. data/test/workos/test_widgets.rb +2 -2
  188. data/test/workos/test_widgets_model_round_trip.rb +30 -0
  189. metadata +118 -19
  190. data/lib/workos/admin_portal/domain_verification_intent_options.rb +0 -18
  191. data/lib/workos/admin_portal/intent_options.rb +0 -22
  192. data/lib/workos/admin_portal/sso_intent_options.rb +0 -22
  193. data/lib/workos/sso/connection_option.rb +0 -18
  194. data/rbi/workos/intent_options.rbi +0 -30
  195. data/test/workos/test_model_round_trip.rb +0 -6
@@ -386,6 +386,243 @@ class AuthorizationModelRoundTripTest < Minitest::Test
386
386
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
387
387
  end
388
388
 
389
+ def test_permission_created_round_trip
390
+ fixture = {
391
+ "object" => "event",
392
+ "id" => "stub",
393
+ "event" => "permission.created",
394
+ "data" => {},
395
+ "created_at" => "stub",
396
+ "context" => {}
397
+ }
398
+ model = WorkOS::PermissionCreated.new(fixture.to_json)
399
+ json = model.to_h
400
+ assert_kind_of Hash, json
401
+ assert_equal fixture["id"], json[:id]
402
+ assert_equal fixture["created_at"], json[:created_at]
403
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
404
+ end
405
+
406
+ def test_permission_created_data_round_trip
407
+ fixture = {
408
+ "object" => "permission",
409
+ "id" => "stub",
410
+ "slug" => "stub",
411
+ "name" => "stub",
412
+ "description" => nil,
413
+ "system" => true,
414
+ "resource_type_slug" => "stub",
415
+ "created_at" => "stub",
416
+ "updated_at" => "stub"
417
+ }
418
+ model = WorkOS::PermissionCreatedData.new(fixture.to_json)
419
+ json = model.to_h
420
+ assert_kind_of Hash, json
421
+ assert_equal fixture["id"], json[:id]
422
+ assert_equal fixture["slug"], json[:slug]
423
+ assert_equal fixture["name"], json[:name]
424
+ assert_nil json[:description]
425
+ assert_equal fixture["system"], json[:system]
426
+ assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
427
+ assert_equal fixture["created_at"], json[:created_at]
428
+ assert_equal fixture["updated_at"], json[:updated_at]
429
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
430
+ end
431
+
432
+ def test_permission_deleted_round_trip
433
+ fixture = {
434
+ "object" => "event",
435
+ "id" => "stub",
436
+ "event" => "permission.deleted",
437
+ "data" => {},
438
+ "created_at" => "stub",
439
+ "context" => {}
440
+ }
441
+ model = WorkOS::PermissionDeleted.new(fixture.to_json)
442
+ json = model.to_h
443
+ assert_kind_of Hash, json
444
+ assert_equal fixture["id"], json[:id]
445
+ assert_equal fixture["created_at"], json[:created_at]
446
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
447
+ end
448
+
449
+ def test_permission_deleted_data_round_trip
450
+ fixture = {
451
+ "object" => "permission",
452
+ "id" => "stub",
453
+ "slug" => "stub",
454
+ "name" => "stub",
455
+ "description" => nil,
456
+ "system" => true,
457
+ "resource_type_slug" => "stub",
458
+ "created_at" => "stub",
459
+ "updated_at" => "stub"
460
+ }
461
+ model = WorkOS::PermissionDeletedData.new(fixture.to_json)
462
+ json = model.to_h
463
+ assert_kind_of Hash, json
464
+ assert_equal fixture["id"], json[:id]
465
+ assert_equal fixture["slug"], json[:slug]
466
+ assert_equal fixture["name"], json[:name]
467
+ assert_nil json[:description]
468
+ assert_equal fixture["system"], json[:system]
469
+ assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
470
+ assert_equal fixture["created_at"], json[:created_at]
471
+ assert_equal fixture["updated_at"], json[:updated_at]
472
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
473
+ end
474
+
475
+ def test_permission_updated_round_trip
476
+ fixture = {
477
+ "object" => "event",
478
+ "id" => "stub",
479
+ "event" => "permission.updated",
480
+ "data" => {},
481
+ "created_at" => "stub",
482
+ "context" => {}
483
+ }
484
+ model = WorkOS::PermissionUpdated.new(fixture.to_json)
485
+ json = model.to_h
486
+ assert_kind_of Hash, json
487
+ assert_equal fixture["id"], json[:id]
488
+ assert_equal fixture["created_at"], json[:created_at]
489
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
490
+ end
491
+
492
+ def test_permission_updated_data_round_trip
493
+ fixture = {
494
+ "object" => "permission",
495
+ "id" => "stub",
496
+ "slug" => "stub",
497
+ "name" => "stub",
498
+ "description" => nil,
499
+ "system" => true,
500
+ "resource_type_slug" => "stub",
501
+ "created_at" => "stub",
502
+ "updated_at" => "stub"
503
+ }
504
+ model = WorkOS::PermissionUpdatedData.new(fixture.to_json)
505
+ json = model.to_h
506
+ assert_kind_of Hash, json
507
+ assert_equal fixture["id"], json[:id]
508
+ assert_equal fixture["slug"], json[:slug]
509
+ assert_equal fixture["name"], json[:name]
510
+ assert_nil json[:description]
511
+ assert_equal fixture["system"], json[:system]
512
+ assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
513
+ assert_equal fixture["created_at"], json[:created_at]
514
+ assert_equal fixture["updated_at"], json[:updated_at]
515
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
516
+ end
517
+
518
+ def test_role_created_round_trip
519
+ fixture = {
520
+ "object" => "event",
521
+ "id" => "stub",
522
+ "event" => "role.created",
523
+ "data" => {},
524
+ "created_at" => "stub",
525
+ "context" => {}
526
+ }
527
+ model = WorkOS::RoleCreated.new(fixture.to_json)
528
+ json = model.to_h
529
+ assert_kind_of Hash, json
530
+ assert_equal fixture["id"], json[:id]
531
+ assert_equal fixture["created_at"], json[:created_at]
532
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
533
+ end
534
+
535
+ def test_role_created_data_round_trip
536
+ fixture = {
537
+ "object" => "role",
538
+ "slug" => "stub",
539
+ "resource_type_slug" => "stub",
540
+ "permissions" => [],
541
+ "created_at" => "stub",
542
+ "updated_at" => "stub"
543
+ }
544
+ model = WorkOS::RoleCreatedData.new(fixture.to_json)
545
+ json = model.to_h
546
+ assert_kind_of Hash, json
547
+ assert_equal fixture["slug"], json[:slug]
548
+ assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
549
+ assert_equal fixture["created_at"], json[:created_at]
550
+ assert_equal fixture["updated_at"], json[:updated_at]
551
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
552
+ end
553
+
554
+ def test_role_deleted_round_trip
555
+ fixture = {
556
+ "object" => "event",
557
+ "id" => "stub",
558
+ "event" => "role.deleted",
559
+ "data" => {},
560
+ "created_at" => "stub",
561
+ "context" => {}
562
+ }
563
+ model = WorkOS::RoleDeleted.new(fixture.to_json)
564
+ json = model.to_h
565
+ assert_kind_of Hash, json
566
+ assert_equal fixture["id"], json[:id]
567
+ assert_equal fixture["created_at"], json[:created_at]
568
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
569
+ end
570
+
571
+ def test_role_deleted_data_round_trip
572
+ fixture = {
573
+ "object" => "role",
574
+ "slug" => "stub",
575
+ "resource_type_slug" => "stub",
576
+ "permissions" => [],
577
+ "created_at" => "stub",
578
+ "updated_at" => "stub"
579
+ }
580
+ model = WorkOS::RoleDeletedData.new(fixture.to_json)
581
+ json = model.to_h
582
+ assert_kind_of Hash, json
583
+ assert_equal fixture["slug"], json[:slug]
584
+ assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
585
+ assert_equal fixture["created_at"], json[:created_at]
586
+ assert_equal fixture["updated_at"], json[:updated_at]
587
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
588
+ end
589
+
590
+ def test_role_updated_round_trip
591
+ fixture = {
592
+ "object" => "event",
593
+ "id" => "stub",
594
+ "event" => "role.updated",
595
+ "data" => {},
596
+ "created_at" => "stub",
597
+ "context" => {}
598
+ }
599
+ model = WorkOS::RoleUpdated.new(fixture.to_json)
600
+ json = model.to_h
601
+ assert_kind_of Hash, json
602
+ assert_equal fixture["id"], json[:id]
603
+ assert_equal fixture["created_at"], json[:created_at]
604
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
605
+ end
606
+
607
+ def test_role_updated_data_round_trip
608
+ fixture = {
609
+ "object" => "role",
610
+ "slug" => "stub",
611
+ "resource_type_slug" => "stub",
612
+ "permissions" => [],
613
+ "created_at" => "stub",
614
+ "updated_at" => "stub"
615
+ }
616
+ model = WorkOS::RoleUpdatedData.new(fixture.to_json)
617
+ json = model.to_h
618
+ assert_kind_of Hash, json
619
+ assert_equal fixture["slug"], json[:slug]
620
+ assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
621
+ assert_equal fixture["created_at"], json[:created_at]
622
+ assert_equal fixture["updated_at"], json[:updated_at]
623
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
624
+ end
625
+
389
626
  def test_user_role_assignment_resource_round_trip
390
627
  fixture = {
391
628
  "id" => "stub",
@@ -119,6 +119,33 @@ class BaseClientTest < Minitest::Test
119
119
  assert_equal "idem_123", request["Idempotency-Key"]
120
120
  end
121
121
 
122
+ # The body is serialized verbatim (no `.compact`), so an explicit `nil` is
123
+ # sent as JSON `null` — this is what lets generated methods clear a nullable
124
+ # field. Omission is handled upstream in the generated method, not here.
125
+ def test_put_request_serializes_explicit_nil_as_json_null
126
+ request = @client.put_request(path: "/widgets/w_1", auth: true, body: {"external_id" => nil})
127
+
128
+ assert_equal({"external_id" => nil}, JSON.parse(request.body))
129
+ end
130
+
131
+ def test_post_request_serializes_explicit_nil_as_json_null
132
+ request = @client.post_request(path: "/widgets", auth: true, body: {"external_id" => nil})
133
+
134
+ assert_equal({"external_id" => nil}, JSON.parse(request.body))
135
+ end
136
+
137
+ def test_patch_request_serializes_explicit_nil_as_json_null
138
+ request = @client.patch_request(path: "/widgets/w_1", auth: true, body: {"external_id" => nil})
139
+
140
+ assert_equal({"external_id" => nil}, JSON.parse(request.body))
141
+ end
142
+
143
+ def test_delete_request_serializes_explicit_nil_as_json_null
144
+ request = @client.delete_request(path: "/widgets/w_1", auth: true, body: {"external_id" => nil})
145
+
146
+ assert_equal({"external_id" => nil}, JSON.parse(request.body))
147
+ end
148
+
122
149
  def test_retry_path_generates_idempotency_key_for_mutating_requests
123
150
  stub_request(:post, "https://api.workos.com/widgets")
124
151
  .to_return({status: 500, body: '{"message":"retry"}'}, {status: 200, body: "{}"})
@@ -0,0 +1,31 @@
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 ClientApiModelRoundTripTest < Minitest::Test
8
+ def test_client_api_token_round_trip
9
+ fixture = {
10
+ "organization_id" => "stub",
11
+ "user_id" => "stub"
12
+ }
13
+ model = WorkOS::ClientApiToken.new(fixture.to_json)
14
+ json = model.to_h
15
+ assert_kind_of Hash, json
16
+ assert_equal fixture["organization_id"], json[:organization_id]
17
+ assert_equal fixture["user_id"], json[:user_id]
18
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
19
+ end
20
+
21
+ def test_client_api_token_response_round_trip
22
+ fixture = {
23
+ "token" => "stub"
24
+ }
25
+ model = WorkOS::ClientApiTokenResponse.new(fixture.to_json)
26
+ json = model.to_h
27
+ assert_kind_of Hash, json
28
+ assert_equal fixture["token"], json[:token]
29
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
30
+ end
31
+ end
@@ -5,6 +5,128 @@
5
5
  require "test_helper"
6
6
 
7
7
  class ConnectModelRoundTripTest < Minitest::Test
8
+ def test_user_object_round_trip
9
+ fixture = {
10
+ "id" => "stub",
11
+ "email" => "stub",
12
+ "first_name" => "stub",
13
+ "last_name" => "stub",
14
+ "name" => "stub",
15
+ "metadata" => {}
16
+ }
17
+ model = WorkOS::UserObject.new(fixture.to_json)
18
+ json = model.to_h
19
+ assert_kind_of Hash, json
20
+ assert_equal fixture["id"], json[:id]
21
+ assert_equal fixture["email"], json[:email]
22
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
23
+ end
24
+
25
+ def test_user_consent_option_round_trip
26
+ fixture = {
27
+ "claim" => "stub",
28
+ "type" => "enum",
29
+ "label" => "stub",
30
+ "choices" => []
31
+ }
32
+ model = WorkOS::UserConsentOption.new(fixture.to_json)
33
+ json = model.to_h
34
+ assert_kind_of Hash, json
35
+ assert_equal fixture["claim"], json[:claim]
36
+ assert_equal fixture["label"], json[:label]
37
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
38
+ end
39
+
40
+ def test_user_management_login_request_round_trip
41
+ fixture = {
42
+ "external_auth_id" => "stub",
43
+ "user" => {},
44
+ "user_consent_options" => []
45
+ }
46
+ model = WorkOS::UserManagementLoginRequest.new(fixture.to_json)
47
+ json = model.to_h
48
+ assert_kind_of Hash, json
49
+ assert_equal fixture["external_auth_id"], json[:external_auth_id]
50
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
51
+ end
52
+
53
+ def test_redirect_uri_input_round_trip
54
+ fixture = {
55
+ "uri" => "stub",
56
+ "default" => nil
57
+ }
58
+ model = WorkOS::RedirectUriInput.new(fixture.to_json)
59
+ json = model.to_h
60
+ assert_kind_of Hash, json
61
+ assert_equal fixture["uri"], json[:uri]
62
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
63
+ end
64
+
65
+ def test_create_oauth_application_round_trip
66
+ fixture = {
67
+ "name" => "stub",
68
+ "application_type" => "oauth",
69
+ "description" => nil,
70
+ "scopes" => nil,
71
+ "redirect_uris" => nil,
72
+ "uses_pkce" => nil,
73
+ "is_first_party" => true,
74
+ "organization_id" => nil
75
+ }
76
+ model = WorkOS::CreateOAuthApplication.new(fixture.to_json)
77
+ json = model.to_h
78
+ assert_kind_of Hash, json
79
+ assert_equal fixture["name"], json[:name]
80
+ assert_equal fixture["is_first_party"], json[:is_first_party]
81
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
82
+ end
83
+
84
+ def test_create_m2m_application_round_trip
85
+ fixture = {
86
+ "name" => "stub",
87
+ "application_type" => "m2m",
88
+ "description" => nil,
89
+ "scopes" => nil,
90
+ "organization_id" => "stub"
91
+ }
92
+ model = WorkOS::CreateM2MApplication.new(fixture.to_json)
93
+ json = model.to_h
94
+ assert_kind_of Hash, json
95
+ assert_equal fixture["name"], json[:name]
96
+ assert_equal fixture["organization_id"], json[:organization_id]
97
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
98
+ end
99
+
100
+ def test_update_oauth_application_round_trip
101
+ fixture = {
102
+ "name" => "stub",
103
+ "description" => nil,
104
+ "scopes" => nil,
105
+ "redirect_uris" => nil
106
+ }
107
+ model = WorkOS::UpdateOAuthApplication.new(fixture.to_json)
108
+ json = model.to_h
109
+ assert_kind_of Hash, json
110
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
111
+ end
112
+
113
+ def test_create_application_secret_round_trip
114
+ model = WorkOS::CreateApplicationSecret.new("{}")
115
+ json = model.to_h
116
+ assert_kind_of Hash, json
117
+ end
118
+
119
+ def test_external_auth_complete_response_round_trip
120
+ fixture = {
121
+ "redirect_uri" => "stub"
122
+ }
123
+ model = WorkOS::ExternalAuthCompleteResponse.new(fixture.to_json)
124
+ json = model.to_h
125
+ assert_kind_of Hash, json
126
+ assert_equal fixture["redirect_uri"], json[:redirect_uri]
127
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
128
+ end
129
+
8
130
  def test_connect_application_round_trip
9
131
  fixture = {
10
132
  "object" => "connect_application",
@@ -27,4 +149,57 @@ class ConnectModelRoundTripTest < Minitest::Test
27
149
  assert_equal fixture["updated_at"], json[:updated_at]
28
150
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
29
151
  end
152
+
153
+ def test_new_connect_application_secret_round_trip
154
+ fixture = {
155
+ "object" => "connect_application_secret",
156
+ "id" => "stub",
157
+ "secret_hint" => "stub",
158
+ "last_used_at" => nil,
159
+ "created_at" => "stub",
160
+ "updated_at" => "stub",
161
+ "secret" => "stub"
162
+ }
163
+ model = WorkOS::NewConnectApplicationSecret.new(fixture.to_json)
164
+ json = model.to_h
165
+ assert_kind_of Hash, json
166
+ assert_equal fixture["id"], json[:id]
167
+ assert_equal fixture["secret_hint"], json[:secret_hint]
168
+ assert_nil json[:last_used_at]
169
+ assert_equal fixture["created_at"], json[:created_at]
170
+ assert_equal fixture["updated_at"], json[:updated_at]
171
+ assert_equal fixture["secret"], json[:secret]
172
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
173
+ end
174
+
175
+ def test_user_consent_option_choice_round_trip
176
+ fixture = {
177
+ "value" => "stub",
178
+ "label" => "stub"
179
+ }
180
+ model = WorkOS::UserConsentOptionChoice.new(fixture.to_json)
181
+ json = model.to_h
182
+ assert_kind_of Hash, json
183
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
184
+ end
185
+
186
+ def test_application_credentials_list_item_round_trip
187
+ fixture = {
188
+ "object" => "connect_application_secret",
189
+ "id" => "stub",
190
+ "secret_hint" => "stub",
191
+ "last_used_at" => nil,
192
+ "created_at" => "stub",
193
+ "updated_at" => "stub"
194
+ }
195
+ model = WorkOS::ApplicationCredentialsListItem.new(fixture.to_json)
196
+ json = model.to_h
197
+ assert_kind_of Hash, json
198
+ assert_equal fixture["id"], json[:id]
199
+ assert_equal fixture["secret_hint"], json[:secret_hint]
200
+ assert_nil json[:last_used_at]
201
+ assert_equal fixture["created_at"], json[:created_at]
202
+ assert_equal fixture["updated_at"], json[:updated_at]
203
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
204
+ end
30
205
  end