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,580 @@
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 FeatureFlagsModelRoundTripTest < Minitest::Test
8
+ def test_flag_created_round_trip
9
+ fixture = {
10
+ "object" => "event",
11
+ "id" => "stub",
12
+ "event" => "flag.created",
13
+ "data" => {},
14
+ "created_at" => "stub",
15
+ "context" => {}
16
+ }
17
+ model = WorkOS::FlagCreated.new(fixture.to_json)
18
+ json = model.to_h
19
+ assert_kind_of Hash, json
20
+ assert_equal fixture["id"], json[:id]
21
+ assert_equal fixture["created_at"], json[:created_at]
22
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
23
+ end
24
+
25
+ def test_flag_created_data_round_trip
26
+ fixture = {
27
+ "object" => "feature_flag",
28
+ "id" => "stub",
29
+ "environment_id" => "stub",
30
+ "slug" => "stub",
31
+ "name" => "stub",
32
+ "description" => nil,
33
+ "owner" => nil,
34
+ "tags" => [],
35
+ "enabled" => true,
36
+ "default_value" => true,
37
+ "created_at" => "stub",
38
+ "updated_at" => "stub"
39
+ }
40
+ model = WorkOS::FlagCreatedData.new(fixture.to_json)
41
+ json = model.to_h
42
+ assert_kind_of Hash, json
43
+ assert_equal fixture["id"], json[:id]
44
+ assert_equal fixture["environment_id"], json[:environment_id]
45
+ assert_equal fixture["slug"], json[:slug]
46
+ assert_equal fixture["name"], json[:name]
47
+ assert_nil json[:description]
48
+ assert_equal fixture["enabled"], json[:enabled]
49
+ assert_equal fixture["default_value"], json[:default_value]
50
+ assert_equal fixture["created_at"], json[:created_at]
51
+ assert_equal fixture["updated_at"], json[:updated_at]
52
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
53
+ end
54
+
55
+ def test_flag_created_data_owner_round_trip
56
+ fixture = {
57
+ "email" => "stub",
58
+ "first_name" => nil,
59
+ "last_name" => nil
60
+ }
61
+ model = WorkOS::FlagCreatedDataOwner.new(fixture.to_json)
62
+ json = model.to_h
63
+ assert_kind_of Hash, json
64
+ assert_equal fixture["email"], json[:email]
65
+ assert_nil json[:first_name]
66
+ assert_nil json[:last_name]
67
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
68
+ end
69
+
70
+ def test_flag_created_context_round_trip
71
+ fixture = {
72
+ "client_id" => "stub",
73
+ "actor" => {}
74
+ }
75
+ model = WorkOS::FlagCreatedContext.new(fixture.to_json)
76
+ json = model.to_h
77
+ assert_kind_of Hash, json
78
+ assert_equal fixture["client_id"], json[:client_id]
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_flag_created_context_actor_round_trip
83
+ fixture = {
84
+ "id" => "stub",
85
+ "source" => "stub",
86
+ "name" => nil
87
+ }
88
+ model = WorkOS::FlagCreatedContextActor.new(fixture.to_json)
89
+ json = model.to_h
90
+ assert_kind_of Hash, json
91
+ assert_equal fixture["id"], json[:id]
92
+ assert_nil json[:name]
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_flag_deleted_round_trip
97
+ fixture = {
98
+ "object" => "event",
99
+ "id" => "stub",
100
+ "event" => "flag.deleted",
101
+ "data" => {},
102
+ "created_at" => "stub",
103
+ "context" => {}
104
+ }
105
+ model = WorkOS::FlagDeleted.new(fixture.to_json)
106
+ json = model.to_h
107
+ assert_kind_of Hash, json
108
+ assert_equal fixture["id"], json[:id]
109
+ assert_equal fixture["created_at"], json[:created_at]
110
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
111
+ end
112
+
113
+ def test_flag_deleted_data_round_trip
114
+ fixture = {
115
+ "object" => "feature_flag",
116
+ "id" => "stub",
117
+ "environment_id" => "stub",
118
+ "slug" => "stub",
119
+ "name" => "stub",
120
+ "description" => nil,
121
+ "owner" => nil,
122
+ "tags" => [],
123
+ "enabled" => true,
124
+ "default_value" => true,
125
+ "created_at" => "stub",
126
+ "updated_at" => "stub"
127
+ }
128
+ model = WorkOS::FlagDeletedData.new(fixture.to_json)
129
+ json = model.to_h
130
+ assert_kind_of Hash, json
131
+ assert_equal fixture["id"], json[:id]
132
+ assert_equal fixture["environment_id"], json[:environment_id]
133
+ assert_equal fixture["slug"], json[:slug]
134
+ assert_equal fixture["name"], json[:name]
135
+ assert_nil json[:description]
136
+ assert_equal fixture["enabled"], json[:enabled]
137
+ assert_equal fixture["default_value"], json[:default_value]
138
+ assert_equal fixture["created_at"], json[:created_at]
139
+ assert_equal fixture["updated_at"], json[:updated_at]
140
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
141
+ end
142
+
143
+ def test_flag_deleted_data_owner_round_trip
144
+ fixture = {
145
+ "email" => "stub",
146
+ "first_name" => nil,
147
+ "last_name" => nil
148
+ }
149
+ model = WorkOS::FlagDeletedDataOwner.new(fixture.to_json)
150
+ json = model.to_h
151
+ assert_kind_of Hash, json
152
+ assert_equal fixture["email"], json[:email]
153
+ assert_nil json[:first_name]
154
+ assert_nil json[:last_name]
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_flag_deleted_context_round_trip
159
+ fixture = {
160
+ "client_id" => "stub",
161
+ "actor" => {}
162
+ }
163
+ model = WorkOS::FlagDeletedContext.new(fixture.to_json)
164
+ json = model.to_h
165
+ assert_kind_of Hash, json
166
+ assert_equal fixture["client_id"], json[:client_id]
167
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
168
+ end
169
+
170
+ def test_flag_deleted_context_actor_round_trip
171
+ fixture = {
172
+ "id" => "stub",
173
+ "source" => "stub",
174
+ "name" => nil
175
+ }
176
+ model = WorkOS::FlagDeletedContextActor.new(fixture.to_json)
177
+ json = model.to_h
178
+ assert_kind_of Hash, json
179
+ assert_equal fixture["id"], json[:id]
180
+ assert_nil json[:name]
181
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
182
+ end
183
+
184
+ def test_flag_rule_updated_round_trip
185
+ fixture = {
186
+ "object" => "event",
187
+ "id" => "stub",
188
+ "event" => "flag.rule_updated",
189
+ "data" => {},
190
+ "created_at" => "stub",
191
+ "context" => {}
192
+ }
193
+ model = WorkOS::FlagRuleUpdated.new(fixture.to_json)
194
+ json = model.to_h
195
+ assert_kind_of Hash, json
196
+ assert_equal fixture["id"], json[:id]
197
+ assert_equal fixture["created_at"], json[:created_at]
198
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
199
+ end
200
+
201
+ def test_flag_rule_updated_data_round_trip
202
+ fixture = {
203
+ "object" => "feature_flag",
204
+ "id" => "stub",
205
+ "environment_id" => "stub",
206
+ "slug" => "stub",
207
+ "name" => "stub",
208
+ "description" => nil,
209
+ "owner" => nil,
210
+ "tags" => [],
211
+ "enabled" => true,
212
+ "default_value" => true,
213
+ "created_at" => "stub",
214
+ "updated_at" => "stub"
215
+ }
216
+ model = WorkOS::FlagRuleUpdatedData.new(fixture.to_json)
217
+ json = model.to_h
218
+ assert_kind_of Hash, json
219
+ assert_equal fixture["id"], json[:id]
220
+ assert_equal fixture["environment_id"], json[:environment_id]
221
+ assert_equal fixture["slug"], json[:slug]
222
+ assert_equal fixture["name"], json[:name]
223
+ assert_nil json[:description]
224
+ assert_equal fixture["enabled"], json[:enabled]
225
+ assert_equal fixture["default_value"], json[:default_value]
226
+ assert_equal fixture["created_at"], json[:created_at]
227
+ assert_equal fixture["updated_at"], json[:updated_at]
228
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
229
+ end
230
+
231
+ def test_flag_rule_updated_data_owner_round_trip
232
+ fixture = {
233
+ "email" => "stub",
234
+ "first_name" => nil,
235
+ "last_name" => nil
236
+ }
237
+ model = WorkOS::FlagRuleUpdatedDataOwner.new(fixture.to_json)
238
+ json = model.to_h
239
+ assert_kind_of Hash, json
240
+ assert_equal fixture["email"], json[:email]
241
+ assert_nil json[:first_name]
242
+ assert_nil json[:last_name]
243
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
244
+ end
245
+
246
+ def test_flag_rule_updated_context_round_trip
247
+ fixture = {
248
+ "client_id" => "stub",
249
+ "actor" => {},
250
+ "access_type" => "stub",
251
+ "configured_targets" => {},
252
+ "previous_attributes" => {}
253
+ }
254
+ model = WorkOS::FlagRuleUpdatedContext.new(fixture.to_json)
255
+ json = model.to_h
256
+ assert_kind_of Hash, json
257
+ assert_equal fixture["client_id"], json[:client_id]
258
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
259
+ end
260
+
261
+ def test_flag_rule_updated_context_actor_round_trip
262
+ fixture = {
263
+ "id" => "stub",
264
+ "source" => "stub",
265
+ "name" => nil
266
+ }
267
+ model = WorkOS::FlagRuleUpdatedContextActor.new(fixture.to_json)
268
+ json = model.to_h
269
+ assert_kind_of Hash, json
270
+ assert_equal fixture["id"], json[:id]
271
+ assert_nil json[:name]
272
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
273
+ end
274
+
275
+ def test_flag_rule_updated_context_configured_target_round_trip
276
+ fixture = {
277
+ "organizations" => [],
278
+ "users" => []
279
+ }
280
+ model = WorkOS::FlagRuleUpdatedContextConfiguredTarget.new(fixture.to_json)
281
+ json = model.to_h
282
+ assert_kind_of Hash, json
283
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
284
+ end
285
+
286
+ def test_flag_rule_updated_context_configured_target_organization_round_trip
287
+ fixture = {
288
+ "id" => "stub",
289
+ "name" => "stub"
290
+ }
291
+ model = WorkOS::FlagRuleUpdatedContextConfiguredTargetOrganization.new(fixture.to_json)
292
+ json = model.to_h
293
+ assert_kind_of Hash, json
294
+ assert_equal fixture["id"], json[:id]
295
+ assert_equal fixture["name"], json[:name]
296
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
297
+ end
298
+
299
+ def test_flag_rule_updated_context_configured_target_user_round_trip
300
+ fixture = {
301
+ "id" => "stub",
302
+ "email" => "stub"
303
+ }
304
+ model = WorkOS::FlagRuleUpdatedContextConfiguredTargetUser.new(fixture.to_json)
305
+ json = model.to_h
306
+ assert_kind_of Hash, json
307
+ assert_equal fixture["id"], json[:id]
308
+ assert_equal fixture["email"], json[:email]
309
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
310
+ end
311
+
312
+ def test_flag_rule_updated_context_previous_attribute_round_trip
313
+ fixture = {
314
+ "data" => {},
315
+ "context" => {}
316
+ }
317
+ model = WorkOS::FlagRuleUpdatedContextPreviousAttribute.new(fixture.to_json)
318
+ json = model.to_h
319
+ assert_kind_of Hash, json
320
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
321
+ end
322
+
323
+ def test_flag_rule_updated_context_previous_attribute_data_round_trip
324
+ fixture = {
325
+ "enabled" => true,
326
+ "default_value" => true
327
+ }
328
+ model = WorkOS::FlagRuleUpdatedContextPreviousAttributeData.new(fixture.to_json)
329
+ json = model.to_h
330
+ assert_kind_of Hash, json
331
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
332
+ end
333
+
334
+ def test_flag_rule_updated_context_previous_attribute_context_round_trip
335
+ fixture = {
336
+ "access_type" => "stub",
337
+ "configured_targets" => {}
338
+ }
339
+ model = WorkOS::FlagRuleUpdatedContextPreviousAttributeContext.new(fixture.to_json)
340
+ json = model.to_h
341
+ assert_kind_of Hash, json
342
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
343
+ end
344
+
345
+ def test_flag_rule_updated_context_previous_attribute_context_configured_target_round_trip
346
+ fixture = {
347
+ "organizations" => [],
348
+ "users" => []
349
+ }
350
+ model = WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.new(fixture.to_json)
351
+ json = model.to_h
352
+ assert_kind_of Hash, json
353
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
354
+ end
355
+
356
+ def test_flag_rule_updated_context_previous_attribute_context_configured_target_organization_round_trip
357
+ fixture = {
358
+ "id" => "stub",
359
+ "name" => "stub"
360
+ }
361
+ model = WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization.new(fixture.to_json)
362
+ json = model.to_h
363
+ assert_kind_of Hash, json
364
+ assert_equal fixture["id"], json[:id]
365
+ assert_equal fixture["name"], json[:name]
366
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
367
+ end
368
+
369
+ def test_flag_rule_updated_context_previous_attribute_context_configured_target_user_round_trip
370
+ fixture = {
371
+ "id" => "stub",
372
+ "email" => "stub"
373
+ }
374
+ model = WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser.new(fixture.to_json)
375
+ json = model.to_h
376
+ assert_kind_of Hash, json
377
+ assert_equal fixture["id"], json[:id]
378
+ assert_equal fixture["email"], json[:email]
379
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
380
+ end
381
+
382
+ def test_flag_updated_round_trip
383
+ fixture = {
384
+ "object" => "event",
385
+ "id" => "stub",
386
+ "event" => "flag.updated",
387
+ "data" => {},
388
+ "created_at" => "stub",
389
+ "context" => {}
390
+ }
391
+ model = WorkOS::FlagUpdated.new(fixture.to_json)
392
+ json = model.to_h
393
+ assert_kind_of Hash, json
394
+ assert_equal fixture["id"], json[:id]
395
+ assert_equal fixture["created_at"], json[:created_at]
396
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
397
+ end
398
+
399
+ def test_flag_updated_data_round_trip
400
+ fixture = {
401
+ "object" => "feature_flag",
402
+ "id" => "stub",
403
+ "environment_id" => "stub",
404
+ "slug" => "stub",
405
+ "name" => "stub",
406
+ "description" => nil,
407
+ "owner" => nil,
408
+ "tags" => [],
409
+ "enabled" => true,
410
+ "default_value" => true,
411
+ "created_at" => "stub",
412
+ "updated_at" => "stub"
413
+ }
414
+ model = WorkOS::FlagUpdatedData.new(fixture.to_json)
415
+ json = model.to_h
416
+ assert_kind_of Hash, json
417
+ assert_equal fixture["id"], json[:id]
418
+ assert_equal fixture["environment_id"], json[:environment_id]
419
+ assert_equal fixture["slug"], json[:slug]
420
+ assert_equal fixture["name"], json[:name]
421
+ assert_nil json[:description]
422
+ assert_equal fixture["enabled"], json[:enabled]
423
+ assert_equal fixture["default_value"], json[:default_value]
424
+ assert_equal fixture["created_at"], json[:created_at]
425
+ assert_equal fixture["updated_at"], json[:updated_at]
426
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
427
+ end
428
+
429
+ def test_flag_updated_data_owner_round_trip
430
+ fixture = {
431
+ "email" => "stub",
432
+ "first_name" => nil,
433
+ "last_name" => nil
434
+ }
435
+ model = WorkOS::FlagUpdatedDataOwner.new(fixture.to_json)
436
+ json = model.to_h
437
+ assert_kind_of Hash, json
438
+ assert_equal fixture["email"], json[:email]
439
+ assert_nil json[:first_name]
440
+ assert_nil json[:last_name]
441
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
442
+ end
443
+
444
+ def test_flag_updated_context_round_trip
445
+ fixture = {
446
+ "client_id" => "stub",
447
+ "actor" => {},
448
+ "previous_attributes" => {}
449
+ }
450
+ model = WorkOS::FlagUpdatedContext.new(fixture.to_json)
451
+ json = model.to_h
452
+ assert_kind_of Hash, json
453
+ assert_equal fixture["client_id"], json[:client_id]
454
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
455
+ end
456
+
457
+ def test_flag_updated_context_actor_round_trip
458
+ fixture = {
459
+ "id" => "stub",
460
+ "source" => "stub",
461
+ "name" => nil
462
+ }
463
+ model = WorkOS::FlagUpdatedContextActor.new(fixture.to_json)
464
+ json = model.to_h
465
+ assert_kind_of Hash, json
466
+ assert_equal fixture["id"], json[:id]
467
+ assert_nil json[:name]
468
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
469
+ end
470
+
471
+ def test_flag_updated_context_previous_attribute_round_trip
472
+ fixture = {
473
+ "data" => {}
474
+ }
475
+ model = WorkOS::FlagUpdatedContextPreviousAttribute.new(fixture.to_json)
476
+ json = model.to_h
477
+ assert_kind_of Hash, json
478
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
479
+ end
480
+
481
+ def test_flag_updated_context_previous_attribute_data_round_trip
482
+ fixture = {
483
+ "name" => "stub",
484
+ "description" => nil,
485
+ "tags" => [],
486
+ "enabled" => true,
487
+ "default_value" => true
488
+ }
489
+ model = WorkOS::FlagUpdatedContextPreviousAttributeData.new(fixture.to_json)
490
+ json = model.to_h
491
+ assert_kind_of Hash, json
492
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
493
+ end
494
+
495
+ def test_flag_round_trip
496
+ fixture = {
497
+ "object" => "feature_flag",
498
+ "id" => "stub",
499
+ "slug" => "stub",
500
+ "name" => "stub",
501
+ "description" => nil,
502
+ "owner" => nil,
503
+ "tags" => [],
504
+ "enabled" => true,
505
+ "default_value" => true,
506
+ "created_at" => "stub",
507
+ "updated_at" => "stub"
508
+ }
509
+ model = WorkOS::Flag.new(fixture.to_json)
510
+ json = model.to_h
511
+ assert_kind_of Hash, json
512
+ assert_equal fixture["id"], json[:id]
513
+ assert_equal fixture["slug"], json[:slug]
514
+ assert_equal fixture["name"], json[:name]
515
+ assert_nil json[:description]
516
+ assert_equal fixture["enabled"], json[:enabled]
517
+ assert_equal fixture["default_value"], json[:default_value]
518
+ assert_equal fixture["created_at"], json[:created_at]
519
+ assert_equal fixture["updated_at"], json[:updated_at]
520
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
521
+ end
522
+
523
+ def test_flag_owner_round_trip
524
+ fixture = {
525
+ "email" => "stub",
526
+ "first_name" => nil,
527
+ "last_name" => nil
528
+ }
529
+ model = WorkOS::FlagOwner.new(fixture.to_json)
530
+ json = model.to_h
531
+ assert_kind_of Hash, json
532
+ assert_equal fixture["email"], json[:email]
533
+ assert_nil json[:first_name]
534
+ assert_nil json[:last_name]
535
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
536
+ end
537
+
538
+ def test_feature_flag_round_trip
539
+ fixture = {
540
+ "object" => "feature_flag",
541
+ "id" => "stub",
542
+ "slug" => "stub",
543
+ "name" => "stub",
544
+ "description" => nil,
545
+ "owner" => nil,
546
+ "tags" => [],
547
+ "enabled" => true,
548
+ "default_value" => true,
549
+ "created_at" => "stub",
550
+ "updated_at" => "stub"
551
+ }
552
+ model = WorkOS::FeatureFlag.new(fixture.to_json)
553
+ json = model.to_h
554
+ assert_kind_of Hash, json
555
+ assert_equal fixture["id"], json[:id]
556
+ assert_equal fixture["slug"], json[:slug]
557
+ assert_equal fixture["name"], json[:name]
558
+ assert_nil json[:description]
559
+ assert_equal fixture["enabled"], json[:enabled]
560
+ assert_equal fixture["default_value"], json[:default_value]
561
+ assert_equal fixture["created_at"], json[:created_at]
562
+ assert_equal fixture["updated_at"], json[:updated_at]
563
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
564
+ end
565
+
566
+ def test_feature_flag_owner_round_trip
567
+ fixture = {
568
+ "email" => "stub",
569
+ "first_name" => nil,
570
+ "last_name" => nil
571
+ }
572
+ model = WorkOS::FeatureFlagOwner.new(fixture.to_json)
573
+ json = model.to_h
574
+ assert_kind_of Hash, json
575
+ assert_equal fixture["email"], json[:email]
576
+ assert_nil json[:first_name]
577
+ assert_nil json[:last_name]
578
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
579
+ end
580
+ end
@@ -5,6 +5,62 @@
5
5
  require "test_helper"
6
6
 
7
7
  class GroupsModelRoundTripTest < Minitest::Test
8
+ def test_create_group_membership_round_trip
9
+ fixture = {
10
+ "organization_membership_id" => "stub"
11
+ }
12
+ model = WorkOS::CreateGroupMembership.new(fixture.to_json)
13
+ json = model.to_h
14
+ assert_kind_of Hash, json
15
+ assert_equal fixture["organization_membership_id"], json[:organization_membership_id]
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_group_round_trip
20
+ fixture = {
21
+ "name" => "stub",
22
+ "description" => nil
23
+ }
24
+ model = WorkOS::CreateGroup.new(fixture.to_json)
25
+ json = model.to_h
26
+ assert_kind_of Hash, json
27
+ assert_equal fixture["name"], json[:name]
28
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
29
+ end
30
+
31
+ def test_update_group_round_trip
32
+ fixture = {
33
+ "name" => "stub",
34
+ "description" => nil
35
+ }
36
+ model = WorkOS::UpdateGroup.new(fixture.to_json)
37
+ json = model.to_h
38
+ assert_kind_of Hash, json
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_group_round_trip
43
+ fixture = {
44
+ "object" => "group",
45
+ "id" => "stub",
46
+ "organization_id" => "stub",
47
+ "name" => "stub",
48
+ "description" => nil,
49
+ "created_at" => "stub",
50
+ "updated_at" => "stub"
51
+ }
52
+ model = WorkOS::Group.new(fixture.to_json)
53
+ json = model.to_h
54
+ assert_kind_of Hash, json
55
+ assert_equal fixture["id"], json[:id]
56
+ assert_equal fixture["organization_id"], json[:organization_id]
57
+ assert_equal fixture["name"], json[:name]
58
+ assert_nil json[:description]
59
+ assert_equal fixture["created_at"], json[:created_at]
60
+ assert_equal fixture["updated_at"], json[:updated_at]
61
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
62
+ end
63
+
8
64
  def test_user_organization_membership_base_list_data_round_trip
9
65
  fixture = {
10
66
  "object" => "organization_membership",