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
@@ -0,0 +1,49 @@
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 AgentsTest < Minitest::Test
8
+ include FixtureHelper
9
+
10
+ def setup
11
+ @client = WorkOS::Client.new(api_key: "sk_test_123")
12
+ end
13
+
14
+ def test_update_attempts_returns_expected_result
15
+ stub_request(:patch, %r{\Ahttps://api\.workos\.com/agents/claims/attempts(\?|\z)})
16
+ .to_return(body: "{}", status: 200)
17
+ result = @client.agents.update_attempts(type: "link_external_user", claim_attempt_token: "stub", user: {})
18
+ refute_nil result
19
+ end
20
+
21
+ def test_create_validate_returns_expected_result
22
+ stub_request(:post, %r{\Ahttps://api\.workos\.com/agents/credentials/validate(\?|\z)})
23
+ .to_return(body: "{}", status: 200)
24
+ result = @client.agents.create_validate(type: "stub", credential: "stub")
25
+ refute_nil result
26
+ end
27
+
28
+ def test_get_registration_returns_expected_result
29
+ stub_request(:get, %r{\Ahttps://api\.workos\.com/agents/registrations/stub(\?|\z)})
30
+ .to_return(body: "{}", status: 200)
31
+ result = @client.agents.get_registration(id: "stub")
32
+ refute_nil result
33
+ end
34
+
35
+ # Parameterized authentication error tests (one per endpoint).
36
+ [
37
+ {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
+ {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"}}
40
+ ].each do |spec|
41
+ define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do
42
+ stub_request(spec[:verb], spec[:url])
43
+ .to_return(body: '{"message": "Unauthorized"}', status: 401)
44
+ assert_raises(WorkOS::AuthenticationError) do
45
+ @client.agents.send(spec[:name], **(spec[:args] || {}))
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,165 @@
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 AgentsModelRoundTripTest < Minitest::Test
8
+ def test_agent_registration_round_trip
9
+ fixture = {
10
+ "id" => "stub",
11
+ "agent_identity" => {},
12
+ "organization_id" => "stub",
13
+ "status" => "stub",
14
+ "kind" => "stub",
15
+ "claim" => nil,
16
+ "created_at" => "stub",
17
+ "updated_at" => "stub"
18
+ }
19
+ model = WorkOS::AgentRegistration.new(fixture.to_json)
20
+ json = model.to_h
21
+ assert_kind_of Hash, json
22
+ assert_equal fixture["id"], json[:id]
23
+ assert_equal fixture["organization_id"], json[:organization_id]
24
+ assert_equal fixture["created_at"], json[:created_at]
25
+ assert_equal fixture["updated_at"], json[:updated_at]
26
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
27
+ end
28
+
29
+ def test_agent_credential_validation_round_trip
30
+ fixture = {
31
+ "valid" => true,
32
+ "registration_id" => nil,
33
+ "expires_at" => nil
34
+ }
35
+ model = WorkOS::AgentCredentialValidation.new(fixture.to_json)
36
+ json = model.to_h
37
+ assert_kind_of Hash, json
38
+ assert_equal fixture["valid"], json[:valid]
39
+ assert_nil json[:registration_id]
40
+ assert_nil json[:expires_at]
41
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
42
+ end
43
+
44
+ def test_claim_view_response_round_trip
45
+ fixture = {
46
+ "id" => "stub",
47
+ "status" => "stub",
48
+ "user_code" => "stub",
49
+ "organizations" => []
50
+ }
51
+ model = WorkOS::ClaimViewResponse.new(fixture.to_json)
52
+ json = model.to_h
53
+ assert_kind_of Hash, json
54
+ assert_equal fixture["id"], json[:id]
55
+ assert_equal fixture["user_code"], json[:user_code]
56
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
57
+ end
58
+
59
+ def test_claim_view_response_organization_round_trip
60
+ fixture = {
61
+ "id" => "stub",
62
+ "name" => "stub"
63
+ }
64
+ model = WorkOS::ClaimViewResponseOrganization.new(fixture.to_json)
65
+ json = model.to_h
66
+ assert_kind_of Hash, json
67
+ assert_equal fixture["id"], json[:id]
68
+ assert_equal fixture["name"], json[:name]
69
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
70
+ end
71
+
72
+ def test_agent_registration_agent_identity_round_trip
73
+ fixture = {
74
+ "id" => "stub",
75
+ "userland_user_id" => nil,
76
+ "created_at" => "stub",
77
+ "updated_at" => "stub"
78
+ }
79
+ model = WorkOS::AgentRegistrationAgentIdentity.new(fixture.to_json)
80
+ json = model.to_h
81
+ assert_kind_of Hash, json
82
+ assert_equal fixture["id"], json[:id]
83
+ assert_nil json[:userland_user_id]
84
+ assert_equal fixture["created_at"], json[:created_at]
85
+ assert_equal fixture["updated_at"], json[:updated_at]
86
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
87
+ end
88
+
89
+ def test_agent_registration_claim_round_trip
90
+ fixture = {
91
+ "id" => "stub",
92
+ "claim_completion" => nil,
93
+ "created_at" => "stub",
94
+ "updated_at" => "stub",
95
+ "expires_at" => "stub"
96
+ }
97
+ model = WorkOS::AgentRegistrationClaim.new(fixture.to_json)
98
+ json = model.to_h
99
+ assert_kind_of Hash, json
100
+ assert_equal fixture["id"], json[:id]
101
+ assert_equal fixture["created_at"], json[:created_at]
102
+ assert_equal fixture["updated_at"], json[:updated_at]
103
+ assert_equal fixture["expires_at"], json[:expires_at]
104
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
105
+ end
106
+
107
+ def test_agent_admin_link_claim_attempt_to_external_user_request_round_trip
108
+ fixture = {
109
+ "type" => "link_external_user",
110
+ "claim_attempt_token" => "stub",
111
+ "user" => {},
112
+ "organization_id" => "stub"
113
+ }
114
+ model = WorkOS::AgentAdminLinkClaimAttemptToExternalUserRequest.new(fixture.to_json)
115
+ json = model.to_h
116
+ assert_kind_of Hash, json
117
+ assert_equal fixture["claim_attempt_token"], json[:claim_attempt_token]
118
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
119
+ end
120
+
121
+ def test_agent_admin_link_claim_attempt_to_external_user_request_user_round_trip
122
+ fixture = {
123
+ "email" => "stub",
124
+ "external_id" => "stub"
125
+ }
126
+ model = WorkOS::AgentAdminLinkClaimAttemptToExternalUserRequestUser.new(fixture.to_json)
127
+ json = model.to_h
128
+ assert_kind_of Hash, json
129
+ assert_equal fixture["email"], json[:email]
130
+ assert_equal fixture["external_id"], json[:external_id]
131
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
132
+ end
133
+
134
+ def test_agent_admin_validate_credential_request_round_trip
135
+ fixture = {
136
+ "type" => "stub",
137
+ "credential" => "stub",
138
+ "audience" => "stub"
139
+ }
140
+ model = WorkOS::AgentAdminValidateCredentialRequest.new(fixture.to_json)
141
+ json = model.to_h
142
+ assert_kind_of Hash, json
143
+ assert_equal fixture["credential"], json[:credential]
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_agent_registration_claim_claim_completion_round_trip
148
+ fixture = {
149
+ "id" => "stub",
150
+ "created_at" => "stub",
151
+ "updated_at" => "stub",
152
+ "expires_at" => "stub",
153
+ "claimed_at" => "stub"
154
+ }
155
+ model = WorkOS::AgentRegistrationClaimClaimCompletion.new(fixture.to_json)
156
+ json = model.to_h
157
+ assert_kind_of Hash, json
158
+ assert_equal fixture["id"], json[:id]
159
+ assert_equal fixture["created_at"], json[:created_at]
160
+ assert_equal fixture["updated_at"], json[:updated_at]
161
+ assert_equal fixture["expires_at"], json[:expires_at]
162
+ assert_equal fixture["claimed_at"], json[:claimed_at]
163
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
164
+ end
165
+ end
@@ -0,0 +1,307 @@
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 ApiKeysModelRoundTripTest < Minitest::Test
8
+ def test_validate_api_key_round_trip
9
+ fixture = {
10
+ "value" => "stub"
11
+ }
12
+ model = WorkOS::ValidateApiKey.new(fixture.to_json)
13
+ json = model.to_h
14
+ assert_kind_of Hash, json
15
+ assert_equal fixture["value"], json[:value]
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_expire_api_key_round_trip
20
+ fixture = {
21
+ "expires_at" => nil
22
+ }
23
+ model = WorkOS::ExpireApiKey.new(fixture.to_json)
24
+ json = model.to_h
25
+ assert_kind_of Hash, json
26
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
27
+ end
28
+
29
+ def test_create_organization_api_key_round_trip
30
+ fixture = {
31
+ "name" => "stub",
32
+ "permissions" => [],
33
+ "expires_at" => "stub"
34
+ }
35
+ model = WorkOS::CreateOrganizationApiKey.new(fixture.to_json)
36
+ json = model.to_h
37
+ assert_kind_of Hash, json
38
+ assert_equal fixture["name"], json[:name]
39
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
40
+ end
41
+
42
+ def test_api_key_round_trip
43
+ fixture = {
44
+ "object" => "api_key",
45
+ "id" => "stub",
46
+ "owner" => {},
47
+ "name" => "stub",
48
+ "obfuscated_value" => "stub",
49
+ "last_used_at" => nil,
50
+ "expires_at" => nil,
51
+ "permissions" => [],
52
+ "created_at" => "stub",
53
+ "updated_at" => "stub"
54
+ }
55
+ model = WorkOS::ApiKey.new(fixture.to_json)
56
+ json = model.to_h
57
+ assert_kind_of Hash, json
58
+ assert_equal fixture["id"], json[:id]
59
+ assert_equal fixture["name"], json[:name]
60
+ assert_equal fixture["obfuscated_value"], json[:obfuscated_value]
61
+ assert_nil json[:last_used_at]
62
+ assert_nil json[:expires_at]
63
+ assert_equal fixture["created_at"], json[:created_at]
64
+ assert_equal fixture["updated_at"], json[:updated_at]
65
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
66
+ end
67
+
68
+ def test_api_key_validation_response_round_trip
69
+ fixture = {
70
+ "api_key" => nil,
71
+ "agent_registration_id" => "stub"
72
+ }
73
+ model = WorkOS::ApiKeyValidationResponse.new(fixture.to_json)
74
+ json = model.to_h
75
+ assert_kind_of Hash, json
76
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
77
+ end
78
+
79
+ def test_api_key_created_round_trip
80
+ fixture = {
81
+ "object" => "event",
82
+ "id" => "stub",
83
+ "event" => "api_key.created",
84
+ "data" => {},
85
+ "created_at" => "stub",
86
+ "context" => {}
87
+ }
88
+ model = WorkOS::ApiKeyCreated.new(fixture.to_json)
89
+ json = model.to_h
90
+ assert_kind_of Hash, json
91
+ assert_equal fixture["id"], json[:id]
92
+ assert_equal fixture["created_at"], json[:created_at]
93
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
94
+ end
95
+
96
+ def test_api_key_created_data_round_trip
97
+ fixture = {
98
+ "object" => "api_key",
99
+ "id" => "stub",
100
+ "owner" => {},
101
+ "name" => "stub",
102
+ "obfuscated_value" => "stub",
103
+ "last_used_at" => nil,
104
+ "expires_at" => nil,
105
+ "permissions" => [],
106
+ "created_at" => "stub",
107
+ "updated_at" => "stub"
108
+ }
109
+ model = WorkOS::ApiKeyCreatedData.new(fixture.to_json)
110
+ json = model.to_h
111
+ assert_kind_of Hash, json
112
+ assert_equal fixture["id"], json[:id]
113
+ assert_equal fixture["name"], json[:name]
114
+ assert_equal fixture["obfuscated_value"], json[:obfuscated_value]
115
+ assert_nil json[:last_used_at]
116
+ assert_nil json[:expires_at]
117
+ assert_equal fixture["created_at"], json[:created_at]
118
+ assert_equal fixture["updated_at"], json[:updated_at]
119
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
120
+ end
121
+
122
+ def test_api_key_created_data_owner_round_trip
123
+ fixture = {
124
+ "type" => "organization",
125
+ "id" => "stub"
126
+ }
127
+ model = WorkOS::ApiKeyCreatedDataOwner.new(fixture.to_json)
128
+ json = model.to_h
129
+ assert_kind_of Hash, json
130
+ assert_equal fixture["id"], json[:id]
131
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
132
+ end
133
+
134
+ def test_api_key_revoked_round_trip
135
+ fixture = {
136
+ "object" => "event",
137
+ "id" => "stub",
138
+ "event" => "api_key.revoked",
139
+ "data" => {},
140
+ "created_at" => "stub",
141
+ "context" => {}
142
+ }
143
+ model = WorkOS::ApiKeyRevoked.new(fixture.to_json)
144
+ json = model.to_h
145
+ assert_kind_of Hash, json
146
+ assert_equal fixture["id"], json[:id]
147
+ assert_equal fixture["created_at"], json[:created_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_api_key_revoked_data_round_trip
152
+ fixture = {
153
+ "object" => "api_key",
154
+ "id" => "stub",
155
+ "owner" => {},
156
+ "name" => "stub",
157
+ "obfuscated_value" => "stub",
158
+ "last_used_at" => nil,
159
+ "expires_at" => nil,
160
+ "permissions" => [],
161
+ "created_at" => "stub",
162
+ "updated_at" => "stub"
163
+ }
164
+ model = WorkOS::ApiKeyRevokedData.new(fixture.to_json)
165
+ json = model.to_h
166
+ assert_kind_of Hash, json
167
+ assert_equal fixture["id"], json[:id]
168
+ assert_equal fixture["name"], json[:name]
169
+ assert_equal fixture["obfuscated_value"], json[:obfuscated_value]
170
+ assert_nil json[:last_used_at]
171
+ assert_nil json[:expires_at]
172
+ assert_equal fixture["created_at"], json[:created_at]
173
+ assert_equal fixture["updated_at"], json[:updated_at]
174
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
175
+ end
176
+
177
+ def test_api_key_revoked_data_owner_round_trip
178
+ fixture = {
179
+ "type" => "organization",
180
+ "id" => "stub"
181
+ }
182
+ model = WorkOS::ApiKeyRevokedDataOwner.new(fixture.to_json)
183
+ json = model.to_h
184
+ assert_kind_of Hash, json
185
+ assert_equal fixture["id"], json[:id]
186
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
187
+ end
188
+
189
+ def test_api_key_updated_round_trip
190
+ fixture = {
191
+ "object" => "event",
192
+ "id" => "stub",
193
+ "event" => "api_key.updated",
194
+ "data" => {},
195
+ "created_at" => "stub",
196
+ "context" => {}
197
+ }
198
+ model = WorkOS::ApiKeyUpdated.new(fixture.to_json)
199
+ json = model.to_h
200
+ assert_kind_of Hash, json
201
+ assert_equal fixture["id"], json[:id]
202
+ assert_equal fixture["created_at"], json[:created_at]
203
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
204
+ end
205
+
206
+ def test_api_key_updated_data_round_trip
207
+ fixture = {
208
+ "object" => "api_key",
209
+ "id" => "stub",
210
+ "owner" => {},
211
+ "name" => "stub",
212
+ "obfuscated_value" => "stub",
213
+ "last_used_at" => nil,
214
+ "expires_at" => nil,
215
+ "permissions" => [],
216
+ "created_at" => "stub",
217
+ "updated_at" => "stub",
218
+ "previous_attributes" => {}
219
+ }
220
+ model = WorkOS::ApiKeyUpdatedData.new(fixture.to_json)
221
+ json = model.to_h
222
+ assert_kind_of Hash, json
223
+ assert_equal fixture["id"], json[:id]
224
+ assert_equal fixture["name"], json[:name]
225
+ assert_equal fixture["obfuscated_value"], json[:obfuscated_value]
226
+ assert_nil json[:last_used_at]
227
+ assert_nil json[:expires_at]
228
+ assert_equal fixture["created_at"], json[:created_at]
229
+ assert_equal fixture["updated_at"], json[:updated_at]
230
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
231
+ end
232
+
233
+ def test_api_key_updated_data_owner_round_trip
234
+ fixture = {
235
+ "type" => "organization",
236
+ "id" => "stub"
237
+ }
238
+ model = WorkOS::ApiKeyUpdatedDataOwner.new(fixture.to_json)
239
+ json = model.to_h
240
+ assert_kind_of Hash, json
241
+ assert_equal fixture["id"], json[:id]
242
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
243
+ end
244
+
245
+ def test_api_key_updated_data_previous_attribute_round_trip
246
+ fixture = {
247
+ "expires_at" => nil
248
+ }
249
+ model = WorkOS::ApiKeyUpdatedDataPreviousAttribute.new(fixture.to_json)
250
+ json = model.to_h
251
+ assert_kind_of Hash, json
252
+ assert_nil json[:expires_at]
253
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
254
+ end
255
+
256
+ def test_organization_api_key_with_value_round_trip
257
+ fixture = {
258
+ "object" => "api_key",
259
+ "id" => "stub",
260
+ "owner" => {},
261
+ "name" => "stub",
262
+ "obfuscated_value" => "stub",
263
+ "last_used_at" => nil,
264
+ "expires_at" => nil,
265
+ "permissions" => [],
266
+ "created_at" => "stub",
267
+ "updated_at" => "stub",
268
+ "value" => "stub"
269
+ }
270
+ model = WorkOS::OrganizationApiKeyWithValue.new(fixture.to_json)
271
+ json = model.to_h
272
+ assert_kind_of Hash, json
273
+ assert_equal fixture["id"], json[:id]
274
+ assert_equal fixture["name"], json[:name]
275
+ assert_equal fixture["obfuscated_value"], json[:obfuscated_value]
276
+ assert_nil json[:last_used_at]
277
+ assert_nil json[:expires_at]
278
+ assert_equal fixture["created_at"], json[:created_at]
279
+ assert_equal fixture["updated_at"], json[:updated_at]
280
+ assert_equal fixture["value"], json[:value]
281
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
282
+ end
283
+
284
+ def test_organization_api_key_with_value_owner_round_trip
285
+ fixture = {
286
+ "type" => "organization",
287
+ "id" => "stub"
288
+ }
289
+ model = WorkOS::OrganizationApiKeyWithValueOwner.new(fixture.to_json)
290
+ json = model.to_h
291
+ assert_kind_of Hash, json
292
+ assert_equal fixture["id"], json[:id]
293
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
294
+ end
295
+
296
+ def test_api_key_owner_round_trip
297
+ fixture = {
298
+ "type" => "organization",
299
+ "id" => "stub"
300
+ }
301
+ model = WorkOS::ApiKeyOwner.new(fixture.to_json)
302
+ json = model.to_h
303
+ assert_kind_of Hash, json
304
+ assert_equal fixture["id"], json[:id]
305
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
306
+ end
307
+ end