workos 10.2.0 → 10.3.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 (224) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/block-generated-edits.yml +1 -1
  3. data/.github/workflows/ci.yml +2 -2
  4. data/.github/workflows/docs.yml +2 -2
  5. data/.github/workflows/lint.yml +2 -2
  6. data/.github/workflows/release-please.yml +3 -3
  7. data/.github/workflows/release.yml +2 -2
  8. data/.last-synced-sha +1 -1
  9. data/.oagen-manifest.json +311 -0
  10. data/.release-please-manifest.json +1 -1
  11. data/CHANGELOG.md +161 -0
  12. data/Gemfile.lock +2 -2
  13. data/lib/workos/agents/agent_blueprint.rb +43 -0
  14. data/lib/workos/agents/agent_blueprint_invocable_by.rb +7 -0
  15. data/lib/workos/agents/agent_blueprint_session_setting.rb +25 -0
  16. data/lib/workos/agents/agent_blueprints_create_request.rb +31 -0
  17. data/lib/workos/agents/agent_blueprints_create_request_invocable_by.rb +22 -0
  18. data/lib/workos/agents/agent_blueprints_create_request_session_setting.rb +7 -0
  19. data/lib/workos/agents/agent_blueprints_token_mint_token_request.rb +34 -0
  20. data/lib/workos/agents/agent_blueprints_token_validate_token_request.rb +18 -0
  21. data/lib/workos/agents/agent_blueprints_update_request.rb +31 -0
  22. data/lib/workos/agents/agent_blueprints_update_request_invocable_by.rb +7 -0
  23. data/lib/workos/agents/agent_blueprints_update_request_session_setting.rb +25 -0
  24. data/lib/workos/agents/agent_instance.rb +40 -0
  25. data/lib/workos/agents/agent_instance_session.rb +40 -0
  26. data/lib/workos/agents/agent_token.rb +40 -0
  27. data/lib/workos/agents/agent_token_validation.rb +40 -0
  28. data/lib/workos/agents.rb +395 -0
  29. data/lib/workos/api_keys/validate_api_key.rb +1 -12
  30. data/lib/workos/audit_logs.rb +23 -5
  31. data/lib/workos/authorization.rb +3 -3
  32. data/lib/workos/base_client.rb +14 -1
  33. data/lib/workos/client.rb +4 -0
  34. data/lib/workos/inflections.rb +15 -0
  35. data/lib/workos/organizations/create_it_contact.rb +18 -0
  36. data/lib/workos/organizations/invite_it_contact.rb +18 -0
  37. data/lib/workos/organizations/it_contact.rb +31 -0
  38. data/lib/workos/organizations/it_contact_list.rb +25 -0
  39. data/lib/workos/organizations/organization_input.rb +10 -1
  40. data/lib/workos/organizations/update_audit_logs_retention.rb +13 -1
  41. data/lib/workos/organizations.rb +110 -1
  42. data/lib/workos/platform_teams/create_team.rb +22 -0
  43. data/lib/workos/platform_teams/team.rb +37 -0
  44. data/lib/workos/platform_teams.rb +58 -0
  45. data/lib/workos/shared/agent_blueprint_created.rb +34 -0
  46. data/lib/workos/shared/agent_blueprint_created_data.rb +43 -0
  47. data/lib/workos/shared/agent_blueprint_created_data_invocable_by.rb +22 -0
  48. data/lib/workos/shared/agent_blueprint_created_data_session_setting.rb +25 -0
  49. data/lib/workos/shared/agent_blueprint_deleted.rb +34 -0
  50. data/lib/workos/shared/agent_blueprint_deleted_data.rb +31 -0
  51. data/lib/workos/shared/agent_blueprint_updated.rb +34 -0
  52. data/lib/workos/shared/agent_blueprint_updated_data.rb +7 -0
  53. data/lib/workos/shared/agent_blueprint_updated_data_invocable_by.rb +7 -0
  54. data/lib/workos/shared/agent_blueprint_updated_data_session_setting.rb +7 -0
  55. data/lib/workos/shared/agent_instance_created.rb +34 -0
  56. data/lib/workos/shared/agent_instance_created_data.rb +40 -0
  57. data/lib/workos/shared/agent_instance_deleted.rb +34 -0
  58. data/lib/workos/shared/agent_instance_deleted_data.rb +40 -0
  59. data/lib/workos/shared/agent_instance_session_created.rb +34 -0
  60. data/lib/workos/shared/agent_instance_session_created_data.rb +43 -0
  61. data/lib/workos/shared/agent_instance_session_revoked.rb +34 -0
  62. data/lib/workos/shared/agent_instance_session_revoked_data.rb +40 -0
  63. data/lib/workos/shared/resource_export_completed.rb +34 -0
  64. data/lib/workos/shared/resource_export_completed_data.rb +22 -0
  65. data/lib/workos/shared/resource_export_created.rb +34 -0
  66. data/lib/workos/shared/resource_export_created_data.rb +22 -0
  67. data/lib/workos/shared/resource_export_downloaded.rb +34 -0
  68. data/lib/workos/shared/resource_export_downloaded_data.rb +22 -0
  69. data/lib/workos/shared/resource_export_failed.rb +34 -0
  70. data/lib/workos/shared/resource_export_failed_data.rb +22 -0
  71. data/lib/workos/shared/waitlist_user.rb +8 -5
  72. data/lib/workos/sso/create_connection.rb +37 -0
  73. data/lib/workos/sso/create_connection_attribute_maps.rb +22 -0
  74. data/lib/workos/sso/create_connection_key_pair.rb +22 -0
  75. data/lib/workos/sso/create_connection_oidc_options.rb +43 -0
  76. data/lib/workos/sso/create_connection_saml_options.rb +40 -0
  77. data/lib/workos/sso/create_connection_standard_attributes.rb +34 -0
  78. data/lib/workos/sso/create_saml_idp_signing_certificate.rb +18 -0
  79. data/lib/workos/sso/patch_connection.rb +34 -0
  80. data/lib/workos/sso/patch_connection_attribute_maps.rb +22 -0
  81. data/lib/workos/sso/patch_connection_oidc_options.rb +40 -0
  82. data/lib/workos/sso/patch_connection_saml_options.rb +31 -0
  83. data/lib/workos/sso/patch_connection_standard_attributes.rb +7 -0
  84. data/lib/workos/sso/saml_idp_signing_certificate.rb +34 -0
  85. data/lib/workos/sso/saml_idp_signing_certificate_list.rb +22 -0
  86. data/lib/workos/sso/saml_sp_encryption_certificate.rb +34 -0
  87. data/lib/workos/sso/saml_sp_encryption_certificate_list.rb +22 -0
  88. data/lib/workos/sso/saml_sp_signing_certificate.rb +34 -0
  89. data/lib/workos/sso/token_query.rb +11 -2
  90. data/lib/workos/sso.rb +305 -4
  91. data/lib/workos/types/agent_blueprints_token_mint_token_request_type.rb +15 -0
  92. data/lib/workos/types/agent_instance_created_data_type.rb +13 -0
  93. data/lib/workos/types/agent_instance_deleted_data_type.rb +9 -0
  94. data/lib/workos/types/agent_instance_session_status.rb +14 -0
  95. data/lib/workos/types/agent_instance_type.rb +9 -0
  96. data/lib/workos/types/authenticate_response_authentication_method.rb +1 -4
  97. data/lib/workos/types/connection_activated_data_connection_type.rb +1 -4
  98. data/lib/workos/types/connection_type.rb +1 -4
  99. data/lib/workos/types/connections_connection_type.rb +1 -4
  100. data/lib/workos/types/create_connection_oidc_options_id_token_signature_algorithm.rb +24 -0
  101. data/lib/workos/types/create_connection_oidc_options_token_authentication_method.rb +14 -0
  102. data/lib/workos/types/create_webhook_endpoint_events.rb +8 -1
  103. data/lib/workos/types/invite_it_contact_intents.rb +16 -0
  104. data/lib/workos/types/patch_connection_oidc_options_id_token_signature_algorithm.rb +9 -0
  105. data/lib/workos/types/patch_connection_oidc_options_token_authentication_method.rb +9 -0
  106. data/lib/workos/types/resource_export_completed_data_resource_type.rb +16 -0
  107. data/lib/workos/types/resource_export_created_data_resource_type.rb +9 -0
  108. data/lib/workos/types/resource_export_downloaded_data_resource_type.rb +9 -0
  109. data/lib/workos/types/resource_export_failed_data_resource_type.rb +9 -0
  110. data/lib/workos/types/session_created_data_status.rb +1 -6
  111. data/lib/workos/types/session_revoked_data_status.rb +1 -1
  112. data/lib/workos/types/sso_grant_type.rb +13 -0
  113. data/lib/workos/types/team_production_state.rb +15 -0
  114. data/lib/workos/types/token_query_grant_type.rb +9 -0
  115. data/lib/workos/types/update_audit_logs_retention_retention_period.rb +32 -0
  116. data/lib/workos/types/user_identities_get_item_provider.rb +1 -4
  117. data/lib/workos/types/user_management_waitlists_state.rb +14 -0
  118. data/lib/workos/types/user_sessions_status.rb +1 -1
  119. data/lib/workos/types/waitlist_entry_state.rb +9 -0
  120. data/lib/workos/types/waitlist_user_state.rb +1 -6
  121. data/lib/workos/user_management/authentication_oauth_failed_data.rb +5 -2
  122. data/lib/workos/user_management/authentication_oauth_succeeded_data.rb +5 -2
  123. data/lib/workos/user_management/create_password_reset_token.rb +1 -12
  124. data/lib/workos/user_management/create_waitlist_entry.rb +25 -0
  125. data/lib/workos/user_management/email_completion_session_authenticate_request.rb +43 -0
  126. data/lib/workos/user_management/waitlist.rb +28 -0
  127. data/lib/workos/user_management/waitlist_entry.rb +43 -0
  128. data/lib/workos/user_management.rb +176 -0
  129. data/lib/workos/version.rb +1 -1
  130. data/lib/workos.rb +1 -0
  131. data/rbi/workos/agent_blueprint.rbi +72 -0
  132. data/rbi/workos/agent_blueprint_created.rbi +54 -0
  133. data/rbi/workos/agent_blueprint_created_data.rbi +72 -0
  134. data/rbi/workos/agent_blueprint_created_data_invocable_by.rbi +30 -0
  135. data/rbi/workos/agent_blueprint_created_data_session_setting.rbi +36 -0
  136. data/rbi/workos/agent_blueprint_deleted.rbi +54 -0
  137. data/rbi/workos/agent_blueprint_deleted_data.rbi +48 -0
  138. data/rbi/workos/agent_blueprint_invocable_by.rbi +30 -0
  139. data/rbi/workos/agent_blueprint_session_setting.rbi +36 -0
  140. data/rbi/workos/agent_blueprint_updated.rbi +54 -0
  141. data/rbi/workos/agent_blueprint_updated_data.rbi +72 -0
  142. data/rbi/workos/agent_blueprint_updated_data_invocable_by.rbi +30 -0
  143. data/rbi/workos/agent_blueprint_updated_data_session_setting.rbi +36 -0
  144. data/rbi/workos/agent_blueprints_create_request.rbi +48 -0
  145. data/rbi/workos/agent_blueprints_create_request_invocable_by.rbi +30 -0
  146. data/rbi/workos/agent_blueprints_create_request_session_setting.rbi +36 -0
  147. data/rbi/workos/agent_blueprints_token_mint_token_request.rbi +54 -0
  148. data/rbi/workos/agent_blueprints_token_validate_token_request.rbi +24 -0
  149. data/rbi/workos/agent_blueprints_update_request.rbi +48 -0
  150. data/rbi/workos/agent_blueprints_update_request_invocable_by.rbi +30 -0
  151. data/rbi/workos/agent_blueprints_update_request_session_setting.rbi +36 -0
  152. data/rbi/workos/agent_instance.rbi +66 -0
  153. data/rbi/workos/agent_instance_created.rbi +54 -0
  154. data/rbi/workos/agent_instance_created_data.rbi +66 -0
  155. data/rbi/workos/agent_instance_deleted.rbi +54 -0
  156. data/rbi/workos/agent_instance_deleted_data.rbi +66 -0
  157. data/rbi/workos/agent_instance_session.rbi +66 -0
  158. data/rbi/workos/agent_instance_session_created.rbi +54 -0
  159. data/rbi/workos/agent_instance_session_created_data.rbi +72 -0
  160. data/rbi/workos/agent_instance_session_revoked.rbi +54 -0
  161. data/rbi/workos/agent_instance_session_revoked_data.rbi +66 -0
  162. data/rbi/workos/agent_token.rbi +66 -0
  163. data/rbi/workos/agent_token_validation.rbi +66 -0
  164. data/rbi/workos/agents.rbi +133 -0
  165. data/rbi/workos/audit_logs.rbi +26 -2
  166. data/rbi/workos/authentication_oauth_failed_data.rbi +6 -0
  167. data/rbi/workos/authentication_oauth_succeeded_data.rbi +6 -0
  168. data/rbi/workos/client.rbi +3 -0
  169. data/rbi/workos/create_connection.rbi +60 -0
  170. data/rbi/workos/create_connection_attribute_maps.rbi +30 -0
  171. data/rbi/workos/create_connection_key_pair.rbi +30 -0
  172. data/rbi/workos/create_connection_oidc_options.rbi +72 -0
  173. data/rbi/workos/create_connection_saml_options.rbi +66 -0
  174. data/rbi/workos/create_connection_standard_attributes.rbi +54 -0
  175. data/rbi/workos/create_it_contact.rbi +24 -0
  176. data/rbi/workos/create_saml_idp_signing_certificate.rbi +24 -0
  177. data/rbi/workos/create_team.rbi +30 -0
  178. data/rbi/workos/create_waitlist_entry.rbi +36 -0
  179. data/rbi/workos/email_completion_session_authenticate_request.rbi +72 -0
  180. data/rbi/workos/invite_it_contact.rbi +24 -0
  181. data/rbi/workos/it_contact.rbi +48 -0
  182. data/rbi/workos/organizations.rbi +45 -0
  183. data/rbi/workos/patch_connection.rbi +54 -0
  184. data/rbi/workos/patch_connection_attribute_maps.rbi +30 -0
  185. data/rbi/workos/patch_connection_oidc_options.rbi +66 -0
  186. data/rbi/workos/patch_connection_saml_options.rbi +48 -0
  187. data/rbi/workos/patch_connection_standard_attributes.rbi +54 -0
  188. data/rbi/workos/platform_teams.rbi +30 -0
  189. data/rbi/workos/resource_export_completed.rbi +54 -0
  190. data/rbi/workos/resource_export_completed_data.rbi +30 -0
  191. data/rbi/workos/resource_export_created.rbi +54 -0
  192. data/rbi/workos/resource_export_created_data.rbi +30 -0
  193. data/rbi/workos/resource_export_downloaded.rbi +54 -0
  194. data/rbi/workos/resource_export_downloaded_data.rbi +30 -0
  195. data/rbi/workos/resource_export_failed.rbi +54 -0
  196. data/rbi/workos/resource_export_failed_data.rbi +30 -0
  197. data/rbi/workos/saml_idp_signing_certificate.rbi +54 -0
  198. data/rbi/workos/saml_idp_signing_certificate_list.rbi +30 -0
  199. data/rbi/workos/saml_sp_encryption_certificate.rbi +54 -0
  200. data/rbi/workos/saml_sp_encryption_certificate_list.rbi +30 -0
  201. data/rbi/workos/saml_sp_signing_certificate.rbi +54 -0
  202. data/rbi/workos/sso.rbi +155 -2
  203. data/rbi/workos/team.rbi +60 -0
  204. data/rbi/workos/token_query.rbi +20 -2
  205. data/rbi/workos/update_audit_logs_retention.rbi +8 -2
  206. data/rbi/workos/user_management.rbi +64 -0
  207. data/rbi/workos/waitlist.rbi +42 -0
  208. data/rbi/workos/waitlist_entry.rbi +72 -0
  209. data/rbi/workos/waitlist_user.rbi +12 -6
  210. data/test/workos/test_agents.rb +105 -1
  211. data/test/workos/test_agents_model_round_trip.rb +245 -0
  212. data/test/workos/test_audit_logs.rb +11 -2
  213. data/test/workos/test_authorization.rb +6 -6
  214. data/test/workos/test_base_client.rb +155 -0
  215. data/test/workos/test_organizations.rb +41 -1
  216. data/test/workos/test_organizations_model_round_trip.rb +40 -1
  217. data/test/workos/test_platform_teams.rb +41 -0
  218. data/test/workos/test_platform_teams_model_round_trip.rb +41 -0
  219. data/test/workos/test_shared_model_round_trip.rb +449 -2
  220. data/test/workos/test_sso.rb +108 -2
  221. data/test/workos/test_sso_model_round_trip.rb +262 -2
  222. data/test/workos/test_user_management.rb +56 -0
  223. data/test/workos/test_user_management_model_round_trip.rb +78 -2
  224. metadata +160 -1
@@ -5,19 +5,197 @@
5
5
  require "test_helper"
6
6
 
7
7
  class SsoModelRoundTripTest < Minitest::Test
8
+ def test_create_connection_key_pair_round_trip
9
+ fixture = {
10
+ "key" => "stub",
11
+ "cert" => "stub"
12
+ }
13
+ model = WorkOS::CreateConnectionKeyPair.new(fixture.to_json)
14
+ json = model.to_h
15
+ assert_kind_of Hash, json
16
+ assert_equal fixture["key"], json[:key]
17
+ assert_equal fixture["cert"], json[:cert]
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_create_connection_saml_options_round_trip
22
+ fixture = {
23
+ "idp_metadata_url" => "stub",
24
+ "acs_url" => "stub",
25
+ "sp_entity_id" => "stub",
26
+ "idp_entity_id" => "stub",
27
+ "idp_sso_url" => "stub",
28
+ "idp_signing_certs" => [],
29
+ "sp_signing_key_pair" => {},
30
+ "sp_encryption_key_pairs" => []
31
+ }
32
+ model = WorkOS::CreateConnectionSAMLOptions.new(fixture.to_json)
33
+ json = model.to_h
34
+ assert_kind_of Hash, json
35
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
36
+ end
37
+
38
+ def test_create_connection_oidc_options_round_trip
39
+ fixture = {
40
+ "discovery_endpoint" => "stub",
41
+ "client_id" => "stub",
42
+ "client_secret" => "stub",
43
+ "redirect_uri" => "stub",
44
+ "pkce" => true,
45
+ "token_authentication_method" => "stub",
46
+ "jwt_signing_key_pair" => {},
47
+ "id_token_signature_algorithm" => "stub",
48
+ "fetch_user_info" => true
49
+ }
50
+ model = WorkOS::CreateConnectionOIDCOptions.new(fixture.to_json)
51
+ json = model.to_h
52
+ assert_kind_of Hash, json
53
+ assert_equal fixture["discovery_endpoint"], json[:discovery_endpoint]
54
+ assert_equal fixture["client_id"], json[:client_id]
55
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
56
+ end
57
+
58
+ def test_create_connection_standard_attributes_round_trip
59
+ fixture = {
60
+ "idp_id" => "stub",
61
+ "email" => "stub",
62
+ "first_name" => "stub",
63
+ "last_name" => "stub",
64
+ "groups" => nil,
65
+ "name" => nil
66
+ }
67
+ model = WorkOS::CreateConnectionStandardAttributes.new(fixture.to_json)
68
+ json = model.to_h
69
+ assert_kind_of Hash, json
70
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
71
+ end
72
+
73
+ def test_create_connection_attribute_maps_round_trip
74
+ fixture = {
75
+ "standard_attributes" => {},
76
+ "custom_attributes" => {}
77
+ }
78
+ model = WorkOS::CreateConnectionAttributeMaps.new(fixture.to_json)
79
+ json = model.to_h
80
+ assert_kind_of Hash, json
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_connection_round_trip
85
+ fixture = {
86
+ "organization_id" => "stub",
87
+ "name" => "stub",
88
+ "external_id" => "stub",
89
+ "connection_type" => "stub",
90
+ "attribute_maps" => {},
91
+ "saml_options" => {},
92
+ "oidc_options" => {}
93
+ }
94
+ model = WorkOS::CreateConnection.new(fixture.to_json)
95
+ json = model.to_h
96
+ assert_kind_of Hash, json
97
+ assert_equal fixture["organization_id"], json[:organization_id]
98
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
99
+ end
100
+
101
+ def test_patch_connection_saml_options_round_trip
102
+ fixture = {
103
+ "idp_metadata_url" => nil,
104
+ "acs_url" => nil,
105
+ "sp_entity_id" => nil,
106
+ "idp_entity_id" => "stub",
107
+ "idp_sso_url" => "stub"
108
+ }
109
+ model = WorkOS::PatchConnectionSAMLOptions.new(fixture.to_json)
110
+ json = model.to_h
111
+ assert_kind_of Hash, json
112
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
113
+ end
114
+
115
+ def test_patch_connection_oidc_options_round_trip
116
+ fixture = {
117
+ "discovery_endpoint" => "stub",
118
+ "client_id" => "stub",
119
+ "client_secret" => "stub",
120
+ "redirect_uri" => nil,
121
+ "pkce" => true,
122
+ "token_authentication_method" => "stub",
123
+ "id_token_signature_algorithm" => "stub",
124
+ "fetch_user_info" => true
125
+ }
126
+ model = WorkOS::PatchConnectionOIDCOptions.new(fixture.to_json)
127
+ json = model.to_h
128
+ assert_kind_of Hash, json
129
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
130
+ end
131
+
132
+ def test_patch_connection_standard_attributes_round_trip
133
+ fixture = {
134
+ "idp_id" => "stub",
135
+ "email" => "stub",
136
+ "first_name" => "stub",
137
+ "last_name" => "stub",
138
+ "groups" => nil,
139
+ "name" => nil
140
+ }
141
+ model = WorkOS::PatchConnectionStandardAttributes.new(fixture.to_json)
142
+ json = model.to_h
143
+ assert_kind_of Hash, json
144
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
145
+ end
146
+
147
+ def test_patch_connection_attribute_maps_round_trip
148
+ fixture = {
149
+ "standard_attributes" => {},
150
+ "custom_attributes" => {}
151
+ }
152
+ model = WorkOS::PatchConnectionAttributeMaps.new(fixture.to_json)
153
+ json = model.to_h
154
+ assert_kind_of Hash, json
155
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
156
+ end
157
+
158
+ def test_patch_connection_round_trip
159
+ fixture = {
160
+ "name" => "stub",
161
+ "external_id" => nil,
162
+ "connection_type" => "stub",
163
+ "attribute_maps" => {},
164
+ "saml_options" => {},
165
+ "oidc_options" => {}
166
+ }
167
+ model = WorkOS::PatchConnection.new(fixture.to_json)
168
+ json = model.to_h
169
+ assert_kind_of Hash, json
170
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
171
+ end
172
+
173
+ def test_create_saml_idp_signing_certificate_round_trip
174
+ fixture = {
175
+ "value" => "stub"
176
+ }
177
+ model = WorkOS::CreateSAMLIdpSigningCertificate.new(fixture.to_json)
178
+ json = model.to_h
179
+ assert_kind_of Hash, json
180
+ assert_equal fixture["value"], json[:value]
181
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
182
+ end
183
+
8
184
  def test_token_query_round_trip
9
185
  fixture = {
10
186
  "client_id" => "stub",
11
187
  "client_secret" => "stub",
12
188
  "code" => "stub",
13
- "grant_type" => "authorization_code"
189
+ "grant_type" => "stub",
190
+ "subject_token" => "stub",
191
+ "subject_token_type" => "urn:ietf:params:oauth:token-type:id_token",
192
+ "organization_id" => "stub"
14
193
  }
15
194
  model = WorkOS::TokenQuery.new(fixture.to_json)
16
195
  json = model.to_h
17
196
  assert_kind_of Hash, json
18
197
  assert_equal fixture["client_id"], json[:client_id]
19
198
  assert_equal fixture["client_secret"], json[:client_secret]
20
- assert_equal fixture["code"], json[:code]
21
199
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
22
200
  end
23
201
 
@@ -304,6 +482,88 @@ class SsoModelRoundTripTest < Minitest::Test
304
482
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
305
483
  end
306
484
 
485
+ def test_saml_idp_signing_certificate_round_trip
486
+ fixture = {
487
+ "object" => "saml_idp_signing_certificate",
488
+ "id" => "stub",
489
+ "value" => "stub",
490
+ "not_before" => nil,
491
+ "not_after" => nil,
492
+ "created_at" => "stub"
493
+ }
494
+ model = WorkOS::SAMLIdpSigningCertificate.new(fixture.to_json)
495
+ json = model.to_h
496
+ assert_kind_of Hash, json
497
+ assert_equal fixture["id"], json[:id]
498
+ assert_equal fixture["value"], json[:value]
499
+ assert_nil json[:not_before]
500
+ assert_nil json[:not_after]
501
+ assert_equal fixture["created_at"], json[:created_at]
502
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
503
+ end
504
+
505
+ def test_saml_idp_signing_certificate_list_round_trip
506
+ fixture = {
507
+ "object" => "list",
508
+ "data" => []
509
+ }
510
+ model = WorkOS::SAMLIdpSigningCertificateList.new(fixture.to_json)
511
+ json = model.to_h
512
+ assert_kind_of Hash, json
513
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
514
+ end
515
+
516
+ def test_saml_sp_encryption_certificate_round_trip
517
+ fixture = {
518
+ "object" => "saml_sp_encryption_certificate",
519
+ "id" => "stub",
520
+ "value" => "stub",
521
+ "not_before" => nil,
522
+ "not_after" => nil,
523
+ "created_at" => "stub"
524
+ }
525
+ model = WorkOS::SAMLSpEncryptionCertificate.new(fixture.to_json)
526
+ json = model.to_h
527
+ assert_kind_of Hash, json
528
+ assert_equal fixture["id"], json[:id]
529
+ assert_equal fixture["value"], json[:value]
530
+ assert_nil json[:not_before]
531
+ assert_nil json[:not_after]
532
+ assert_equal fixture["created_at"], json[:created_at]
533
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
534
+ end
535
+
536
+ def test_saml_sp_encryption_certificate_list_round_trip
537
+ fixture = {
538
+ "object" => "list",
539
+ "data" => []
540
+ }
541
+ model = WorkOS::SAMLSpEncryptionCertificateList.new(fixture.to_json)
542
+ json = model.to_h
543
+ assert_kind_of Hash, json
544
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
545
+ end
546
+
547
+ def test_saml_sp_signing_certificate_round_trip
548
+ fixture = {
549
+ "object" => "saml_sp_signing_certificate",
550
+ "id" => "stub",
551
+ "value" => "stub",
552
+ "not_before" => nil,
553
+ "not_after" => nil,
554
+ "created_at" => "stub"
555
+ }
556
+ model = WorkOS::SAMLSpSigningCertificate.new(fixture.to_json)
557
+ json = model.to_h
558
+ assert_kind_of Hash, json
559
+ assert_equal fixture["id"], json[:id]
560
+ assert_equal fixture["value"], json[:value]
561
+ assert_nil json[:not_before]
562
+ assert_nil json[:not_after]
563
+ assert_equal fixture["created_at"], json[:created_at]
564
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
565
+ end
566
+
307
567
  def test_sso_authorize_url_response_round_trip
308
568
  fixture = {
309
569
  "url" => "stub"
@@ -459,6 +459,55 @@ class UserManagementTest < Minitest::Test
459
459
  assert_nil result
460
460
  end
461
461
 
462
+ def test_delete_waitlist_entry_returns_expected_result
463
+ stub_request(:delete, %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub(\?|\z)})
464
+ .to_return(body: "{}", status: 200)
465
+ result = @client.user_management.delete_waitlist_entry(id: "stub")
466
+ assert_nil result
467
+ end
468
+
469
+ def test_create_waitlist_entry_approve_returns_expected_result
470
+ stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub/approve(\?|\z)})
471
+ .to_return(body: "{}", status: 200)
472
+ result = @client.user_management.create_waitlist_entry_approve(id: "stub")
473
+ refute_nil result
474
+ end
475
+
476
+ def test_create_waitlist_entry_deny_returns_expected_result
477
+ stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub/deny(\?|\z)})
478
+ .to_return(body: "{}", status: 200)
479
+ result = @client.user_management.create_waitlist_entry_deny(id: "stub")
480
+ refute_nil result
481
+ end
482
+
483
+ def test_list_waitlists_returns_expected_result
484
+ stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/waitlists(\?|\z)})
485
+ .to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
486
+ result = @client.user_management.list_waitlists
487
+ assert_kind_of WorkOS::Types::ListStruct, result
488
+ end
489
+
490
+ def test_get_waitlist_returns_expected_result
491
+ stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub(\?|\z)})
492
+ .to_return(body: "{}", status: 200)
493
+ result = @client.user_management.get_waitlist(id: "stub")
494
+ refute_nil result
495
+ end
496
+
497
+ def test_list_waitlist_entries_returns_expected_result
498
+ stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub/entries(\?|\z)})
499
+ .to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
500
+ result = @client.user_management.list_waitlist_entries(id: "stub")
501
+ assert_kind_of WorkOS::Types::ListStruct, result
502
+ end
503
+
504
+ def test_create_waitlist_entry_returns_expected_result
505
+ stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub/entries(\?|\z)})
506
+ .to_return(body: "{}", status: 200)
507
+ result = @client.user_management.create_waitlist_entry(id: "stub", email: "stub")
508
+ refute_nil result
509
+ end
510
+
462
511
  def test_list_user_api_keys_returns_expected_result
463
512
  stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users/stub/api_keys(\?|\z)})
464
513
  .to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
@@ -515,6 +564,13 @@ class UserManagementTest < Minitest::Test
515
564
  {name: :delete_redirect_uris, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/redirect_uris/stub(\?|\z)}, args: {id: "stub"}},
516
565
  {name: :list_user_authorized_applications, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/authorized_applications(\?|\z)}, args: {user_id: "stub"}},
517
566
  {name: :delete_user_authorized_application, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/authorized_applications/stub(\?|\z)}, args: {application_id: "stub", user_id: "stub"}},
567
+ {name: :delete_waitlist_entry, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub(\?|\z)}, args: {id: "stub"}},
568
+ {name: :create_waitlist_entry_approve, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub/approve(\?|\z)}, args: {id: "stub"}},
569
+ {name: :create_waitlist_entry_deny, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub/deny(\?|\z)}, args: {id: "stub"}},
570
+ {name: :list_waitlists, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/waitlists(\?|\z)}},
571
+ {name: :get_waitlist, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub(\?|\z)}, args: {id: "stub"}},
572
+ {name: :list_waitlist_entries, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub/entries(\?|\z)}, args: {id: "stub"}},
573
+ {name: :create_waitlist_entry, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub/entries(\?|\z)}, args: {id: "stub", email: "stub"}},
518
574
  {name: :list_user_api_keys, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/api_keys(\?|\z)}, args: {user_id: "stub"}},
519
575
  {name: :create_user_api_key, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/api_keys(\?|\z)}, args: {user_id: "stub", name: "stub", organization_id: "stub"}}
520
576
  ].each do |spec|
@@ -225,6 +225,19 @@ class UserManagementModelRoundTripTest < Minitest::Test
225
225
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
226
226
  end
227
227
 
228
+ def test_create_waitlist_entry_round_trip
229
+ fixture = {
230
+ "email" => "stub",
231
+ "additional_fields" => {},
232
+ "send_confirmation_email" => true
233
+ }
234
+ model = WorkOS::CreateWaitlistEntry.new(fixture.to_json)
235
+ json = model.to_h
236
+ assert_kind_of Hash, json
237
+ assert_equal fixture["email"], json[:email]
238
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
239
+ end
240
+
228
241
  def test_user_round_trip
229
242
  fixture = {
230
243
  "object" => "user",
@@ -683,7 +696,8 @@ class UserManagementModelRoundTripTest < Minitest::Test
683
696
  "user_agent" => nil,
684
697
  "user_id" => nil,
685
698
  "email" => nil,
686
- "error" => {}
699
+ "error" => {},
700
+ "provider" => "stub"
687
701
  }
688
702
  model = WorkOS::AuthenticationOAuthFailedData.new(fixture.to_json)
689
703
  json = model.to_h
@@ -732,7 +746,8 @@ class UserManagementModelRoundTripTest < Minitest::Test
732
746
  "ip_address" => nil,
733
747
  "user_agent" => nil,
734
748
  "user_id" => nil,
735
- "email" => "stub"
749
+ "email" => "stub",
750
+ "provider" => "stub"
736
751
  }
737
752
  model = WorkOS::AuthenticationOAuthSucceededData.new(fixture.to_json)
738
753
  json = model.to_h
@@ -2058,6 +2073,45 @@ class UserManagementModelRoundTripTest < Minitest::Test
2058
2073
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
2059
2074
  end
2060
2075
 
2076
+ def test_waitlist_round_trip
2077
+ fixture = {
2078
+ "object" => "waitlist",
2079
+ "id" => "stub",
2080
+ "created_at" => "stub",
2081
+ "updated_at" => "stub"
2082
+ }
2083
+ model = WorkOS::Waitlist.new(fixture.to_json)
2084
+ json = model.to_h
2085
+ assert_kind_of Hash, json
2086
+ assert_equal fixture["id"], json[:id]
2087
+ assert_equal fixture["created_at"], json[:created_at]
2088
+ assert_equal fixture["updated_at"], json[:updated_at]
2089
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
2090
+ end
2091
+
2092
+ def test_waitlist_entry_round_trip
2093
+ fixture = {
2094
+ "id" => "stub",
2095
+ "email" => "stub",
2096
+ "state" => "stub",
2097
+ "approved_at" => nil,
2098
+ "additional_fields" => {},
2099
+ "waitlist_id" => nil,
2100
+ "created_at" => "stub",
2101
+ "updated_at" => "stub",
2102
+ "object" => "waitlist_entry"
2103
+ }
2104
+ model = WorkOS::WaitlistEntry.new(fixture.to_json)
2105
+ json = model.to_h
2106
+ assert_kind_of Hash, json
2107
+ assert_equal fixture["id"], json[:id]
2108
+ assert_equal fixture["email"], json[:email]
2109
+ assert_nil json[:approved_at]
2110
+ assert_equal fixture["created_at"], json[:created_at]
2111
+ assert_equal fixture["updated_at"], json[:updated_at]
2112
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
2113
+ end
2114
+
2061
2115
  def test_jwks_response_round_trip
2062
2116
  fixture = {
2063
2117
  "keys" => []
@@ -2295,6 +2349,28 @@ class UserManagementModelRoundTripTest < Minitest::Test
2295
2349
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
2296
2350
  end
2297
2351
 
2352
+ def test_email_completion_session_authenticate_request_round_trip
2353
+ fixture = {
2354
+ "client_id" => "stub",
2355
+ "client_secret" => "stub",
2356
+ "grant_type" => "urn:workos:oauth:grant-type:email-completion",
2357
+ "email_completion_token" => "stub",
2358
+ "email" => "stub",
2359
+ "ip_address" => "stub",
2360
+ "device_id" => "stub",
2361
+ "user_agent" => "stub",
2362
+ "signals_id" => "stub"
2363
+ }
2364
+ model = WorkOS::EmailCompletionSessionAuthenticateRequest.new(fixture.to_json)
2365
+ json = model.to_h
2366
+ assert_kind_of Hash, json
2367
+ assert_equal fixture["client_id"], json[:client_id]
2368
+ assert_equal fixture["client_secret"], json[:client_secret]
2369
+ assert_equal fixture["email_completion_token"], json[:email_completion_token]
2370
+ assert_equal fixture["email"], json[:email]
2371
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
2372
+ end
2373
+
2298
2374
  def test_organization_selection_session_authenticate_request_round_trip
2299
2375
  fixture = {
2300
2376
  "client_id" => "stub",