workos 10.2.1 → 10.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 (292) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +2 -2
  3. data/.github/workflows/docs.yml +3 -3
  4. data/.github/workflows/lint.yml +2 -2
  5. data/.github/workflows/release-please.yml +3 -3
  6. data/.github/workflows/release.yml +2 -2
  7. data/.last-synced-sha +1 -1
  8. data/.oagen-manifest.json +393 -4
  9. data/.release-please-manifest.json +1 -1
  10. data/.ruby-version +1 -1
  11. data/CHANGELOG.md +328 -0
  12. data/Gemfile.lock +14 -14
  13. data/README.md +23 -0
  14. data/lib/workos/admin_portal.rb +2 -2
  15. data/lib/workos/agents/agent_blueprint.rb +43 -0
  16. data/lib/workos/agents/agent_blueprint_invocable_by.rb +7 -0
  17. data/lib/workos/agents/agent_blueprint_session_setting.rb +25 -0
  18. data/lib/workos/agents/agent_blueprints_create_request.rb +31 -0
  19. data/lib/workos/agents/agent_blueprints_create_request_invocable_by.rb +22 -0
  20. data/lib/workos/agents/agent_blueprints_create_request_session_setting.rb +7 -0
  21. data/lib/workos/agents/agent_blueprints_token_mint_token_request.rb +34 -0
  22. data/lib/workos/agents/agent_blueprints_token_validate_token_request.rb +18 -0
  23. data/lib/workos/agents/agent_blueprints_update_request.rb +31 -0
  24. data/lib/workos/agents/agent_blueprints_update_request_invocable_by.rb +7 -0
  25. data/lib/workos/agents/agent_blueprints_update_request_session_setting.rb +25 -0
  26. data/lib/workos/agents/agent_instance.rb +40 -0
  27. data/lib/workos/agents/agent_instance_session.rb +40 -0
  28. data/lib/workos/agents/agent_token.rb +40 -0
  29. data/lib/workos/agents/agent_token_validation.rb +40 -0
  30. data/lib/workos/agents.rb +399 -0
  31. data/lib/workos/audit_logs.rb +23 -5
  32. data/lib/workos/authorization.rb +3 -3
  33. data/lib/workos/base_client.rb +6 -2
  34. data/lib/workos/client.rb +4 -0
  35. data/lib/workos/configuration.rb +3 -2
  36. data/lib/workos/inflections.rb +17 -0
  37. data/lib/workos/multi_factor_auth.rb +1 -1
  38. data/lib/workos/organizations/create_it_contact.rb +18 -0
  39. data/lib/workos/organizations/invite_it_contact.rb +18 -0
  40. data/lib/workos/organizations/it_contact.rb +31 -0
  41. data/lib/workos/organizations/it_contact_list.rb +25 -0
  42. data/lib/workos/organizations/organization_input.rb +10 -1
  43. data/lib/workos/organizations/update_audit_logs_retention.rb +13 -1
  44. data/lib/workos/organizations.rb +110 -1
  45. data/lib/workos/pipes/connected_account.rb +9 -0
  46. data/lib/workos/pipes/create_data_integration.rb +3 -0
  47. data/lib/workos/pipes/data_integration.rb +3 -0
  48. data/lib/workos/pipes/data_integration_installation.rb +9 -0
  49. data/lib/workos/pipes/data_integrations_get_data_integration_authorize_url_request.rb +3 -0
  50. data/lib/workos/pipes/data_integrations_get_user_token_request.rb +11 -2
  51. data/lib/workos/pipes/data_integrations_list_response_data.rb +18 -3
  52. data/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb +9 -0
  53. data/lib/workos/pipes/data_integrations_upsert_api_key_request.rb +25 -1
  54. data/lib/workos/pipes/data_integrations_upsert_client_credentials_request.rb +6 -0
  55. data/lib/workos/pipes/data_integrations_vend_credentials_request.rb +11 -2
  56. data/lib/workos/pipes.rb +324 -17
  57. data/lib/workos/platform_teams/create_team.rb +22 -0
  58. data/lib/workos/platform_teams/team.rb +37 -0
  59. data/lib/workos/platform_teams.rb +58 -0
  60. data/lib/workos/session_manager.rb +11 -6
  61. data/lib/workos/shared/account_selection_required_error.rb +22 -0
  62. data/lib/workos/shared/agent_blueprint_created.rb +34 -0
  63. data/lib/workos/shared/agent_blueprint_created_data.rb +43 -0
  64. data/lib/workos/shared/agent_blueprint_created_data_invocable_by.rb +22 -0
  65. data/lib/workos/shared/agent_blueprint_created_data_session_setting.rb +25 -0
  66. data/lib/workos/shared/agent_blueprint_deleted.rb +34 -0
  67. data/lib/workos/shared/agent_blueprint_deleted_data.rb +31 -0
  68. data/lib/workos/shared/agent_blueprint_updated.rb +34 -0
  69. data/lib/workos/shared/agent_blueprint_updated_data.rb +7 -0
  70. data/lib/workos/shared/agent_blueprint_updated_data_invocable_by.rb +7 -0
  71. data/lib/workos/shared/agent_blueprint_updated_data_session_setting.rb +7 -0
  72. data/lib/workos/shared/agent_instance_created.rb +34 -0
  73. data/lib/workos/shared/agent_instance_created_data.rb +40 -0
  74. data/lib/workos/shared/agent_instance_deleted.rb +34 -0
  75. data/lib/workos/shared/agent_instance_deleted_data.rb +40 -0
  76. data/lib/workos/shared/agent_instance_session_created.rb +34 -0
  77. data/lib/workos/shared/agent_instance_session_created_data.rb +43 -0
  78. data/lib/workos/shared/agent_instance_session_revoked.rb +34 -0
  79. data/lib/workos/shared/agent_instance_session_revoked_data.rb +40 -0
  80. data/lib/workos/shared/pipe_connected_account.rb +15 -0
  81. data/lib/workos/shared/pipes_account_connection_add_failed.rb +34 -0
  82. data/lib/workos/shared/pipes_account_connection_add_failed_data.rb +49 -0
  83. data/lib/workos/shared/pipes_account_connection_connected.rb +34 -0
  84. data/lib/workos/shared/pipes_account_connection_connection_failed.rb +34 -0
  85. data/lib/workos/shared/pipes_account_connection_connection_failed_data.rb +7 -0
  86. data/lib/workos/shared/pipes_account_connection_disconnected.rb +34 -0
  87. data/lib/workos/shared/pipes_account_connection_reauthorization_needed.rb +34 -0
  88. data/lib/workos/shared/pipes_connected_account_connection_failed_data.rb +1 -40
  89. data/lib/workos/shared/resource_export_completed.rb +34 -0
  90. data/lib/workos/shared/resource_export_completed_data.rb +22 -0
  91. data/lib/workos/shared/resource_export_created.rb +34 -0
  92. data/lib/workos/shared/resource_export_created_data.rb +22 -0
  93. data/lib/workos/shared/resource_export_downloaded.rb +34 -0
  94. data/lib/workos/shared/resource_export_downloaded_data.rb +22 -0
  95. data/lib/workos/shared/resource_export_failed.rb +34 -0
  96. data/lib/workos/shared/resource_export_failed_data.rb +22 -0
  97. data/lib/workos/shared/waitlist_user.rb +8 -5
  98. data/lib/workos/sso/create_connection.rb +37 -0
  99. data/lib/workos/sso/create_connection_attribute_maps.rb +22 -0
  100. data/lib/workos/sso/create_connection_key_pair.rb +22 -0
  101. data/lib/workos/sso/create_connection_oidc_options.rb +43 -0
  102. data/lib/workos/sso/create_connection_saml_options.rb +40 -0
  103. data/lib/workos/sso/create_connection_standard_attributes.rb +34 -0
  104. data/lib/workos/sso/create_saml_idp_signing_certificate.rb +18 -0
  105. data/lib/workos/sso/patch_connection.rb +34 -0
  106. data/lib/workos/sso/patch_connection_attribute_maps.rb +22 -0
  107. data/lib/workos/sso/patch_connection_oidc_options.rb +40 -0
  108. data/lib/workos/sso/patch_connection_saml_options.rb +31 -0
  109. data/lib/workos/sso/patch_connection_standard_attributes.rb +7 -0
  110. data/lib/workos/sso/saml_idp_signing_certificate.rb +34 -0
  111. data/lib/workos/sso/saml_idp_signing_certificate_list.rb +22 -0
  112. data/lib/workos/sso/saml_sp_encryption_certificate.rb +34 -0
  113. data/lib/workos/sso/saml_sp_encryption_certificate_list.rb +22 -0
  114. data/lib/workos/sso/saml_sp_signing_certificate.rb +34 -0
  115. data/lib/workos/sso/token_query.rb +11 -2
  116. data/lib/workos/sso.rb +305 -4
  117. data/lib/workos/types/agent_blueprints_token_mint_token_request_type.rb +15 -0
  118. data/lib/workos/types/agent_instance_created_data_type.rb +13 -0
  119. data/lib/workos/types/agent_instance_deleted_data_type.rb +9 -0
  120. data/lib/workos/types/agent_instance_session_status.rb +14 -0
  121. data/lib/workos/types/agent_instance_type.rb +9 -0
  122. data/lib/workos/types/authenticate_response_authentication_method.rb +1 -4
  123. data/lib/workos/types/connected_account_connection_role.rb +13 -0
  124. data/lib/workos/types/connection_activated_data_connection_type.rb +1 -4
  125. data/lib/workos/types/connection_type.rb +1 -4
  126. data/lib/workos/types/connections_connection_type.rb +1 -4
  127. data/lib/workos/types/create_connection_oidc_options_id_token_signature_algorithm.rb +24 -0
  128. data/lib/workos/types/create_connection_oidc_options_token_authentication_method.rb +14 -0
  129. data/lib/workos/types/create_data_integration_ownership.rb +13 -0
  130. data/lib/workos/types/create_webhook_endpoint_events.rb +13 -1
  131. data/lib/workos/types/data_integration_installation_connection_role.rb +9 -0
  132. data/lib/workos/types/data_integration_ownership.rb +9 -0
  133. data/lib/workos/types/data_integrations_get_data_integration_authorize_url_request_connection_owner.rb +9 -0
  134. data/lib/workos/types/data_integrations_get_user_token_request_connection_owner.rb +9 -0
  135. data/lib/workos/types/data_integrations_list_response_data_connected_account_connection_role.rb +9 -0
  136. data/lib/workos/types/data_integrations_list_response_data_connection_owner.rb +9 -0
  137. data/lib/workos/types/data_integrations_upsert_api_key_request_connection_owner.rb +9 -0
  138. data/lib/workos/types/data_integrations_upsert_client_credentials_request_connection_owner.rb +9 -0
  139. data/lib/workos/types/data_integrations_vend_credentials_request_connection_owner.rb +9 -0
  140. data/lib/workos/types/invite_it_contact_intents.rb +16 -0
  141. data/lib/workos/types/patch_connection_oidc_options_id_token_signature_algorithm.rb +9 -0
  142. data/lib/workos/types/patch_connection_oidc_options_token_authentication_method.rb +9 -0
  143. data/lib/workos/types/pipe_connected_account_auth_method.rb +9 -0
  144. data/lib/workos/types/pipe_connected_account_connection_role.rb +9 -0
  145. data/lib/workos/types/pipes_ownership.rb +9 -0
  146. data/lib/workos/types/resource_export_completed_data_resource_type.rb +18 -0
  147. data/lib/workos/types/resource_export_created_data_resource_type.rb +9 -0
  148. data/lib/workos/types/resource_export_downloaded_data_resource_type.rb +9 -0
  149. data/lib/workos/types/resource_export_failed_data_resource_type.rb +9 -0
  150. data/lib/workos/types/session_created_data_status.rb +1 -6
  151. data/lib/workos/types/session_revoked_data_status.rb +1 -1
  152. data/lib/workos/types/sso_grant_type.rb +13 -0
  153. data/lib/workos/types/team_production_state.rb +15 -0
  154. data/lib/workos/types/token_query_grant_type.rb +9 -0
  155. data/lib/workos/types/update_audit_logs_retention_retention_period.rb +32 -0
  156. data/lib/workos/types/user_identities_get_item_provider.rb +1 -4
  157. data/lib/workos/types/user_management_waitlists_state.rb +14 -0
  158. data/lib/workos/types/user_sessions_status.rb +1 -1
  159. data/lib/workos/types/waitlist_entry_state.rb +9 -0
  160. data/lib/workos/types/waitlist_user_state.rb +1 -6
  161. data/lib/workos/user_management/authentication_oauth_failed_data.rb +5 -2
  162. data/lib/workos/user_management/authentication_oauth_succeeded_data.rb +5 -2
  163. data/lib/workos/user_management/authkit_oauth_resource.rb +34 -0
  164. data/lib/workos/user_management/create_authkit_oauth_resource.rb +22 -0
  165. data/lib/workos/user_management/create_password_reset_token.rb +1 -12
  166. data/lib/workos/user_management/create_waitlist_entry.rb +25 -0
  167. data/lib/workos/user_management/email_completion_session_authenticate_request.rb +43 -0
  168. data/lib/workos/user_management/waitlist.rb +28 -0
  169. data/lib/workos/user_management/waitlist_entry.rb +43 -0
  170. data/lib/workos/user_management.rb +263 -0
  171. data/lib/workos/version.rb +1 -1
  172. data/lib/workos.rb +1 -0
  173. data/rbi/workos/account_selection_required_error.rbi +30 -0
  174. data/rbi/workos/agent_blueprint.rbi +72 -0
  175. data/rbi/workos/agent_blueprint_created.rbi +54 -0
  176. data/rbi/workos/agent_blueprint_created_data.rbi +72 -0
  177. data/rbi/workos/agent_blueprint_created_data_invocable_by.rbi +30 -0
  178. data/rbi/workos/agent_blueprint_created_data_session_setting.rbi +36 -0
  179. data/rbi/workos/agent_blueprint_deleted.rbi +54 -0
  180. data/rbi/workos/agent_blueprint_deleted_data.rbi +48 -0
  181. data/rbi/workos/agent_blueprint_invocable_by.rbi +30 -0
  182. data/rbi/workos/agent_blueprint_session_setting.rbi +36 -0
  183. data/rbi/workos/agent_blueprint_updated.rbi +54 -0
  184. data/rbi/workos/agent_blueprint_updated_data.rbi +72 -0
  185. data/rbi/workos/agent_blueprint_updated_data_invocable_by.rbi +30 -0
  186. data/rbi/workos/agent_blueprint_updated_data_session_setting.rbi +36 -0
  187. data/rbi/workos/agent_blueprints_create_request.rbi +48 -0
  188. data/rbi/workos/agent_blueprints_create_request_invocable_by.rbi +30 -0
  189. data/rbi/workos/agent_blueprints_create_request_session_setting.rbi +36 -0
  190. data/rbi/workos/agent_blueprints_token_mint_token_request.rbi +54 -0
  191. data/rbi/workos/agent_blueprints_token_validate_token_request.rbi +24 -0
  192. data/rbi/workos/agent_blueprints_update_request.rbi +48 -0
  193. data/rbi/workos/agent_blueprints_update_request_invocable_by.rbi +30 -0
  194. data/rbi/workos/agent_blueprints_update_request_session_setting.rbi +36 -0
  195. data/rbi/workos/agent_instance.rbi +66 -0
  196. data/rbi/workos/agent_instance_created.rbi +54 -0
  197. data/rbi/workos/agent_instance_created_data.rbi +66 -0
  198. data/rbi/workos/agent_instance_deleted.rbi +54 -0
  199. data/rbi/workos/agent_instance_deleted_data.rbi +66 -0
  200. data/rbi/workos/agent_instance_session.rbi +66 -0
  201. data/rbi/workos/agent_instance_session_created.rbi +54 -0
  202. data/rbi/workos/agent_instance_session_created_data.rbi +72 -0
  203. data/rbi/workos/agent_instance_session_revoked.rbi +54 -0
  204. data/rbi/workos/agent_instance_session_revoked_data.rbi +66 -0
  205. data/rbi/workos/agent_token.rbi +66 -0
  206. data/rbi/workos/agent_token_validation.rbi +66 -0
  207. data/rbi/workos/agents.rbi +134 -0
  208. data/rbi/workos/audit_logs.rbi +26 -2
  209. data/rbi/workos/authentication_oauth_failed_data.rbi +6 -0
  210. data/rbi/workos/authentication_oauth_succeeded_data.rbi +6 -0
  211. data/rbi/workos/authkit_oauth_resource.rbi +54 -0
  212. data/rbi/workos/client.rbi +3 -0
  213. data/rbi/workos/connected_account.rbi +18 -0
  214. data/rbi/workos/create_authkit_oauth_resource.rbi +30 -0
  215. data/rbi/workos/create_connection.rbi +60 -0
  216. data/rbi/workos/create_connection_attribute_maps.rbi +30 -0
  217. data/rbi/workos/create_connection_key_pair.rbi +30 -0
  218. data/rbi/workos/create_connection_oidc_options.rbi +72 -0
  219. data/rbi/workos/create_connection_saml_options.rbi +66 -0
  220. data/rbi/workos/create_connection_standard_attributes.rbi +54 -0
  221. data/rbi/workos/create_data_integration.rbi +6 -0
  222. data/rbi/workos/create_it_contact.rbi +24 -0
  223. data/rbi/workos/create_saml_idp_signing_certificate.rbi +24 -0
  224. data/rbi/workos/create_team.rbi +30 -0
  225. data/rbi/workos/create_waitlist_entry.rbi +36 -0
  226. data/rbi/workos/data_integration.rbi +6 -0
  227. data/rbi/workos/data_integration_installation.rbi +19 -1
  228. data/rbi/workos/data_integrations_get_data_integration_authorize_url_request.rbi +6 -0
  229. data/rbi/workos/data_integrations_get_user_token_request.rbi +18 -0
  230. data/rbi/workos/data_integrations_list_response_data.rbi +12 -0
  231. data/rbi/workos/data_integrations_list_response_data_connected_account.rbi +18 -0
  232. data/rbi/workos/data_integrations_upsert_api_key_request.rbi +12 -0
  233. data/rbi/workos/data_integrations_upsert_client_credentials_request.rbi +12 -0
  234. data/rbi/workos/data_integrations_vend_credentials_request.rbi +18 -0
  235. data/rbi/workos/email_completion_session_authenticate_request.rbi +72 -0
  236. data/rbi/workos/invite_it_contact.rbi +24 -0
  237. data/rbi/workos/it_contact.rbi +48 -0
  238. data/rbi/workos/organizations.rbi +45 -0
  239. data/rbi/workos/patch_connection.rbi +54 -0
  240. data/rbi/workos/patch_connection_attribute_maps.rbi +30 -0
  241. data/rbi/workos/patch_connection_oidc_options.rbi +66 -0
  242. data/rbi/workos/patch_connection_saml_options.rbi +48 -0
  243. data/rbi/workos/patch_connection_standard_attributes.rbi +54 -0
  244. data/rbi/workos/pipe_connected_account.rbi +30 -0
  245. data/rbi/workos/pipes.rbi +122 -11
  246. data/rbi/workos/pipes_account_connection_add_failed.rbi +54 -0
  247. data/rbi/workos/pipes_account_connection_add_failed_data.rbi +84 -0
  248. data/rbi/workos/pipes_account_connection_connected.rbi +54 -0
  249. data/rbi/workos/pipes_account_connection_connection_failed.rbi +54 -0
  250. data/rbi/workos/pipes_account_connection_connection_failed_data.rbi +84 -0
  251. data/rbi/workos/pipes_account_connection_disconnected.rbi +54 -0
  252. data/rbi/workos/pipes_account_connection_reauthorization_needed.rbi +54 -0
  253. data/rbi/workos/pipes_connected_account_connection_failed_data.rbi +6 -0
  254. data/rbi/workos/platform_teams.rbi +30 -0
  255. data/rbi/workos/resource_export_completed.rbi +54 -0
  256. data/rbi/workos/resource_export_completed_data.rbi +30 -0
  257. data/rbi/workos/resource_export_created.rbi +54 -0
  258. data/rbi/workos/resource_export_created_data.rbi +30 -0
  259. data/rbi/workos/resource_export_downloaded.rbi +54 -0
  260. data/rbi/workos/resource_export_downloaded_data.rbi +30 -0
  261. data/rbi/workos/resource_export_failed.rbi +54 -0
  262. data/rbi/workos/resource_export_failed_data.rbi +30 -0
  263. data/rbi/workos/saml_idp_signing_certificate.rbi +54 -0
  264. data/rbi/workos/saml_idp_signing_certificate_list.rbi +30 -0
  265. data/rbi/workos/saml_sp_encryption_certificate.rbi +54 -0
  266. data/rbi/workos/saml_sp_encryption_certificate_list.rbi +30 -0
  267. data/rbi/workos/saml_sp_signing_certificate.rbi +54 -0
  268. data/rbi/workos/sso.rbi +155 -2
  269. data/rbi/workos/team.rbi +60 -0
  270. data/rbi/workos/token_query.rbi +20 -2
  271. data/rbi/workos/update_audit_logs_retention.rbi +8 -2
  272. data/rbi/workos/user_management.rbi +92 -0
  273. data/rbi/workos/waitlist.rbi +42 -0
  274. data/rbi/workos/waitlist_entry.rbi +72 -0
  275. data/rbi/workos/waitlist_user.rbi +12 -6
  276. data/test/workos/test_agents.rb +105 -1
  277. data/test/workos/test_agents_model_round_trip.rb +245 -0
  278. data/test/workos/test_audit_logs.rb +11 -2
  279. data/test/workos/test_authorization.rb +6 -6
  280. data/test/workos/test_organizations.rb +41 -1
  281. data/test/workos/test_organizations_model_round_trip.rb +40 -1
  282. data/test/workos/test_pipes.rb +64 -0
  283. data/test/workos/test_pipes_model_round_trip.rb +35 -5
  284. data/test/workos/test_platform_teams.rb +41 -0
  285. data/test/workos/test_platform_teams_model_round_trip.rb +41 -0
  286. data/test/workos/test_session.rb +63 -0
  287. data/test/workos/test_shared_model_round_trip.rb +610 -2
  288. data/test/workos/test_sso.rb +108 -2
  289. data/test/workos/test_sso_model_round_trip.rb +262 -2
  290. data/test/workos/test_user_management.rb +80 -0
  291. data/test/workos/test_user_management_model_round_trip.rb +110 -2
  292. metadata +194 -1
@@ -11,6 +11,55 @@ class AgentsTest < Minitest::Test
11
11
  @client = WorkOS::Client.new(api_key: "sk_test_123")
12
12
  end
13
13
 
14
+ def test_list_blueprints_returns_expected_result
15
+ stub_request(:get, %r{\Ahttps://api\.workos\.com/agents/blueprints(\?|\z)})
16
+ .to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
17
+ result = @client.agents.list_blueprints
18
+ assert_kind_of WorkOS::Types::ListStruct, result
19
+ end
20
+
21
+ def test_create_blueprint_returns_expected_result
22
+ stub_request(:post, %r{\Ahttps://api\.workos\.com/agents/blueprints(\?|\z)})
23
+ .to_return(body: "{}", status: 200)
24
+ result = @client.agents.create_blueprint(name: "stub")
25
+ refute_nil result
26
+ end
27
+
28
+ def test_get_blueprint_returns_expected_result
29
+ stub_request(:get, %r{\Ahttps://api\.workos\.com/agents/blueprints/stub(\?|\z)})
30
+ .to_return(body: "{}", status: 200)
31
+ result = @client.agents.get_blueprint(agent_blueprint_id: "stub")
32
+ refute_nil result
33
+ end
34
+
35
+ def test_update_blueprint_returns_expected_result
36
+ stub_request(:patch, %r{\Ahttps://api\.workos\.com/agents/blueprints/stub(\?|\z)})
37
+ .to_return(body: "{}", status: 200)
38
+ result = @client.agents.update_blueprint(agent_blueprint_id: "stub")
39
+ refute_nil result
40
+ end
41
+
42
+ def test_delete_blueprint_returns_expected_result
43
+ stub_request(:delete, %r{\Ahttps://api\.workos\.com/agents/blueprints/stub(\?|\z)})
44
+ .to_return(body: "{}", status: 200)
45
+ result = @client.agents.delete_blueprint(agent_blueprint_id: "stub")
46
+ assert_nil result
47
+ end
48
+
49
+ def test_create_blueprint_token_returns_expected_result
50
+ stub_request(:post, %r{\Ahttps://api\.workos\.com/agents/blueprints/stub/tokens(\?|\z)})
51
+ .to_return(body: "{}", status: 200)
52
+ result = @client.agents.create_blueprint_token(agent_blueprint_id: "stub", type: "stub")
53
+ refute_nil result
54
+ end
55
+
56
+ def test_validate_blueprint_token_returns_expected_result
57
+ stub_request(:post, %r{\Ahttps://api\.workos\.com/agents/blueprints/stub/tokens/validate(\?|\z)})
58
+ .to_return(body: "{}", status: 200)
59
+ result = @client.agents.validate_blueprint_token(agent_blueprint_id: "stub", agent_access_token: "stub")
60
+ refute_nil result
61
+ end
62
+
14
63
  def test_update_attempts_returns_expected_result
15
64
  stub_request(:patch, %r{\Ahttps://api\.workos\.com/agents/claims/attempts(\?|\z)})
16
65
  .to_return(body: "{}", status: 200)
@@ -32,11 +81,66 @@ class AgentsTest < Minitest::Test
32
81
  refute_nil result
33
82
  end
34
83
 
84
+ def test_list_instances_returns_expected_result
85
+ stub_request(:get, %r{\Ahttps://api\.workos\.com/agents/instances(\?|\z)})
86
+ .to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
87
+ result = @client.agents.list_instances
88
+ assert_kind_of WorkOS::Types::ListStruct, result
89
+ end
90
+
91
+ def test_get_instance_returns_expected_result
92
+ stub_request(:get, %r{\Ahttps://api\.workos\.com/agents/instances/stub(\?|\z)})
93
+ .to_return(body: "{}", status: 200)
94
+ result = @client.agents.get_instance(agent_instance_id: "stub")
95
+ refute_nil result
96
+ end
97
+
98
+ def test_delete_instance_returns_expected_result
99
+ stub_request(:delete, %r{\Ahttps://api\.workos\.com/agents/instances/stub(\?|\z)})
100
+ .to_return(body: "{}", status: 200)
101
+ result = @client.agents.delete_instance(agent_instance_id: "stub")
102
+ assert_nil result
103
+ end
104
+
105
+ def test_list_sessions_returns_expected_result
106
+ stub_request(:get, %r{\Ahttps://api\.workos\.com/agents/sessions(\?|\z)})
107
+ .to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
108
+ result = @client.agents.list_sessions
109
+ assert_kind_of WorkOS::Types::ListStruct, result
110
+ end
111
+
112
+ def test_get_session_returns_expected_result
113
+ stub_request(:get, %r{\Ahttps://api\.workos\.com/agents/sessions/stub(\?|\z)})
114
+ .to_return(body: "{}", status: 200)
115
+ result = @client.agents.get_session(agent_instance_session_id: "stub")
116
+ refute_nil result
117
+ end
118
+
119
+ def test_revoke_session_returns_expected_result
120
+ stub_request(:post, %r{\Ahttps://api\.workos\.com/agents/sessions/stub/revoke(\?|\z)})
121
+ .to_return(body: "{}", status: 200)
122
+ result = @client.agents.revoke_session(agent_instance_session_id: "stub")
123
+ refute_nil result
124
+ end
125
+
35
126
  # Parameterized authentication error tests (one per endpoint).
36
127
  [
128
+ {name: :list_blueprints, verb: :get, url: %r{\Ahttps://api\.workos\.com/agents/blueprints(\?|\z)}},
129
+ {name: :create_blueprint, verb: :post, url: %r{\Ahttps://api\.workos\.com/agents/blueprints(\?|\z)}, args: {name: "stub"}},
130
+ {name: :get_blueprint, verb: :get, url: %r{\Ahttps://api\.workos\.com/agents/blueprints/stub(\?|\z)}, args: {agent_blueprint_id: "stub"}},
131
+ {name: :update_blueprint, verb: :patch, url: %r{\Ahttps://api\.workos\.com/agents/blueprints/stub(\?|\z)}, args: {agent_blueprint_id: "stub"}},
132
+ {name: :delete_blueprint, verb: :delete, url: %r{\Ahttps://api\.workos\.com/agents/blueprints/stub(\?|\z)}, args: {agent_blueprint_id: "stub"}},
133
+ {name: :create_blueprint_token, verb: :post, url: %r{\Ahttps://api\.workos\.com/agents/blueprints/stub/tokens(\?|\z)}, args: {agent_blueprint_id: "stub", type: "stub"}},
134
+ {name: :validate_blueprint_token, verb: :post, url: %r{\Ahttps://api\.workos\.com/agents/blueprints/stub/tokens/validate(\?|\z)}, args: {agent_blueprint_id: "stub", agent_access_token: "stub"}},
37
135
  {name: :update_attempts, verb: :patch, url: %r{\Ahttps://api\.workos\.com/agents/claims/attempts(\?|\z)}, args: {type: "link_external_user", claim_attempt_token: "stub", user: {}}},
38
136
  {name: :create_validate, verb: :post, url: %r{\Ahttps://api\.workos\.com/agents/credentials/validate(\?|\z)}, args: {type: "stub", credential: "stub"}},
39
- {name: :get_registration, verb: :get, url: %r{\Ahttps://api\.workos\.com/agents/registrations/stub(\?|\z)}, args: {id: "stub"}}
137
+ {name: :get_registration, verb: :get, url: %r{\Ahttps://api\.workos\.com/agents/registrations/stub(\?|\z)}, args: {id: "stub"}},
138
+ {name: :list_instances, verb: :get, url: %r{\Ahttps://api\.workos\.com/agents/instances(\?|\z)}},
139
+ {name: :get_instance, verb: :get, url: %r{\Ahttps://api\.workos\.com/agents/instances/stub(\?|\z)}, args: {agent_instance_id: "stub"}},
140
+ {name: :delete_instance, verb: :delete, url: %r{\Ahttps://api\.workos\.com/agents/instances/stub(\?|\z)}, args: {agent_instance_id: "stub"}},
141
+ {name: :list_sessions, verb: :get, url: %r{\Ahttps://api\.workos\.com/agents/sessions(\?|\z)}},
142
+ {name: :get_session, verb: :get, url: %r{\Ahttps://api\.workos\.com/agents/sessions/stub(\?|\z)}, args: {agent_instance_session_id: "stub"}},
143
+ {name: :revoke_session, verb: :post, url: %r{\Ahttps://api\.workos\.com/agents/sessions/stub/revoke(\?|\z)}, args: {agent_instance_session_id: "stub"}}
40
144
  ].each do |spec|
41
145
  define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do
42
146
  stub_request(spec[:verb], spec[:url])
@@ -56,6 +56,147 @@ class AgentsModelRoundTripTest < Minitest::Test
56
56
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
57
57
  end
58
58
 
59
+ def test_agent_blueprint_round_trip
60
+ fixture = {
61
+ "object" => "agent_blueprint",
62
+ "id" => "stub",
63
+ "name" => "stub",
64
+ "description" => nil,
65
+ "permissions" => [],
66
+ "invocable_by" => {},
67
+ "session_settings" => {},
68
+ "created_at" => "stub",
69
+ "updated_at" => "stub"
70
+ }
71
+ model = WorkOS::AgentBlueprint.new(fixture.to_json)
72
+ json = model.to_h
73
+ assert_kind_of Hash, json
74
+ assert_equal fixture["id"], json[:id]
75
+ assert_equal fixture["name"], json[:name]
76
+ assert_nil json[:description]
77
+ assert_equal fixture["created_at"], json[:created_at]
78
+ assert_equal fixture["updated_at"], json[:updated_at]
79
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
80
+ end
81
+
82
+ def test_agent_instance_round_trip
83
+ fixture = {
84
+ "object" => "agent_instance",
85
+ "id" => "stub",
86
+ "agent_blueprint_id" => "stub",
87
+ "organization_id" => "stub",
88
+ "organization_membership_id" => nil,
89
+ "type" => "stub",
90
+ "created_at" => "stub",
91
+ "updated_at" => "stub"
92
+ }
93
+ model = WorkOS::AgentInstance.new(fixture.to_json)
94
+ json = model.to_h
95
+ assert_kind_of Hash, json
96
+ assert_equal fixture["id"], json[:id]
97
+ assert_equal fixture["agent_blueprint_id"], json[:agent_blueprint_id]
98
+ assert_equal fixture["organization_id"], json[:organization_id]
99
+ assert_nil json[:organization_membership_id]
100
+ assert_equal fixture["created_at"], json[:created_at]
101
+ assert_equal fixture["updated_at"], json[:updated_at]
102
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
103
+ end
104
+
105
+ def test_agent_token_round_trip
106
+ fixture = {
107
+ "access_token" => "stub",
108
+ "token_type" => "Bearer",
109
+ "expires_in" => 1,
110
+ "refresh_token" => "stub",
111
+ "agent_instance_id" => "stub",
112
+ "new_instance" => true,
113
+ "agent_instance_session_id" => "stub",
114
+ "permissions" => []
115
+ }
116
+ model = WorkOS::AgentToken.new(fixture.to_json)
117
+ json = model.to_h
118
+ assert_kind_of Hash, json
119
+ assert_equal fixture["access_token"], json[:access_token]
120
+ assert_equal fixture["expires_in"], json[:expires_in]
121
+ assert_equal fixture["refresh_token"], json[:refresh_token]
122
+ assert_equal fixture["agent_instance_id"], json[:agent_instance_id]
123
+ assert_equal fixture["new_instance"], json[:new_instance]
124
+ assert_equal fixture["agent_instance_session_id"], json[:agent_instance_session_id]
125
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
126
+ end
127
+
128
+ def test_agent_token_validation_round_trip
129
+ fixture = {
130
+ "valid" => true,
131
+ "agent_instance_id" => "stub",
132
+ "agent_instance_session_id" => "stub",
133
+ "organization_id" => "stub",
134
+ "permissions" => [],
135
+ "intent" => nil,
136
+ "acting_user_id" => nil,
137
+ "session_expires_at" => "stub"
138
+ }
139
+ model = WorkOS::AgentTokenValidation.new(fixture.to_json)
140
+ json = model.to_h
141
+ assert_kind_of Hash, json
142
+ assert_equal fixture["agent_instance_id"], json[:agent_instance_id]
143
+ assert_equal fixture["agent_instance_session_id"], json[:agent_instance_session_id]
144
+ assert_equal fixture["organization_id"], json[:organization_id]
145
+ assert_nil json[:intent]
146
+ assert_nil json[:acting_user_id]
147
+ assert_equal fixture["session_expires_at"], json[:session_expires_at]
148
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
149
+ end
150
+
151
+ def test_agent_instance_session_round_trip
152
+ fixture = {
153
+ "object" => "agent_instance_session",
154
+ "id" => "stub",
155
+ "agent_instance_id" => "stub",
156
+ "status" => "stub",
157
+ "expires_at" => "stub",
158
+ "revoked_at" => nil,
159
+ "created_at" => "stub",
160
+ "updated_at" => "stub"
161
+ }
162
+ model = WorkOS::AgentInstanceSession.new(fixture.to_json)
163
+ json = model.to_h
164
+ assert_kind_of Hash, json
165
+ assert_equal fixture["id"], json[:id]
166
+ assert_equal fixture["agent_instance_id"], json[:agent_instance_id]
167
+ assert_equal fixture["expires_at"], json[:expires_at]
168
+ assert_nil json[:revoked_at]
169
+ assert_equal fixture["created_at"], json[:created_at]
170
+ assert_equal fixture["updated_at"], json[:updated_at]
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_agent_blueprint_invocable_by_round_trip
175
+ fixture = {
176
+ "role_slugs" => [],
177
+ "organization_ids" => []
178
+ }
179
+ model = WorkOS::AgentBlueprintInvocableBy.new(fixture.to_json)
180
+ json = model.to_h
181
+ assert_kind_of Hash, json
182
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
183
+ end
184
+
185
+ def test_agent_blueprint_session_setting_round_trip
186
+ fixture = {
187
+ "max_age_seconds" => 1,
188
+ "access_token_ttl_seconds" => 1,
189
+ "refresh_token_ttl_seconds" => 1
190
+ }
191
+ model = WorkOS::AgentBlueprintSessionSetting.new(fixture.to_json)
192
+ json = model.to_h
193
+ assert_kind_of Hash, json
194
+ assert_equal fixture["max_age_seconds"], json[:max_age_seconds]
195
+ assert_equal fixture["access_token_ttl_seconds"], json[:access_token_ttl_seconds]
196
+ assert_equal fixture["refresh_token_ttl_seconds"], json[:refresh_token_ttl_seconds]
197
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
198
+ end
199
+
59
200
  def test_claim_view_response_organization_round_trip
60
201
  fixture = {
61
202
  "id" => "stub",
@@ -104,6 +245,110 @@ class AgentsModelRoundTripTest < Minitest::Test
104
245
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
105
246
  end
106
247
 
248
+ def test_agent_blueprints_create_request_round_trip
249
+ fixture = {
250
+ "name" => "stub",
251
+ "description" => "stub",
252
+ "permissions" => [],
253
+ "invocable_by" => {},
254
+ "session_settings" => {}
255
+ }
256
+ model = WorkOS::AgentBlueprintsCreateRequest.new(fixture.to_json)
257
+ json = model.to_h
258
+ assert_kind_of Hash, json
259
+ assert_equal fixture["name"], json[:name]
260
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
261
+ end
262
+
263
+ def test_agent_blueprints_create_request_invocable_by_round_trip
264
+ fixture = {
265
+ "role_slugs" => [],
266
+ "organization_ids" => []
267
+ }
268
+ model = WorkOS::AgentBlueprintsCreateRequestInvocableBy.new(fixture.to_json)
269
+ json = model.to_h
270
+ assert_kind_of Hash, json
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_agent_blueprints_create_request_session_setting_round_trip
275
+ fixture = {
276
+ "max_age_seconds" => 1,
277
+ "access_token_ttl_seconds" => 1,
278
+ "refresh_token_ttl_seconds" => 1
279
+ }
280
+ model = WorkOS::AgentBlueprintsCreateRequestSessionSetting.new(fixture.to_json)
281
+ json = model.to_h
282
+ assert_kind_of Hash, json
283
+ assert_equal fixture["max_age_seconds"], json[:max_age_seconds]
284
+ assert_equal fixture["access_token_ttl_seconds"], json[:access_token_ttl_seconds]
285
+ assert_equal fixture["refresh_token_ttl_seconds"], json[:refresh_token_ttl_seconds]
286
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
287
+ end
288
+
289
+ def test_agent_blueprints_update_request_round_trip
290
+ fixture = {
291
+ "name" => "stub",
292
+ "description" => nil,
293
+ "permissions" => [],
294
+ "invocable_by" => {},
295
+ "session_settings" => {}
296
+ }
297
+ model = WorkOS::AgentBlueprintsUpdateRequest.new(fixture.to_json)
298
+ json = model.to_h
299
+ assert_kind_of Hash, json
300
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
301
+ end
302
+
303
+ def test_agent_blueprints_update_request_invocable_by_round_trip
304
+ fixture = {
305
+ "role_slugs" => [],
306
+ "organization_ids" => []
307
+ }
308
+ model = WorkOS::AgentBlueprintsUpdateRequestInvocableBy.new(fixture.to_json)
309
+ json = model.to_h
310
+ assert_kind_of Hash, json
311
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
312
+ end
313
+
314
+ def test_agent_blueprints_update_request_session_setting_round_trip
315
+ fixture = {
316
+ "max_age_seconds" => 1,
317
+ "access_token_ttl_seconds" => 1,
318
+ "refresh_token_ttl_seconds" => 1
319
+ }
320
+ model = WorkOS::AgentBlueprintsUpdateRequestSessionSetting.new(fixture.to_json)
321
+ json = model.to_h
322
+ assert_kind_of Hash, json
323
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
324
+ end
325
+
326
+ def test_agent_blueprints_token_mint_token_request_round_trip
327
+ fixture = {
328
+ "type" => "stub",
329
+ "user_access_token" => "stub",
330
+ "intent" => "stub",
331
+ "organization_id" => "stub",
332
+ "agent_access_token" => "stub",
333
+ "refresh_token" => "stub"
334
+ }
335
+ model = WorkOS::AgentBlueprintsTokenMintTokenRequest.new(fixture.to_json)
336
+ json = model.to_h
337
+ assert_kind_of Hash, json
338
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
339
+ end
340
+
341
+ def test_agent_blueprints_token_validate_token_request_round_trip
342
+ fixture = {
343
+ "agent_access_token" => "stub"
344
+ }
345
+ model = WorkOS::AgentBlueprintsTokenValidateTokenRequest.new(fixture.to_json)
346
+ json = model.to_h
347
+ assert_kind_of Hash, json
348
+ assert_equal fixture["agent_access_token"], json[:agent_access_token]
349
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
350
+ end
351
+
107
352
  def test_agent_admin_link_claim_attempt_to_external_user_request_round_trip
108
353
  fixture = {
109
354
  "type" => "link_external_user",
@@ -20,8 +20,17 @@ class AuditLogsTest < Minitest::Test
20
20
 
21
21
  def test_update_organization_audit_logs_retention_returns_expected_result
22
22
  stub_request(:put, %r{\Ahttps://api\.workos\.com/organizations/stub/audit_logs_retention(\?|\z)})
23
+ .with(body: hash_including("retention_period" => "stub"))
23
24
  .to_return(body: "{}", status: 200)
24
- result = @client.audit_logs.update_organization_audit_logs_retention(id: "stub", retention_period_in_days: 1)
25
+ result = @client.audit_logs.update_organization_audit_logs_retention(id: "stub", retention: WorkOS::AuditLogs::RetentionPeriod.new(retention_period: "stub"))
26
+ refute_nil result
27
+ end
28
+
29
+ def test_update_organization_audit_logs_retention_with_retention_period_in_days_returns_expected_result
30
+ stub_request(:put, %r{\Ahttps://api\.workos\.com/organizations/stub/audit_logs_retention(\?|\z)})
31
+ .with(body: hash_including("retention_period_in_days" => 1))
32
+ .to_return(body: "{}", status: 200)
33
+ result = @client.audit_logs.update_organization_audit_logs_retention(id: "stub", retention: WorkOS::AuditLogs::RetentionPeriodInDays.new(retention_period_in_days: 1))
25
34
  refute_nil result
26
35
  end
27
36
 
@@ -70,7 +79,7 @@ class AuditLogsTest < Minitest::Test
70
79
  # Parameterized authentication error tests (one per endpoint).
71
80
  [
72
81
  {name: :get_organization_audit_logs_retention, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/audit_logs_retention(\?|\z)}, args: {id: "stub"}},
73
- {name: :update_organization_audit_logs_retention, verb: :put, url: %r{\Ahttps://api\.workos\.com/organizations/stub/audit_logs_retention(\?|\z)}, args: {id: "stub", retention_period_in_days: 1}},
82
+ {name: :update_organization_audit_logs_retention, verb: :put, url: %r{\Ahttps://api\.workos\.com/organizations/stub/audit_logs_retention(\?|\z)}, args: {id: "stub", retention: WorkOS::AuditLogs::RetentionPeriod.new(retention_period: "stub")}},
74
83
  {name: :list_actions, verb: :get, url: %r{\Ahttps://api\.workos\.com/audit_logs/actions(\?|\z)}},
75
84
  {name: :list_action_schemas, verb: :get, url: %r{\Ahttps://api\.workos\.com/audit_logs/actions/stub/schemas(\?|\z)}, args: {action_name: "stub"}},
76
85
  {name: :create_schema, verb: :post, url: %r{\Ahttps://api\.workos\.com/audit_logs/actions/stub/schemas(\?|\z)}, args: {action_name: "stub", targets: [{}]}},
@@ -214,9 +214,9 @@ class AuthorizationTest < Minitest::Test
214
214
 
215
215
  def test_update_resource_by_external_id_with_parent_resource_by_external_id_returns_expected_result
216
216
  stub_request(:patch, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub(\?|\z)})
217
- .with(body: hash_including("parent_resource_external_id" => "stub", "parent_resource_type_slug" => "stub"))
217
+ .with(body: hash_including("parent_resource_type_slug" => "stub", "parent_resource_external_id" => "stub"))
218
218
  .to_return(body: "{}", status: 200)
219
- result = @client.authorization.update_resource_by_external_id(organization_id: "stub", resource_type_slug: "stub", external_id: "stub", parent_resource: WorkOS::Authorization::ParentResourceByExternalId.new(parent_resource_external_id: "stub", parent_resource_type_slug: "stub"))
219
+ result = @client.authorization.update_resource_by_external_id(organization_id: "stub", resource_type_slug: "stub", external_id: "stub", parent_resource: WorkOS::Authorization::ParentResourceByExternalId.new(parent_resource_type_slug: "stub", parent_resource_external_id: "stub"))
220
220
  refute_nil result
221
221
  end
222
222
 
@@ -265,9 +265,9 @@ class AuthorizationTest < Minitest::Test
265
265
 
266
266
  def test_create_resource_with_parent_resource_by_external_id_returns_expected_result
267
267
  stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/resources(\?|\z)})
268
- .with(body: hash_including("external_id" => "stub", "name" => "stub", "resource_type_slug" => "stub", "organization_id" => "stub", "parent_resource_external_id" => "stub", "parent_resource_type_slug" => "stub"))
268
+ .with(body: hash_including("external_id" => "stub", "name" => "stub", "resource_type_slug" => "stub", "organization_id" => "stub", "parent_resource_type_slug" => "stub", "parent_resource_external_id" => "stub"))
269
269
  .to_return(body: "{}", status: 200)
270
- result = @client.authorization.create_resource(external_id: "stub", name: "stub", resource_type_slug: "stub", organization_id: "stub", parent_resource: WorkOS::Authorization::ParentResourceByExternalId.new(parent_resource_external_id: "stub", parent_resource_type_slug: "stub"))
270
+ result = @client.authorization.create_resource(external_id: "stub", name: "stub", resource_type_slug: "stub", organization_id: "stub", parent_resource: WorkOS::Authorization::ParentResourceByExternalId.new(parent_resource_type_slug: "stub", parent_resource_external_id: "stub"))
271
271
  refute_nil result
272
272
  end
273
273
 
@@ -288,9 +288,9 @@ class AuthorizationTest < Minitest::Test
288
288
 
289
289
  def test_update_resource_with_parent_resource_by_external_id_returns_expected_result
290
290
  stub_request(:patch, %r{\Ahttps://api\.workos\.com/authorization/resources/stub(\?|\z)})
291
- .with(body: hash_including("parent_resource_external_id" => "stub", "parent_resource_type_slug" => "stub"))
291
+ .with(body: hash_including("parent_resource_type_slug" => "stub", "parent_resource_external_id" => "stub"))
292
292
  .to_return(body: "{}", status: 200)
293
- result = @client.authorization.update_resource(resource_id: "stub", parent_resource: WorkOS::Authorization::ParentResourceByExternalId.new(parent_resource_external_id: "stub", parent_resource_type_slug: "stub"))
293
+ result = @client.authorization.update_resource(resource_id: "stub", parent_resource: WorkOS::Authorization::ParentResourceByExternalId.new(parent_resource_type_slug: "stub", parent_resource_external_id: "stub"))
294
294
  refute_nil result
295
295
  end
296
296
 
@@ -67,6 +67,41 @@ class OrganizationsTest < Minitest::Test
67
67
  assert_kind_of WorkOS::Types::ListStruct, result
68
68
  end
69
69
 
70
+ def test_list_it_contacts_returns_expected_result
71
+ stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts(\?|\z)})
72
+ .to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
73
+ result = @client.organizations.list_it_contacts(organization_id: "stub")
74
+ assert_kind_of WorkOS::Types::ListStruct, result
75
+ end
76
+
77
+ def test_create_it_contact_returns_expected_result
78
+ stub_request(:post, %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts(\?|\z)})
79
+ .to_return(body: "{}", status: 200)
80
+ result = @client.organizations.create_it_contact(organization_id: "stub", email: "stub")
81
+ refute_nil result
82
+ end
83
+
84
+ def test_delete_it_contact_returns_expected_result
85
+ stub_request(:delete, %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts/stub(\?|\z)})
86
+ .to_return(body: "{}", status: 200)
87
+ result = @client.organizations.delete_it_contact(organization_id: "stub", contact_id: "stub")
88
+ assert_nil result
89
+ end
90
+
91
+ def test_invite_it_contact_returns_expected_result
92
+ stub_request(:post, %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts/stub/invite(\?|\z)})
93
+ .to_return(body: "{}", status: 200)
94
+ result = @client.organizations.invite_it_contact(organization_id: "stub", contact_id: "stub", intents: ["stub"])
95
+ assert_nil result
96
+ end
97
+
98
+ def test_revoke_it_contact_returns_expected_result
99
+ stub_request(:post, %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts/stub/revoke(\?|\z)})
100
+ .to_return(body: "{}", status: 200)
101
+ result = @client.organizations.revoke_it_contact(organization_id: "stub", contact_id: "stub")
102
+ assert_nil result
103
+ end
104
+
70
105
  # Parameterized authentication error tests (one per endpoint).
71
106
  [
72
107
  {name: :list_organizations, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations(\?|\z)}},
@@ -76,7 +111,12 @@ class OrganizationsTest < Minitest::Test
76
111
  {name: :update_organization, verb: :put, url: %r{\Ahttps://api\.workos\.com/organizations/stub(\?|\z)}, args: {id: "stub"}},
77
112
  {name: :delete_organization, verb: :delete, url: %r{\Ahttps://api\.workos\.com/organizations/stub(\?|\z)}, args: {id: "stub"}},
78
113
  {name: :get_audit_log_configuration, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/audit_log_configuration(\?|\z)}, args: {id: "stub"}},
79
- {name: :list_authorized_applications, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/authorized_applications(\?|\z)}, args: {organization_id: "stub"}}
114
+ {name: :list_authorized_applications, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/authorized_applications(\?|\z)}, args: {organization_id: "stub"}},
115
+ {name: :list_it_contacts, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts(\?|\z)}, args: {organization_id: "stub"}},
116
+ {name: :create_it_contact, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts(\?|\z)}, args: {organization_id: "stub", email: "stub"}},
117
+ {name: :delete_it_contact, verb: :delete, url: %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts/stub(\?|\z)}, args: {organization_id: "stub", contact_id: "stub"}},
118
+ {name: :invite_it_contact, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts/stub/invite(\?|\z)}, args: {organization_id: "stub", contact_id: "stub", intents: ["stub"]}},
119
+ {name: :revoke_it_contact, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts/stub/revoke(\?|\z)}, args: {organization_id: "stub", contact_id: "stub"}}
80
120
  ].each do |spec|
81
121
  define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do
82
122
  stub_request(spec[:verb], spec[:url])
@@ -7,12 +7,33 @@ require "test_helper"
7
7
  class OrganizationsModelRoundTripTest < Minitest::Test
8
8
  def test_update_audit_logs_retention_round_trip
9
9
  fixture = {
10
+ "retention_period" => "stub",
10
11
  "retention_period_in_days" => 1
11
12
  }
12
13
  model = WorkOS::UpdateAuditLogsRetention.new(fixture.to_json)
13
14
  json = model.to_h
14
15
  assert_kind_of Hash, json
15
- assert_equal fixture["retention_period_in_days"], json[:retention_period_in_days]
16
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
17
+ end
18
+
19
+ def test_create_it_contact_round_trip
20
+ fixture = {
21
+ "email" => "stub"
22
+ }
23
+ model = WorkOS::CreateItContact.new(fixture.to_json)
24
+ json = model.to_h
25
+ assert_kind_of Hash, json
26
+ assert_equal fixture["email"], json[:email]
27
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
28
+ end
29
+
30
+ def test_invite_it_contact_round_trip
31
+ fixture = {
32
+ "intents" => []
33
+ }
34
+ model = WorkOS::InviteItContact.new(fixture.to_json)
35
+ json = model.to_h
36
+ assert_kind_of Hash, json
16
37
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
17
38
  end
18
39
 
@@ -544,6 +565,24 @@ class OrganizationsModelRoundTripTest < Minitest::Test
544
565
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
545
566
  end
546
567
 
568
+ def test_it_contact_round_trip
569
+ fixture = {
570
+ "object" => "it_contact",
571
+ "id" => "stub",
572
+ "email" => "stub",
573
+ "created_at" => "stub",
574
+ "updated_at" => "stub"
575
+ }
576
+ model = WorkOS::ItContact.new(fixture.to_json)
577
+ json = model.to_h
578
+ assert_kind_of Hash, json
579
+ assert_equal fixture["id"], json[:id]
580
+ assert_equal fixture["email"], json[:email]
581
+ assert_equal fixture["created_at"], json[:created_at]
582
+ assert_equal fixture["updated_at"], json[:updated_at]
583
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
584
+ end
585
+
547
586
  def test_organization_round_trip
548
587
  fixture = {
549
588
  "object" => "organization",
@@ -74,6 +74,27 @@ class PipesTest < Minitest::Test
74
74
  refute_nil result
75
75
  end
76
76
 
77
+ def test_list_data_integration_organization_returns_expected_result
78
+ stub_request(:get, %r{\Ahttps://api\.workos\.com/data-integrations/stub/organization(\?|\z)})
79
+ .to_return(body: "{}", status: 200)
80
+ result = @client.pipes.list_data_integration_organization(slug: "stub")
81
+ refute_nil result
82
+ end
83
+
84
+ def test_update_data_integration_organization_returns_expected_result
85
+ stub_request(:put, %r{\Ahttps://api\.workos\.com/data-integrations/stub/organization(\?|\z)})
86
+ .to_return(body: "{}", status: 200)
87
+ result = @client.pipes.update_data_integration_organization(slug: "stub")
88
+ refute_nil result
89
+ end
90
+
91
+ def test_delete_data_integration_organization_returns_expected_result
92
+ stub_request(:delete, %r{\Ahttps://api\.workos\.com/data-integrations/stub/organization(\?|\z)})
93
+ .to_return(body: "{}", status: 200)
94
+ result = @client.pipes.delete_data_integration_organization(slug: "stub")
95
+ assert_nil result
96
+ end
97
+
77
98
  def test_get_access_token_returns_expected_result
78
99
  stub_request(:post, %r{\Ahttps://api\.workos\.com/data-integrations/stub/token(\?|\z)})
79
100
  .to_return(body: "{}", status: 200)
@@ -81,6 +102,41 @@ class PipesTest < Minitest::Test
81
102
  refute_nil result
82
103
  end
83
104
 
105
+ def test_get_organization_connected_account_returns_expected_result
106
+ stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)})
107
+ .to_return(body: "{}", status: 200)
108
+ result = @client.pipes.get_organization_connected_account(organization_id: "stub", slug: "stub")
109
+ refute_nil result
110
+ end
111
+
112
+ def test_create_organization_connected_account_returns_expected_result
113
+ stub_request(:post, %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)})
114
+ .to_return(body: "{}", status: 200)
115
+ result = @client.pipes.create_organization_connected_account(organization_id: "stub", slug: "stub")
116
+ refute_nil result
117
+ end
118
+
119
+ def test_update_organization_connected_account_returns_expected_result
120
+ stub_request(:put, %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)})
121
+ .to_return(body: "{}", status: 200)
122
+ result = @client.pipes.update_organization_connected_account(organization_id: "stub", slug: "stub")
123
+ refute_nil result
124
+ end
125
+
126
+ def test_delete_organization_connected_account_returns_expected_result
127
+ stub_request(:delete, %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)})
128
+ .to_return(body: "{}", status: 200)
129
+ result = @client.pipes.delete_organization_connected_account(organization_id: "stub", slug: "stub")
130
+ assert_nil result
131
+ end
132
+
133
+ def test_list_organization_data_providers_returns_expected_result
134
+ stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/data_providers(\?|\z)})
135
+ .to_return(body: "{}", status: 200)
136
+ result = @client.pipes.list_organization_data_providers(organization_id: "stub")
137
+ refute_nil result
138
+ end
139
+
84
140
  def test_get_user_connected_account_returns_expected_result
85
141
  stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)})
86
142
  .to_return(body: "{}", status: 200)
@@ -127,7 +183,15 @@ class PipesTest < Minitest::Test
127
183
  {name: :authorize_data_integration, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/authorize(\?|\z)}, args: {slug: "stub", user_id: "stub"}},
128
184
  {name: :update_data_integration_client_credentials, verb: :put, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/client-credentials(\?|\z)}, args: {slug: "stub", user_id: "stub", client_id: "stub", client_secret: "stub"}},
129
185
  {name: :create_data_integration_credential, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/credentials(\?|\z)}, args: {slug: "stub", user_id: "stub"}},
186
+ {name: :list_data_integration_organization, verb: :get, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/organization(\?|\z)}, args: {slug: "stub"}},
187
+ {name: :update_data_integration_organization, verb: :put, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/organization(\?|\z)}, args: {slug: "stub"}},
188
+ {name: :delete_data_integration_organization, verb: :delete, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/organization(\?|\z)}, args: {slug: "stub"}},
130
189
  {name: :get_access_token, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/token(\?|\z)}, args: {provider: "stub", user_id: "stub"}},
190
+ {name: :get_organization_connected_account, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}},
191
+ {name: :create_organization_connected_account, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}},
192
+ {name: :update_organization_connected_account, verb: :put, url: %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}},
193
+ {name: :delete_organization_connected_account, verb: :delete, url: %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}},
194
+ {name: :list_organization_data_providers, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/data_providers(\?|\z)}, args: {organization_id: "stub"}},
131
195
  {name: :get_user_connected_account, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}},
132
196
  {name: :create_user_connected_account, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}},
133
197
  {name: :update_user_connected_account, verb: :put, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}},