workos 9.0.0 → 9.1.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 (73) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +2 -2
  3. data/.github/workflows/docs.yml +2 -2
  4. data/.github/workflows/lint.yml +2 -2
  5. data/.github/workflows/release-please.yml +27 -3
  6. data/.github/workflows/release.yml +2 -2
  7. data/.last-synced-sha +1 -1
  8. data/.oagen-manifest.json +28 -12
  9. data/.release-please-manifest.json +1 -1
  10. data/.ruby-version +1 -1
  11. data/CHANGELOG.md +33 -0
  12. data/Gemfile.lock +4 -4
  13. data/lib/workos/{directory_sync/dsync_deactivated.rb → api_keys/api_key_updated.rb} +2 -2
  14. data/lib/workos/api_keys/api_key_updated_data.rb +49 -0
  15. data/lib/workos/{directory_sync/dsync_deactivated_data_domain.rb → api_keys/api_key_updated_data_owner.rb} +1 -1
  16. data/lib/workos/api_keys/api_key_updated_data_previous_attribute.rb +18 -0
  17. data/lib/workos/api_keys/expire_api_key.rb +18 -0
  18. data/lib/workos/api_keys.rb +25 -0
  19. data/lib/workos/authorization.rb +10 -10
  20. data/lib/workos/base_client.rb +19 -2
  21. data/lib/workos/connect/user_object.rb +3 -0
  22. data/lib/workos/connect.rb +1 -1
  23. data/lib/workos/directory_sync/dsync_token_created.rb +34 -0
  24. data/lib/workos/directory_sync/dsync_token_created_data.rb +34 -0
  25. data/lib/workos/directory_sync/dsync_token_revoked.rb +34 -0
  26. data/lib/workos/{types/dsync_deactivated_data_type.rb → directory_sync/dsync_token_revoked_data.rb} +1 -3
  27. data/lib/workos/directory_sync.rb +2 -2
  28. data/lib/workos/events.rb +1 -1
  29. data/lib/workos/groups.rb +2 -2
  30. data/lib/workos/inflections.rb +0 -1
  31. data/lib/workos/organization_membership_service.rb +2 -2
  32. data/lib/workos/organizations.rb +1 -1
  33. data/lib/workos/types/audit_log_configuration_log_stream_type.rb +2 -1
  34. data/lib/workos/types/create_webhook_endpoint_events.rb +2 -1
  35. data/lib/workos/types/radar_standalone_response_control.rb +1 -2
  36. data/lib/workos/user_management/create_user.rb +3 -0
  37. data/lib/workos/user_management/email_change_confirmation_user.rb +3 -0
  38. data/lib/workos/user_management/revoke_session.rb +2 -6
  39. data/lib/workos/user_management/update_user.rb +3 -0
  40. data/lib/workos/{types/dsync_deactivated_data_state.rb → user_management/user_api_key_updated_data_owner.rb} +1 -3
  41. data/lib/workos/user_management.rb +12 -9
  42. data/lib/workos/vault/{object.rb → vault_object.rb} +1 -1
  43. data/lib/workos/vault.rb +4 -4
  44. data/lib/workos/version.rb +1 -1
  45. data/lib/workos/webhooks.rb +1 -1
  46. data/rbi/workos/{dsync_deactivated.rbi → api_key_updated.rbi} +3 -3
  47. data/rbi/workos/api_key_updated_data.rbi +84 -0
  48. data/rbi/workos/api_key_updated_data_owner.rbi +30 -0
  49. data/rbi/workos/api_key_updated_data_previous_attribute.rbi +24 -0
  50. data/rbi/workos/api_keys.rbi +9 -0
  51. data/rbi/workos/create_user.rbi +6 -0
  52. data/rbi/workos/dsync_token_created.rbi +54 -0
  53. data/rbi/workos/{dsync_deactivated_data.rbi → dsync_token_created_data.rbi} +9 -33
  54. data/rbi/workos/dsync_token_revoked.rbi +54 -0
  55. data/rbi/workos/dsync_token_revoked_data.rbi +54 -0
  56. data/rbi/workos/email_change_confirmation_user.rbi +6 -0
  57. data/rbi/workos/expire_api_key.rbi +24 -0
  58. data/rbi/workos/revoke_session.rbi +0 -6
  59. data/rbi/workos/update_user.rbi +6 -0
  60. data/rbi/workos/user.rbi +6 -0
  61. data/rbi/workos/{dsync_deactivated_data_domain.rbi → user_api_key_updated_data_owner.rbi} +5 -5
  62. data/rbi/workos/user_management.rbi +5 -4
  63. data/rbi/workos/user_object.rbi +6 -0
  64. data/rbi/workos/vault.rbi +2 -2
  65. data/rbi/workos/{object.rbi → vault_object.rbi} +1 -1
  66. data/renovate.json +1 -61
  67. data/test/workos/test_api_keys.rb +9 -1
  68. data/test/workos/test_base_client.rb +64 -0
  69. data/test/workos/test_model_round_trip.rb +167 -53
  70. data/test/workos/test_vault.rb +0 -1
  71. metadata +26 -17
  72. data/lib/workos/directory_sync/dsync_deactivated_data.rb +0 -46
  73. /data/lib/workos/{authorization → groups}/user_organization_membership_base_list_data.rb +0 -0
@@ -39,12 +39,20 @@ class ApiKeysTest < Minitest::Test
39
39
  assert_nil result
40
40
  end
41
41
 
42
+ def test_create_api_key_expire_returns_expected_result
43
+ stub_request(:post, %r{\Ahttps://api\.workos\.com/api_keys/stub/expire(\?|\z)})
44
+ .to_return(body: "{}", status: 200)
45
+ result = @client.api_keys.create_api_key_expire(id: "stub")
46
+ refute_nil result
47
+ end
48
+
42
49
  # Parameterized authentication error tests (one per endpoint).
43
50
  [
44
51
  {name: :list_organization_api_keys, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/api_keys(\?|\z)}, args: {organization_id: "stub"}},
45
52
  {name: :create_organization_api_key, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations/stub/api_keys(\?|\z)}, args: {organization_id: "stub", name: "stub"}},
46
53
  {name: :create_validation, verb: :post, url: %r{\Ahttps://api\.workos\.com/api_keys/validations(\?|\z)}, args: {value: "stub"}},
47
- {name: :delete_api_key, verb: :delete, url: %r{\Ahttps://api\.workos\.com/api_keys/stub(\?|\z)}, args: {id: "stub"}}
54
+ {name: :delete_api_key, verb: :delete, url: %r{\Ahttps://api\.workos\.com/api_keys/stub(\?|\z)}, args: {id: "stub"}},
55
+ {name: :create_api_key_expire, verb: :post, url: %r{\Ahttps://api\.workos\.com/api_keys/stub/expire(\?|\z)}, args: {id: "stub"}}
48
56
  ].each do |spec|
49
57
  define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do
50
58
  stub_request(spec[:verb], spec[:url])
@@ -86,6 +86,14 @@ class BaseClientTest < Minitest::Test
86
86
  @client = WorkOS::BaseClient.new(api_key: "sk_test_123", max_retries: 1)
87
87
  end
88
88
 
89
+ def teardown
90
+ super
91
+ # Close any open connections and clear the thread-local cache to avoid
92
+ # leaking sockets between tests.
93
+ @client.shutdown
94
+ Thread.current[:workos_connections] = nil
95
+ end
96
+
89
97
  def test_request_dispatches_known_methods
90
98
  client = RecordingClient.new(api_key: "sk_test_123")
91
99
 
@@ -171,6 +179,62 @@ class BaseClientTest < Minitest::Test
171
179
  refute keep.finished
172
180
  end
173
181
 
182
+ # Regression test for https://github.com/workos/workos-ruby/issues/496
183
+ #
184
+ # The connection cache must be isolated per thread. A previous version
185
+ # keyed it on Fiber[] (inheritable fiber storage), which is inherited *by
186
+ # reference* by child threads — so a Net::HTTP socket warmed in a parent
187
+ # thread leaked into every worker thread spawned afterward (Solid Queue,
188
+ # Puma, etc.) and got driven concurrently, corrupting the stream.
189
+ def test_connection_cache_is_not_shared_with_threads_spawned_after_warming
190
+ # Warm a connection in the "parent" thread before spawning workers.
191
+ parent_cache = @client.send(:thread_connections)
192
+ warm = FakeConnection.new
193
+ parent_cache["https:api.workos.com:443:30"] = warm
194
+
195
+ results = Array.new(4) do
196
+ Thread.new do
197
+ cache = @client.send(:thread_connections)
198
+ {cache_id: cache.object_id, leaked: cache.value?(warm), size: cache.size}
199
+ end
200
+ end.map(&:value)
201
+
202
+ results.each do |r|
203
+ refute_equal parent_cache.object_id, r[:cache_id],
204
+ "worker thread must not share the parent thread's connection cache"
205
+ refute r[:leaked],
206
+ "parent thread's warmed connection leaked into a worker thread"
207
+ assert_equal 0, r[:size],
208
+ "worker thread should start with an empty, isolated cache"
209
+ end
210
+
211
+ # The parent's own cache is left intact.
212
+ assert_same warm, parent_cache["https:api.workos.com:443:30"]
213
+ end
214
+
215
+ # Exercises the connection_for path (not just the storage helper):
216
+ # each thread must open and cache its *own* Net::HTTP connection rather
217
+ # than reusing one established on another thread.
218
+ #
219
+ # Net::HTTP#start is stubbed to avoid real TCP+TLS connections.
220
+ def test_connection_for_opens_a_distinct_connection_per_thread
221
+ original_start = Net::HTTP.instance_method(:start)
222
+ Net::HTTP.define_method(:start) { self }
223
+
224
+ parent_conn = @client.send(:connection_for, "https://api.workos.com", 30)
225
+
226
+ worker_conns = Array.new(4) do
227
+ Thread.new { @client.send(:connection_for, "https://api.workos.com", 30).object_id }
228
+ end.map(&:value)
229
+
230
+ refute_includes worker_conns, parent_conn.object_id,
231
+ "a worker thread reused a connection opened on another thread"
232
+ assert_equal worker_conns.length, worker_conns.uniq.length,
233
+ "worker threads must each get a distinct connection"
234
+ ensure
235
+ Net::HTTP.define_method(:start, original_start)
236
+ end
237
+
174
238
  def test_redact_path_strips_invitation_token_segment
175
239
  redacted = @client.send(:redact_path, "/user_management/invitations/by_token/invtoken_secret123")
176
240
  assert_equal "/user_management/invitations/by_token/[REDACTED]", redacted
@@ -11,6 +11,7 @@ class ModelRoundTripTest < Minitest::Test
11
11
  "email" => "stub",
12
12
  "first_name" => "stub",
13
13
  "last_name" => "stub",
14
+ "name" => "stub",
14
15
  "metadata" => {}
15
16
  }
16
17
  model = WorkOS::UserObject.new(fixture.to_json)
@@ -60,6 +61,16 @@ class ModelRoundTripTest < Minitest::Test
60
61
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
61
62
  end
62
63
 
64
+ def test_expire_api_key_round_trip
65
+ fixture = {
66
+ "expires_at" => nil
67
+ }
68
+ model = WorkOS::ExpireApiKey.new(fixture.to_json)
69
+ json = model.to_h
70
+ assert_kind_of Hash, json
71
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
72
+ end
73
+
63
74
  def test_redirect_uri_input_round_trip
64
75
  fixture = {
65
76
  "uri" => "stub",
@@ -730,6 +741,7 @@ class ModelRoundTripTest < Minitest::Test
730
741
  "email" => "stub",
731
742
  "first_name" => nil,
732
743
  "last_name" => nil,
744
+ "name" => nil,
733
745
  "email_verified" => nil,
734
746
  "metadata" => nil,
735
747
  "external_id" => nil,
@@ -749,6 +761,7 @@ class ModelRoundTripTest < Minitest::Test
749
761
  "email" => "stub",
750
762
  "first_name" => "stub",
751
763
  "last_name" => "stub",
764
+ "name" => "stub",
752
765
  "email_verified" => true,
753
766
  "metadata" => nil,
754
767
  "external_id" => nil,
@@ -822,8 +835,7 @@ class ModelRoundTripTest < Minitest::Test
822
835
 
823
836
  def test_revoke_session_round_trip
824
837
  fixture = {
825
- "session_id" => "stub",
826
- "return_to" => "stub"
838
+ "session_id" => "stub"
827
839
  }
828
840
  model = WorkOS::RevokeSession.new(fixture.to_json)
829
841
  json = model.to_h
@@ -986,14 +998,14 @@ class ModelRoundTripTest < Minitest::Test
986
998
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
987
999
  end
988
1000
 
989
- def test_object_round_trip
1001
+ def test_vault_object_round_trip
990
1002
  fixture = {
991
1003
  "id" => "stub",
992
1004
  "metadata" => {},
993
1005
  "name" => "stub",
994
1006
  "value" => "stub"
995
1007
  }
996
- model = WorkOS::ObjectModel.new(fixture.to_json)
1008
+ model = WorkOS::VaultObject.new(fixture.to_json)
997
1009
  json = model.to_h
998
1010
  assert_kind_of Hash, json
999
1011
  assert_equal fixture["id"], json[:id]
@@ -1540,6 +1552,7 @@ class ModelRoundTripTest < Minitest::Test
1540
1552
  "id" => "stub",
1541
1553
  "first_name" => nil,
1542
1554
  "last_name" => nil,
1555
+ "name" => nil,
1543
1556
  "profile_picture_url" => nil,
1544
1557
  "email" => "stub",
1545
1558
  "email_verified" => true,
@@ -1965,6 +1978,7 @@ class ModelRoundTripTest < Minitest::Test
1965
1978
  assert_equal fixture["name"], json[:name]
1966
1979
  assert_equal fixture["obfuscated_value"], json[:obfuscated_value]
1967
1980
  assert_nil json[:last_used_at]
1981
+ assert_nil json[:expires_at]
1968
1982
  assert_equal fixture["created_at"], json[:created_at]
1969
1983
  assert_equal fixture["updated_at"], json[:updated_at]
1970
1984
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
@@ -2033,6 +2047,7 @@ class ModelRoundTripTest < Minitest::Test
2033
2047
  assert_equal fixture["name"], json[:name]
2034
2048
  assert_equal fixture["obfuscated_value"], json[:obfuscated_value]
2035
2049
  assert_nil json[:last_used_at]
2050
+ assert_nil json[:expires_at]
2036
2051
  assert_equal fixture["created_at"], json[:created_at]
2037
2052
  assert_equal fixture["updated_at"], json[:updated_at]
2038
2053
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
@@ -2064,6 +2079,87 @@ class ModelRoundTripTest < Minitest::Test
2064
2079
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
2065
2080
  end
2066
2081
 
2082
+ def test_api_key_updated_round_trip
2083
+ fixture = {
2084
+ "object" => "event",
2085
+ "id" => "stub",
2086
+ "event" => "api_key.updated",
2087
+ "data" => {},
2088
+ "created_at" => "stub",
2089
+ "context" => {}
2090
+ }
2091
+ model = WorkOS::ApiKeyUpdated.new(fixture.to_json)
2092
+ json = model.to_h
2093
+ assert_kind_of Hash, json
2094
+ assert_equal fixture["id"], json[:id]
2095
+ assert_equal fixture["created_at"], json[:created_at]
2096
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
2097
+ end
2098
+
2099
+ def test_api_key_updated_data_round_trip
2100
+ fixture = {
2101
+ "object" => "api_key",
2102
+ "id" => "stub",
2103
+ "owner" => {},
2104
+ "name" => "stub",
2105
+ "obfuscated_value" => "stub",
2106
+ "last_used_at" => nil,
2107
+ "expires_at" => nil,
2108
+ "permissions" => [],
2109
+ "created_at" => "stub",
2110
+ "updated_at" => "stub",
2111
+ "previous_attributes" => {}
2112
+ }
2113
+ model = WorkOS::ApiKeyUpdatedData.new(fixture.to_json)
2114
+ json = model.to_h
2115
+ assert_kind_of Hash, json
2116
+ assert_equal fixture["id"], json[:id]
2117
+ assert_equal fixture["name"], json[:name]
2118
+ assert_equal fixture["obfuscated_value"], json[:obfuscated_value]
2119
+ assert_nil json[:last_used_at]
2120
+ assert_nil json[:expires_at]
2121
+ assert_equal fixture["created_at"], json[:created_at]
2122
+ assert_equal fixture["updated_at"], json[:updated_at]
2123
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
2124
+ end
2125
+
2126
+ def test_api_key_updated_data_owner_round_trip
2127
+ fixture = {
2128
+ "type" => "organization",
2129
+ "id" => "stub"
2130
+ }
2131
+ model = WorkOS::ApiKeyUpdatedDataOwner.new(fixture.to_json)
2132
+ json = model.to_h
2133
+ assert_kind_of Hash, json
2134
+ assert_equal fixture["id"], json[:id]
2135
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
2136
+ end
2137
+
2138
+ def test_user_api_key_updated_data_owner_round_trip
2139
+ fixture = {
2140
+ "type" => "user",
2141
+ "id" => "stub",
2142
+ "organization_id" => "stub"
2143
+ }
2144
+ model = WorkOS::UserApiKeyUpdatedDataOwner.new(fixture.to_json)
2145
+ json = model.to_h
2146
+ assert_kind_of Hash, json
2147
+ assert_equal fixture["id"], json[:id]
2148
+ assert_equal fixture["organization_id"], json[:organization_id]
2149
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
2150
+ end
2151
+
2152
+ def test_api_key_updated_data_previous_attribute_round_trip
2153
+ fixture = {
2154
+ "expires_at" => nil
2155
+ }
2156
+ model = WorkOS::ApiKeyUpdatedDataPreviousAttribute.new(fixture.to_json)
2157
+ json = model.to_h
2158
+ assert_kind_of Hash, json
2159
+ assert_nil json[:expires_at]
2160
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
2161
+ end
2162
+
2067
2163
  def test_authentication_email_verification_failed_round_trip
2068
2164
  fixture = {
2069
2165
  "object" => "event",
@@ -3172,16 +3268,16 @@ class ModelRoundTripTest < Minitest::Test
3172
3268
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
3173
3269
  end
3174
3270
 
3175
- def test_dsync_deactivated_round_trip
3271
+ def test_dsync_deleted_round_trip
3176
3272
  fixture = {
3177
3273
  "object" => "event",
3178
3274
  "id" => "stub",
3179
- "event" => "dsync.deactivated",
3275
+ "event" => "dsync.deleted",
3180
3276
  "data" => {},
3181
3277
  "created_at" => "stub",
3182
3278
  "context" => {}
3183
3279
  }
3184
- model = WorkOS::DsyncDeactivated.new(fixture.to_json)
3280
+ model = WorkOS::DsyncDeleted.new(fixture.to_json)
3185
3281
  json = model.to_h
3186
3282
  assert_kind_of Hash, json
3187
3283
  assert_equal fixture["id"], json[:id]
@@ -3189,7 +3285,7 @@ class ModelRoundTripTest < Minitest::Test
3189
3285
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
3190
3286
  end
3191
3287
 
3192
- def test_dsync_deactivated_data_round_trip
3288
+ def test_dsync_deleted_data_round_trip
3193
3289
  fixture = {
3194
3290
  "object" => "directory",
3195
3291
  "id" => "stub",
@@ -3198,45 +3294,45 @@ class ModelRoundTripTest < Minitest::Test
3198
3294
  "state" => "stub",
3199
3295
  "name" => "stub",
3200
3296
  "created_at" => "stub",
3201
- "updated_at" => "stub",
3202
- "external_key" => "stub",
3203
- "domains" => []
3297
+ "updated_at" => "stub"
3204
3298
  }
3205
- model = WorkOS::DsyncDeactivatedData.new(fixture.to_json)
3299
+ model = WorkOS::DsyncDeletedData.new(fixture.to_json)
3206
3300
  json = model.to_h
3207
3301
  assert_kind_of Hash, json
3208
3302
  assert_equal fixture["id"], json[:id]
3209
3303
  assert_equal fixture["name"], json[:name]
3210
3304
  assert_equal fixture["created_at"], json[:created_at]
3211
3305
  assert_equal fixture["updated_at"], json[:updated_at]
3212
- assert_equal fixture["external_key"], json[:external_key]
3213
3306
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
3214
3307
  end
3215
3308
 
3216
- def test_dsync_deactivated_data_domain_round_trip
3309
+ def test_dsync_group_created_round_trip
3217
3310
  fixture = {
3218
- "object" => "organization_domain",
3311
+ "object" => "event",
3219
3312
  "id" => "stub",
3220
- "domain" => "stub"
3313
+ "event" => "dsync.group.created",
3314
+ "data" => {},
3315
+ "created_at" => "stub",
3316
+ "context" => {}
3221
3317
  }
3222
- model = WorkOS::DsyncDeactivatedDataDomain.new(fixture.to_json)
3318
+ model = WorkOS::DsyncGroupCreated.new(fixture.to_json)
3223
3319
  json = model.to_h
3224
3320
  assert_kind_of Hash, json
3225
3321
  assert_equal fixture["id"], json[:id]
3226
- assert_equal fixture["domain"], json[:domain]
3322
+ assert_equal fixture["created_at"], json[:created_at]
3227
3323
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
3228
3324
  end
3229
3325
 
3230
- def test_dsync_deleted_round_trip
3326
+ def test_dsync_group_deleted_round_trip
3231
3327
  fixture = {
3232
3328
  "object" => "event",
3233
3329
  "id" => "stub",
3234
- "event" => "dsync.deleted",
3330
+ "event" => "dsync.group.deleted",
3235
3331
  "data" => {},
3236
3332
  "created_at" => "stub",
3237
3333
  "context" => {}
3238
3334
  }
3239
- model = WorkOS::DsyncDeleted.new(fixture.to_json)
3335
+ model = WorkOS::DsyncGroupDeleted.new(fixture.to_json)
3240
3336
  json = model.to_h
3241
3337
  assert_kind_of Hash, json
3242
3338
  assert_equal fixture["id"], json[:id]
@@ -3244,37 +3340,59 @@ class ModelRoundTripTest < Minitest::Test
3244
3340
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
3245
3341
  end
3246
3342
 
3247
- def test_dsync_deleted_data_round_trip
3343
+ def test_dsync_group_updated_round_trip
3248
3344
  fixture = {
3249
- "object" => "directory",
3345
+ "object" => "event",
3346
+ "id" => "stub",
3347
+ "event" => "dsync.group.updated",
3348
+ "data" => {},
3349
+ "created_at" => "stub",
3350
+ "context" => {}
3351
+ }
3352
+ model = WorkOS::DsyncGroupUpdated.new(fixture.to_json)
3353
+ json = model.to_h
3354
+ assert_kind_of Hash, json
3355
+ assert_equal fixture["id"], json[:id]
3356
+ assert_equal fixture["created_at"], json[:created_at]
3357
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
3358
+ end
3359
+
3360
+ def test_dsync_group_updated_data_round_trip
3361
+ fixture = {
3362
+ "object" => "directory_group",
3250
3363
  "id" => "stub",
3364
+ "idp_id" => "stub",
3365
+ "directory_id" => "stub",
3251
3366
  "organization_id" => "stub",
3252
- "type" => "stub",
3253
- "state" => "stub",
3254
3367
  "name" => "stub",
3368
+ "raw_attributes" => {},
3255
3369
  "created_at" => "stub",
3256
- "updated_at" => "stub"
3370
+ "updated_at" => "stub",
3371
+ "previous_attributes" => {}
3257
3372
  }
3258
- model = WorkOS::DsyncDeletedData.new(fixture.to_json)
3373
+ model = WorkOS::DsyncGroupUpdatedData.new(fixture.to_json)
3259
3374
  json = model.to_h
3260
3375
  assert_kind_of Hash, json
3261
3376
  assert_equal fixture["id"], json[:id]
3377
+ assert_equal fixture["idp_id"], json[:idp_id]
3378
+ assert_equal fixture["directory_id"], json[:directory_id]
3379
+ assert_equal fixture["organization_id"], json[:organization_id]
3262
3380
  assert_equal fixture["name"], json[:name]
3263
3381
  assert_equal fixture["created_at"], json[:created_at]
3264
3382
  assert_equal fixture["updated_at"], json[:updated_at]
3265
3383
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
3266
3384
  end
3267
3385
 
3268
- def test_dsync_group_created_round_trip
3386
+ def test_dsync_token_created_round_trip
3269
3387
  fixture = {
3270
3388
  "object" => "event",
3271
3389
  "id" => "stub",
3272
- "event" => "dsync.group.created",
3390
+ "event" => "dsync.token.created",
3273
3391
  "data" => {},
3274
3392
  "created_at" => "stub",
3275
3393
  "context" => {}
3276
3394
  }
3277
- model = WorkOS::DsyncGroupCreated.new(fixture.to_json)
3395
+ model = WorkOS::DsyncTokenCreated.new(fixture.to_json)
3278
3396
  json = model.to_h
3279
3397
  assert_kind_of Hash, json
3280
3398
  assert_equal fixture["id"], json[:id]
@@ -3282,33 +3400,35 @@ class ModelRoundTripTest < Minitest::Test
3282
3400
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
3283
3401
  end
3284
3402
 
3285
- def test_dsync_group_deleted_round_trip
3403
+ def test_dsync_token_created_data_round_trip
3286
3404
  fixture = {
3287
- "object" => "event",
3405
+ "object" => "directory_token",
3288
3406
  "id" => "stub",
3289
- "event" => "dsync.group.deleted",
3290
- "data" => {},
3291
- "created_at" => "stub",
3292
- "context" => {}
3407
+ "directory_id" => "stub",
3408
+ "organization_id" => "stub",
3409
+ "token_suffix" => "stub",
3410
+ "created_at" => "stub"
3293
3411
  }
3294
- model = WorkOS::DsyncGroupDeleted.new(fixture.to_json)
3412
+ model = WorkOS::DsyncTokenCreatedData.new(fixture.to_json)
3295
3413
  json = model.to_h
3296
3414
  assert_kind_of Hash, json
3297
3415
  assert_equal fixture["id"], json[:id]
3416
+ assert_equal fixture["directory_id"], json[:directory_id]
3417
+ assert_equal fixture["token_suffix"], json[:token_suffix]
3298
3418
  assert_equal fixture["created_at"], json[:created_at]
3299
3419
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
3300
3420
  end
3301
3421
 
3302
- def test_dsync_group_updated_round_trip
3422
+ def test_dsync_token_revoked_round_trip
3303
3423
  fixture = {
3304
3424
  "object" => "event",
3305
3425
  "id" => "stub",
3306
- "event" => "dsync.group.updated",
3426
+ "event" => "dsync.token.revoked",
3307
3427
  "data" => {},
3308
3428
  "created_at" => "stub",
3309
3429
  "context" => {}
3310
3430
  }
3311
- model = WorkOS::DsyncGroupUpdated.new(fixture.to_json)
3431
+ model = WorkOS::DsyncTokenRevoked.new(fixture.to_json)
3312
3432
  json = model.to_h
3313
3433
  assert_kind_of Hash, json
3314
3434
  assert_equal fixture["id"], json[:id]
@@ -3316,29 +3436,22 @@ class ModelRoundTripTest < Minitest::Test
3316
3436
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
3317
3437
  end
3318
3438
 
3319
- def test_dsync_group_updated_data_round_trip
3439
+ def test_dsync_token_revoked_data_round_trip
3320
3440
  fixture = {
3321
- "object" => "directory_group",
3441
+ "object" => "directory_token",
3322
3442
  "id" => "stub",
3323
- "idp_id" => "stub",
3324
3443
  "directory_id" => "stub",
3325
3444
  "organization_id" => "stub",
3326
- "name" => "stub",
3327
- "raw_attributes" => {},
3328
- "created_at" => "stub",
3329
- "updated_at" => "stub",
3330
- "previous_attributes" => {}
3445
+ "token_suffix" => "stub",
3446
+ "created_at" => "stub"
3331
3447
  }
3332
- model = WorkOS::DsyncGroupUpdatedData.new(fixture.to_json)
3448
+ model = WorkOS::DsyncTokenRevokedData.new(fixture.to_json)
3333
3449
  json = model.to_h
3334
3450
  assert_kind_of Hash, json
3335
3451
  assert_equal fixture["id"], json[:id]
3336
- assert_equal fixture["idp_id"], json[:idp_id]
3337
3452
  assert_equal fixture["directory_id"], json[:directory_id]
3338
- assert_equal fixture["organization_id"], json[:organization_id]
3339
- assert_equal fixture["name"], json[:name]
3453
+ assert_equal fixture["token_suffix"], json[:token_suffix]
3340
3454
  assert_equal fixture["created_at"], json[:created_at]
3341
- assert_equal fixture["updated_at"], json[:updated_at]
3342
3455
  fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
3343
3456
  end
3344
3457
 
@@ -7581,6 +7694,7 @@ class ModelRoundTripTest < Minitest::Test
7581
7694
  "id" => "stub",
7582
7695
  "first_name" => nil,
7583
7696
  "last_name" => nil,
7697
+ "name" => nil,
7584
7698
  "profile_picture_url" => nil,
7585
7699
  "email" => "stub",
7586
7700
  "email_verified" => true,
@@ -3,7 +3,6 @@
3
3
  # This file is auto-generated by oagen. Do not edit.
4
4
 
5
5
  require "test_helper"
6
- require "base64"
7
6
 
8
7
  class VaultTest < Minitest::Test
9
8
  include FixtureHelper