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,579 @@
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 DirectorySyncModelRoundTripTest < Minitest::Test
8
+ def test_directory_round_trip
9
+ fixture = {
10
+ "object" => "directory",
11
+ "id" => "stub",
12
+ "organization_id" => "stub",
13
+ "external_key" => "stub",
14
+ "type" => "stub",
15
+ "state" => "stub",
16
+ "name" => "stub",
17
+ "domain" => "stub",
18
+ "metadata" => {},
19
+ "created_at" => "stub",
20
+ "updated_at" => "stub"
21
+ }
22
+ model = WorkOS::Directory.new(fixture.to_json)
23
+ json = model.to_h
24
+ assert_kind_of Hash, json
25
+ assert_equal fixture["id"], json[:id]
26
+ assert_equal fixture["organization_id"], json[:organization_id]
27
+ assert_equal fixture["external_key"], json[:external_key]
28
+ assert_equal fixture["name"], json[:name]
29
+ assert_equal fixture["created_at"], json[:created_at]
30
+ assert_equal fixture["updated_at"], json[:updated_at]
31
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
32
+ end
33
+
34
+ def test_directory_group_round_trip
35
+ fixture = {
36
+ "object" => "directory_group",
37
+ "id" => "stub",
38
+ "idp_id" => "stub",
39
+ "directory_id" => "stub",
40
+ "organization_id" => "stub",
41
+ "name" => "stub",
42
+ "raw_attributes" => {},
43
+ "created_at" => "stub",
44
+ "updated_at" => "stub"
45
+ }
46
+ model = WorkOS::DirectoryGroup.new(fixture.to_json)
47
+ json = model.to_h
48
+ assert_kind_of Hash, json
49
+ assert_equal fixture["id"], json[:id]
50
+ assert_equal fixture["idp_id"], json[:idp_id]
51
+ assert_equal fixture["directory_id"], json[:directory_id]
52
+ assert_equal fixture["organization_id"], json[:organization_id]
53
+ assert_equal fixture["name"], json[:name]
54
+ assert_equal fixture["created_at"], json[:created_at]
55
+ assert_equal fixture["updated_at"], json[:updated_at]
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_directory_user_with_groups_round_trip
60
+ fixture = {
61
+ "object" => "directory_user",
62
+ "id" => "stub",
63
+ "directory_id" => "stub",
64
+ "organization_id" => "stub",
65
+ "idp_id" => "stub",
66
+ "email" => nil,
67
+ "first_name" => nil,
68
+ "last_name" => nil,
69
+ "name" => nil,
70
+ "emails" => [],
71
+ "job_title" => nil,
72
+ "username" => nil,
73
+ "state" => "stub",
74
+ "raw_attributes" => {},
75
+ "custom_attributes" => {},
76
+ "role" => {},
77
+ "roles" => [],
78
+ "created_at" => "stub",
79
+ "updated_at" => "stub",
80
+ "groups" => []
81
+ }
82
+ model = WorkOS::DirectoryUserWithGroups.new(fixture.to_json)
83
+ json = model.to_h
84
+ assert_kind_of Hash, json
85
+ assert_equal fixture["id"], json[:id]
86
+ assert_equal fixture["directory_id"], json[:directory_id]
87
+ assert_equal fixture["organization_id"], json[:organization_id]
88
+ assert_equal fixture["idp_id"], json[:idp_id]
89
+ assert_nil json[:email]
90
+ assert_equal fixture["created_at"], json[:created_at]
91
+ assert_equal fixture["updated_at"], json[:updated_at]
92
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
93
+ end
94
+
95
+ def test_directory_user_round_trip
96
+ fixture = {
97
+ "object" => "directory_user",
98
+ "id" => "stub",
99
+ "directory_id" => "stub",
100
+ "organization_id" => "stub",
101
+ "idp_id" => "stub",
102
+ "email" => nil,
103
+ "first_name" => nil,
104
+ "last_name" => nil,
105
+ "name" => nil,
106
+ "emails" => [],
107
+ "job_title" => nil,
108
+ "username" => nil,
109
+ "state" => "stub",
110
+ "raw_attributes" => {},
111
+ "custom_attributes" => {},
112
+ "role" => {},
113
+ "roles" => [],
114
+ "created_at" => "stub",
115
+ "updated_at" => "stub"
116
+ }
117
+ model = WorkOS::DirectoryUser.new(fixture.to_json)
118
+ json = model.to_h
119
+ assert_kind_of Hash, json
120
+ assert_equal fixture["id"], json[:id]
121
+ assert_equal fixture["directory_id"], json[:directory_id]
122
+ assert_equal fixture["organization_id"], json[:organization_id]
123
+ assert_equal fixture["idp_id"], json[:idp_id]
124
+ assert_nil json[:email]
125
+ assert_equal fixture["created_at"], json[:created_at]
126
+ assert_equal fixture["updated_at"], json[:updated_at]
127
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
128
+ end
129
+
130
+ def test_dsync_activated_round_trip
131
+ fixture = {
132
+ "object" => "event",
133
+ "id" => "stub",
134
+ "event" => "dsync.activated",
135
+ "data" => {},
136
+ "created_at" => "stub",
137
+ "context" => {}
138
+ }
139
+ model = WorkOS::DsyncActivated.new(fixture.to_json)
140
+ json = model.to_h
141
+ assert_kind_of Hash, json
142
+ assert_equal fixture["id"], json[:id]
143
+ assert_equal fixture["created_at"], json[:created_at]
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_dsync_activated_data_round_trip
148
+ fixture = {
149
+ "object" => "directory",
150
+ "id" => "stub",
151
+ "organization_id" => "stub",
152
+ "type" => "stub",
153
+ "state" => "stub",
154
+ "name" => "stub",
155
+ "created_at" => "stub",
156
+ "updated_at" => "stub",
157
+ "external_key" => "stub",
158
+ "domains" => []
159
+ }
160
+ model = WorkOS::DsyncActivatedData.new(fixture.to_json)
161
+ json = model.to_h
162
+ assert_kind_of Hash, json
163
+ assert_equal fixture["id"], json[:id]
164
+ assert_equal fixture["name"], json[:name]
165
+ assert_equal fixture["created_at"], json[:created_at]
166
+ assert_equal fixture["updated_at"], json[:updated_at]
167
+ assert_equal fixture["external_key"], json[:external_key]
168
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
169
+ end
170
+
171
+ def test_dsync_activated_data_domain_round_trip
172
+ fixture = {
173
+ "object" => "organization_domain",
174
+ "id" => "stub",
175
+ "domain" => "stub"
176
+ }
177
+ model = WorkOS::DsyncActivatedDataDomain.new(fixture.to_json)
178
+ json = model.to_h
179
+ assert_kind_of Hash, json
180
+ assert_equal fixture["id"], json[:id]
181
+ assert_equal fixture["domain"], json[:domain]
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_dsync_deleted_round_trip
186
+ fixture = {
187
+ "object" => "event",
188
+ "id" => "stub",
189
+ "event" => "dsync.deleted",
190
+ "data" => {},
191
+ "created_at" => "stub",
192
+ "context" => {}
193
+ }
194
+ model = WorkOS::DsyncDeleted.new(fixture.to_json)
195
+ json = model.to_h
196
+ assert_kind_of Hash, json
197
+ assert_equal fixture["id"], json[:id]
198
+ assert_equal fixture["created_at"], json[:created_at]
199
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
200
+ end
201
+
202
+ def test_dsync_deleted_data_round_trip
203
+ fixture = {
204
+ "object" => "directory",
205
+ "id" => "stub",
206
+ "organization_id" => "stub",
207
+ "type" => "stub",
208
+ "state" => "stub",
209
+ "name" => "stub",
210
+ "created_at" => "stub",
211
+ "updated_at" => "stub"
212
+ }
213
+ model = WorkOS::DsyncDeletedData.new(fixture.to_json)
214
+ json = model.to_h
215
+ assert_kind_of Hash, json
216
+ assert_equal fixture["id"], json[:id]
217
+ assert_equal fixture["name"], json[:name]
218
+ assert_equal fixture["created_at"], json[:created_at]
219
+ assert_equal fixture["updated_at"], json[:updated_at]
220
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
221
+ end
222
+
223
+ def test_dsync_group_created_round_trip
224
+ fixture = {
225
+ "object" => "event",
226
+ "id" => "stub",
227
+ "event" => "dsync.group.created",
228
+ "data" => {},
229
+ "created_at" => "stub",
230
+ "context" => {}
231
+ }
232
+ model = WorkOS::DsyncGroupCreated.new(fixture.to_json)
233
+ json = model.to_h
234
+ assert_kind_of Hash, json
235
+ assert_equal fixture["id"], json[:id]
236
+ assert_equal fixture["created_at"], json[:created_at]
237
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
238
+ end
239
+
240
+ def test_dsync_group_deleted_round_trip
241
+ fixture = {
242
+ "object" => "event",
243
+ "id" => "stub",
244
+ "event" => "dsync.group.deleted",
245
+ "data" => {},
246
+ "created_at" => "stub",
247
+ "context" => {}
248
+ }
249
+ model = WorkOS::DsyncGroupDeleted.new(fixture.to_json)
250
+ json = model.to_h
251
+ assert_kind_of Hash, json
252
+ assert_equal fixture["id"], json[:id]
253
+ assert_equal fixture["created_at"], json[:created_at]
254
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
255
+ end
256
+
257
+ def test_dsync_group_updated_round_trip
258
+ fixture = {
259
+ "object" => "event",
260
+ "id" => "stub",
261
+ "event" => "dsync.group.updated",
262
+ "data" => {},
263
+ "created_at" => "stub",
264
+ "context" => {}
265
+ }
266
+ model = WorkOS::DsyncGroupUpdated.new(fixture.to_json)
267
+ json = model.to_h
268
+ assert_kind_of Hash, json
269
+ assert_equal fixture["id"], json[:id]
270
+ assert_equal fixture["created_at"], json[:created_at]
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_dsync_group_updated_data_round_trip
275
+ fixture = {
276
+ "object" => "directory_group",
277
+ "id" => "stub",
278
+ "idp_id" => "stub",
279
+ "directory_id" => "stub",
280
+ "organization_id" => "stub",
281
+ "name" => "stub",
282
+ "raw_attributes" => {},
283
+ "created_at" => "stub",
284
+ "updated_at" => "stub",
285
+ "previous_attributes" => {}
286
+ }
287
+ model = WorkOS::DsyncGroupUpdatedData.new(fixture.to_json)
288
+ json = model.to_h
289
+ assert_kind_of Hash, json
290
+ assert_equal fixture["id"], json[:id]
291
+ assert_equal fixture["idp_id"], json[:idp_id]
292
+ assert_equal fixture["directory_id"], json[:directory_id]
293
+ assert_equal fixture["organization_id"], json[:organization_id]
294
+ assert_equal fixture["name"], json[:name]
295
+ assert_equal fixture["created_at"], json[:created_at]
296
+ assert_equal fixture["updated_at"], json[:updated_at]
297
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
298
+ end
299
+
300
+ def test_dsync_token_created_round_trip
301
+ fixture = {
302
+ "object" => "event",
303
+ "id" => "stub",
304
+ "event" => "dsync.token.created",
305
+ "data" => {},
306
+ "created_at" => "stub",
307
+ "context" => {}
308
+ }
309
+ model = WorkOS::DsyncTokenCreated.new(fixture.to_json)
310
+ json = model.to_h
311
+ assert_kind_of Hash, json
312
+ assert_equal fixture["id"], json[:id]
313
+ assert_equal fixture["created_at"], json[:created_at]
314
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
315
+ end
316
+
317
+ def test_dsync_token_created_data_round_trip
318
+ fixture = {
319
+ "object" => "directory_token",
320
+ "id" => "stub",
321
+ "directory_id" => "stub",
322
+ "organization_id" => "stub",
323
+ "token_suffix" => "stub",
324
+ "created_at" => "stub"
325
+ }
326
+ model = WorkOS::DsyncTokenCreatedData.new(fixture.to_json)
327
+ json = model.to_h
328
+ assert_kind_of Hash, json
329
+ assert_equal fixture["id"], json[:id]
330
+ assert_equal fixture["directory_id"], json[:directory_id]
331
+ assert_equal fixture["token_suffix"], json[:token_suffix]
332
+ assert_equal fixture["created_at"], json[:created_at]
333
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
334
+ end
335
+
336
+ def test_dsync_token_revoked_round_trip
337
+ fixture = {
338
+ "object" => "event",
339
+ "id" => "stub",
340
+ "event" => "dsync.token.revoked",
341
+ "data" => {},
342
+ "created_at" => "stub",
343
+ "context" => {}
344
+ }
345
+ model = WorkOS::DsyncTokenRevoked.new(fixture.to_json)
346
+ json = model.to_h
347
+ assert_kind_of Hash, json
348
+ assert_equal fixture["id"], json[:id]
349
+ assert_equal fixture["created_at"], json[:created_at]
350
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
351
+ end
352
+
353
+ def test_dsync_token_revoked_data_round_trip
354
+ fixture = {
355
+ "object" => "directory_token",
356
+ "id" => "stub",
357
+ "directory_id" => "stub",
358
+ "organization_id" => "stub",
359
+ "token_suffix" => "stub",
360
+ "created_at" => "stub"
361
+ }
362
+ model = WorkOS::DsyncTokenRevokedData.new(fixture.to_json)
363
+ json = model.to_h
364
+ assert_kind_of Hash, json
365
+ assert_equal fixture["id"], json[:id]
366
+ assert_equal fixture["directory_id"], json[:directory_id]
367
+ assert_equal fixture["token_suffix"], json[:token_suffix]
368
+ assert_equal fixture["created_at"], json[:created_at]
369
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
370
+ end
371
+
372
+ def test_dsync_group_user_added_round_trip
373
+ fixture = {
374
+ "object" => "event",
375
+ "id" => "stub",
376
+ "event" => "dsync.group.user_added",
377
+ "data" => {},
378
+ "created_at" => "stub",
379
+ "context" => {}
380
+ }
381
+ model = WorkOS::DsyncGroupUserAdded.new(fixture.to_json)
382
+ json = model.to_h
383
+ assert_kind_of Hash, json
384
+ assert_equal fixture["id"], json[:id]
385
+ assert_equal fixture["created_at"], json[:created_at]
386
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
387
+ end
388
+
389
+ def test_dsync_group_user_added_data_round_trip
390
+ fixture = {
391
+ "directory_id" => "stub",
392
+ "user" => {},
393
+ "group" => {}
394
+ }
395
+ model = WorkOS::DsyncGroupUserAddedData.new(fixture.to_json)
396
+ json = model.to_h
397
+ assert_kind_of Hash, json
398
+ assert_equal fixture["directory_id"], json[:directory_id]
399
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
400
+ end
401
+
402
+ def test_dsync_user_created_round_trip
403
+ fixture = {
404
+ "object" => "event",
405
+ "id" => "stub",
406
+ "event" => "dsync.user.created",
407
+ "data" => {},
408
+ "created_at" => "stub",
409
+ "context" => {}
410
+ }
411
+ model = WorkOS::DsyncUserCreated.new(fixture.to_json)
412
+ json = model.to_h
413
+ assert_kind_of Hash, json
414
+ assert_equal fixture["id"], json[:id]
415
+ assert_equal fixture["created_at"], json[:created_at]
416
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
417
+ end
418
+
419
+ def test_dsync_user_deleted_round_trip
420
+ fixture = {
421
+ "object" => "event",
422
+ "id" => "stub",
423
+ "event" => "dsync.user.deleted",
424
+ "data" => {},
425
+ "created_at" => "stub",
426
+ "context" => {}
427
+ }
428
+ model = WorkOS::DsyncUserDeleted.new(fixture.to_json)
429
+ json = model.to_h
430
+ assert_kind_of Hash, json
431
+ assert_equal fixture["id"], json[:id]
432
+ assert_equal fixture["created_at"], json[:created_at]
433
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
434
+ end
435
+
436
+ def test_dsync_group_user_removed_round_trip
437
+ fixture = {
438
+ "object" => "event",
439
+ "id" => "stub",
440
+ "event" => "dsync.group.user_removed",
441
+ "data" => {},
442
+ "created_at" => "stub",
443
+ "context" => {}
444
+ }
445
+ model = WorkOS::DsyncGroupUserRemoved.new(fixture.to_json)
446
+ json = model.to_h
447
+ assert_kind_of Hash, json
448
+ assert_equal fixture["id"], json[:id]
449
+ assert_equal fixture["created_at"], json[:created_at]
450
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
451
+ end
452
+
453
+ def test_dsync_group_user_removed_data_round_trip
454
+ fixture = {
455
+ "directory_id" => "stub",
456
+ "user" => {},
457
+ "group" => {}
458
+ }
459
+ model = WorkOS::DsyncGroupUserRemovedData.new(fixture.to_json)
460
+ json = model.to_h
461
+ assert_kind_of Hash, json
462
+ assert_equal fixture["directory_id"], json[:directory_id]
463
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
464
+ end
465
+
466
+ def test_dsync_user_updated_round_trip
467
+ fixture = {
468
+ "object" => "event",
469
+ "id" => "stub",
470
+ "event" => "dsync.user.updated",
471
+ "data" => {},
472
+ "created_at" => "stub",
473
+ "context" => {}
474
+ }
475
+ model = WorkOS::DsyncUserUpdated.new(fixture.to_json)
476
+ json = model.to_h
477
+ assert_kind_of Hash, json
478
+ assert_equal fixture["id"], json[:id]
479
+ assert_equal fixture["created_at"], json[:created_at]
480
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
481
+ end
482
+
483
+ def test_dsync_user_updated_data_round_trip
484
+ fixture = {
485
+ "object" => "directory_user",
486
+ "id" => "stub",
487
+ "directory_id" => "stub",
488
+ "organization_id" => "stub",
489
+ "idp_id" => "stub",
490
+ "email" => nil,
491
+ "first_name" => nil,
492
+ "last_name" => nil,
493
+ "name" => nil,
494
+ "emails" => [],
495
+ "job_title" => nil,
496
+ "username" => nil,
497
+ "state" => "stub",
498
+ "raw_attributes" => {},
499
+ "custom_attributes" => {},
500
+ "role" => {},
501
+ "roles" => [],
502
+ "created_at" => "stub",
503
+ "updated_at" => "stub",
504
+ "previous_attributes" => {}
505
+ }
506
+ model = WorkOS::DsyncUserUpdatedData.new(fixture.to_json)
507
+ json = model.to_h
508
+ assert_kind_of Hash, json
509
+ assert_equal fixture["id"], json[:id]
510
+ assert_equal fixture["directory_id"], json[:directory_id]
511
+ assert_equal fixture["organization_id"], json[:organization_id]
512
+ assert_equal fixture["idp_id"], json[:idp_id]
513
+ assert_nil json[:email]
514
+ assert_equal fixture["created_at"], json[:created_at]
515
+ assert_equal fixture["updated_at"], json[:updated_at]
516
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
517
+ end
518
+
519
+ def test_dsync_user_updated_data_email_round_trip
520
+ fixture = {
521
+ "primary" => true,
522
+ "type" => "stub",
523
+ "value" => nil
524
+ }
525
+ model = WorkOS::DsyncUserUpdatedDataEmail.new(fixture.to_json)
526
+ json = model.to_h
527
+ assert_kind_of Hash, json
528
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
529
+ end
530
+
531
+ def test_directory_user_email_round_trip
532
+ fixture = {
533
+ "primary" => true,
534
+ "type" => "stub",
535
+ "value" => nil
536
+ }
537
+ model = WorkOS::DirectoryUserEmail.new(fixture.to_json)
538
+ json = model.to_h
539
+ assert_kind_of Hash, json
540
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
541
+ end
542
+
543
+ def test_directory_user_with_groups_email_round_trip
544
+ fixture = {
545
+ "primary" => true,
546
+ "type" => "stub",
547
+ "value" => nil
548
+ }
549
+ model = WorkOS::DirectoryUserWithGroupsEmail.new(fixture.to_json)
550
+ json = model.to_h
551
+ assert_kind_of Hash, json
552
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
553
+ end
554
+
555
+ def test_directory_metadata_round_trip
556
+ fixture = {
557
+ "users" => {},
558
+ "groups" => 1
559
+ }
560
+ model = WorkOS::DirectoryMetadata.new(fixture.to_json)
561
+ json = model.to_h
562
+ assert_kind_of Hash, json
563
+ assert_equal fixture["groups"], json[:groups]
564
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
565
+ end
566
+
567
+ def test_directory_metadata_user_round_trip
568
+ fixture = {
569
+ "active" => 1,
570
+ "inactive" => 1
571
+ }
572
+ model = WorkOS::DirectoryMetadataUser.new(fixture.to_json)
573
+ json = model.to_h
574
+ assert_kind_of Hash, json
575
+ assert_equal fixture["active"], json[:active]
576
+ assert_equal fixture["inactive"], json[:inactive]
577
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
578
+ end
579
+ end