workos 9.3.0 → 9.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/.last-synced-sha +1 -1
  3. data/.oagen-manifest.json +110 -1
  4. data/.release-please-manifest.json +1 -1
  5. data/CHANGELOG.md +123 -0
  6. data/Gemfile.lock +2 -2
  7. data/lib/workos/admin_portal/generate_link.rb +0 -3
  8. data/lib/workos/admin_portal.rb +0 -3
  9. data/lib/workos/authorization/user_role_assignment.rb +3 -0
  10. data/lib/workos/authorization/user_role_assignment_source.rb +22 -0
  11. data/lib/workos/pipes/connected_account_dto.rb +31 -0
  12. data/lib/workos/pipes/create_data_integration.rb +34 -0
  13. data/lib/workos/pipes/custom_provider_definition.rb +49 -0
  14. data/lib/workos/pipes/data_integration.rb +55 -0
  15. data/lib/workos/pipes/data_integration_credential.rb +25 -0
  16. data/lib/workos/pipes/data_integration_credentials_dto.rb +25 -0
  17. data/lib/workos/pipes/data_integration_credentials_response.rb +25 -0
  18. data/lib/workos/pipes/data_integration_credentials_response_credential.rb +34 -0
  19. data/lib/workos/pipes/data_integration_custom_provider.rb +49 -0
  20. data/lib/workos/pipes/data_integrations_upsert_api_key_request.rb +25 -0
  21. data/lib/workos/pipes/data_integrations_vend_credentials_request.rb +22 -0
  22. data/lib/workos/pipes/update_custom_provider_definition.rb +49 -0
  23. data/lib/workos/pipes/update_data_integration.rb +31 -0
  24. data/lib/workos/pipes.rb +304 -0
  25. data/lib/workos/radar/radar_standalone_assess_request.rb +5 -2
  26. data/lib/workos/radar.rb +5 -2
  27. data/lib/workos/shared/auth_method_mismatch_error.rb +22 -0
  28. data/lib/workos/types/audit_log_export_state.rb +2 -1
  29. data/lib/workos/types/connected_account_state.rb +1 -2
  30. data/lib/workos/types/create_webhook_endpoint_events.rb +8 -1
  31. data/lib/workos/types/custom_provider_definition_authenticate_via.rb +13 -0
  32. data/lib/workos/types/data_integration_credential_type.rb +13 -0
  33. data/lib/workos/types/data_integration_credentials_response_error.rb +9 -0
  34. data/lib/workos/types/data_integration_credentials_type.rb +9 -0
  35. data/lib/workos/types/data_integration_custom_provider_authenticate_via.rb +9 -0
  36. data/lib/workos/types/data_integration_state.rb +14 -0
  37. data/lib/workos/types/data_integrations_list_response_data_connected_account_state.rb +6 -1
  38. data/lib/workos/types/update_custom_provider_definition_authenticate_via.rb +9 -0
  39. data/lib/workos/types/user_role_assignment_source_type.rb +13 -0
  40. data/lib/workos/user_management/authorization_code_session_authenticate_request.rb +5 -2
  41. data/lib/workos/user_management/create_magic_code_and_return.rb +14 -2
  42. data/lib/workos/user_management/create_user.rb +9 -0
  43. data/lib/workos/user_management/magic_auth_code_session_authenticate_request.rb +5 -2
  44. data/lib/workos/user_management/magic_auth_send_magic_auth_code_and_return_response.rb +18 -0
  45. data/lib/workos/user_management/password_session_authenticate_request.rb +8 -2
  46. data/lib/workos/user_management/radar_email_challenge_code_session_authenticate_request.rb +43 -0
  47. data/lib/workos/user_management/radar_sms_challenge_code_session_authenticate_request.rb +46 -0
  48. data/lib/workos/user_management/send_radar_sms_challenge.rb +31 -0
  49. data/lib/workos/user_management/send_radar_sms_challenge_response.rb +22 -0
  50. data/lib/workos/user_management/user_create_response.rb +7 -0
  51. data/lib/workos/user_management.rb +165 -6
  52. data/lib/workos/version.rb +1 -1
  53. data/rbi/workos/admin_portal.rbi +1 -2
  54. data/rbi/workos/auth_method_mismatch_error.rbi +30 -0
  55. data/rbi/workos/authorization_code_session_authenticate_request.rbi +6 -0
  56. data/rbi/workos/connected_account_dto.rbi +48 -0
  57. data/rbi/workos/create_data_integration.rbi +54 -0
  58. data/rbi/workos/create_magic_code_and_return.rbi +24 -0
  59. data/rbi/workos/create_user.rbi +18 -0
  60. data/rbi/workos/custom_provider_definition.rbi +84 -0
  61. data/rbi/workos/data_integration.rbi +96 -0
  62. data/rbi/workos/data_integration_credential.rbi +36 -0
  63. data/rbi/workos/data_integration_credentials_dto.rbi +36 -0
  64. data/rbi/workos/data_integration_credentials_response.rbi +36 -0
  65. data/rbi/workos/data_integration_credentials_response_credential.rbi +54 -0
  66. data/rbi/workos/data_integration_custom_provider.rbi +84 -0
  67. data/rbi/workos/data_integrations_upsert_api_key_request.rbi +36 -0
  68. data/rbi/workos/data_integrations_vend_credentials_request.rbi +30 -0
  69. data/rbi/workos/generate_link.rbi +0 -6
  70. data/rbi/workos/magic_auth_code_session_authenticate_request.rbi +6 -0
  71. data/rbi/workos/magic_auth_send_magic_auth_code_and_return_response.rbi +24 -0
  72. data/rbi/workos/password_session_authenticate_request.rbi +12 -0
  73. data/rbi/workos/pipes.rbi +104 -0
  74. data/rbi/workos/radar.rbi +2 -1
  75. data/rbi/workos/radar_email_challenge_code_session_authenticate_request.rbi +72 -0
  76. data/rbi/workos/radar_sms_challenge_code_session_authenticate_request.rbi +78 -0
  77. data/rbi/workos/radar_standalone_assess_request.rbi +6 -0
  78. data/rbi/workos/send_radar_sms_challenge.rbi +48 -0
  79. data/rbi/workos/send_radar_sms_challenge_response.rbi +30 -0
  80. data/rbi/workos/update_custom_provider_definition.rbi +84 -0
  81. data/rbi/workos/update_data_integration.rbi +48 -0
  82. data/rbi/workos/user_create_response.rbi +24 -0
  83. data/rbi/workos/user_management.rbi +47 -5
  84. data/rbi/workos/user_role_assignment.rbi +6 -0
  85. data/rbi/workos/user_role_assignment_source.rbi +30 -0
  86. data/test/workos/test_admin_portal_model_round_trip.rb +33 -0
  87. data/test/workos/test_audit_logs_model_round_trip.rb +218 -0
  88. data/test/workos/test_authorization_model_round_trip.rb +456 -0
  89. data/test/workos/test_connect_model_round_trip.rb +30 -0
  90. data/test/workos/test_groups_model_round_trip.rb +33 -0
  91. data/test/workos/test_model_round_trip.rb +2 -7857
  92. data/test/workos/test_organizations_model_round_trip.rb +29 -0
  93. data/test/workos/test_pipes.rb +72 -0
  94. data/test/workos/test_pipes_model_round_trip.rb +389 -0
  95. data/test/workos/test_radar_model_round_trip.rb +85 -0
  96. data/test/workos/test_shared_model_round_trip.rb +92 -0
  97. data/test/workos/test_user_management.rb +24 -0
  98. data/test/workos/test_user_management_model_round_trip.rb +1048 -0
  99. data/test/workos/test_webhooks_model_round_trip.rb +53 -0
  100. metadata +62 -1
@@ -0,0 +1,29 @@
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 OrganizationsModelRoundTripTest < Minitest::Test
8
+ def test_update_audit_logs_retention_round_trip
9
+ fixture = {
10
+ "retention_period_in_days" => 1
11
+ }
12
+ model = WorkOS::UpdateAuditLogsRetention.new(fixture.to_json)
13
+ json = model.to_h
14
+ assert_kind_of Hash, json
15
+ assert_equal fixture["retention_period_in_days"], json[:retention_period_in_days]
16
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
17
+ end
18
+
19
+ def test_audit_logs_retention_round_trip
20
+ fixture = {
21
+ "retention_period_in_days" => nil
22
+ }
23
+ model = WorkOS::AuditLogsRetention.new(fixture.to_json)
24
+ json = model.to_h
25
+ assert_kind_of Hash, json
26
+ assert_nil json[:retention_period_in_days]
27
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
28
+ end
29
+ end
@@ -11,6 +11,48 @@ class PipesTest < Minitest::Test
11
11
  @client = WorkOS::Client.new(api_key: "sk_test_123")
12
12
  end
13
13
 
14
+ def test_list_data_integrations_returns_expected_result
15
+ stub_request(:get, %r{\Ahttps://api\.workos\.com/data-integrations(\?|\z)})
16
+ .to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
17
+ result = @client.pipes.list_data_integrations
18
+ assert_kind_of WorkOS::Types::ListStruct, result
19
+ end
20
+
21
+ def test_create_data_integration_returns_expected_result
22
+ stub_request(:post, %r{\Ahttps://api\.workos\.com/data-integrations(\?|\z)})
23
+ .to_return(body: "{}", status: 200)
24
+ result = @client.pipes.create_data_integration(provider: "stub")
25
+ refute_nil result
26
+ end
27
+
28
+ def test_get_data_integration_returns_expected_result
29
+ stub_request(:get, %r{\Ahttps://api\.workos\.com/data-integrations/stub(\?|\z)})
30
+ .to_return(body: "{}", status: 200)
31
+ result = @client.pipes.get_data_integration(slug: "stub")
32
+ refute_nil result
33
+ end
34
+
35
+ def test_update_data_integration_returns_expected_result
36
+ stub_request(:put, %r{\Ahttps://api\.workos\.com/data-integrations/stub(\?|\z)})
37
+ .to_return(body: "{}", status: 200)
38
+ result = @client.pipes.update_data_integration(slug: "stub")
39
+ refute_nil result
40
+ end
41
+
42
+ def test_delete_data_integration_returns_expected_result
43
+ stub_request(:delete, %r{\Ahttps://api\.workos\.com/data-integrations/stub(\?|\z)})
44
+ .to_return(body: "{}", status: 200)
45
+ result = @client.pipes.delete_data_integration(slug: "stub")
46
+ assert_nil result
47
+ end
48
+
49
+ def test_update_data_integration_api_key_returns_expected_result
50
+ stub_request(:put, %r{\Ahttps://api\.workos\.com/data-integrations/stub/api-key(\?|\z)})
51
+ .to_return(body: "{}", status: 200)
52
+ result = @client.pipes.update_data_integration_api_key(slug: "stub", user_id: "stub", secret: "stub")
53
+ refute_nil result
54
+ end
55
+
14
56
  def test_authorize_data_integration_returns_expected_result
15
57
  stub_request(:post, %r{\Ahttps://api\.workos\.com/data-integrations/stub/authorize(\?|\z)})
16
58
  .to_return(body: "{}", status: 200)
@@ -18,6 +60,13 @@ class PipesTest < Minitest::Test
18
60
  refute_nil result
19
61
  end
20
62
 
63
+ def test_create_data_integration_credential_returns_expected_result
64
+ stub_request(:post, %r{\Ahttps://api\.workos\.com/data-integrations/stub/credentials(\?|\z)})
65
+ .to_return(body: "{}", status: 200)
66
+ result = @client.pipes.create_data_integration_credential(slug: "stub", user_id: "stub")
67
+ refute_nil result
68
+ end
69
+
21
70
  def test_get_access_token_returns_expected_result
22
71
  stub_request(:post, %r{\Ahttps://api\.workos\.com/data-integrations/stub/token(\?|\z)})
23
72
  .to_return(body: "{}", status: 200)
@@ -32,6 +81,20 @@ class PipesTest < Minitest::Test
32
81
  refute_nil result
33
82
  end
34
83
 
84
+ def test_create_user_connected_account_returns_expected_result
85
+ stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)})
86
+ .to_return(body: "{}", status: 200)
87
+ result = @client.pipes.create_user_connected_account(user_id: "stub", slug: "stub")
88
+ refute_nil result
89
+ end
90
+
91
+ def test_update_user_connected_account_returns_expected_result
92
+ stub_request(:put, %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)})
93
+ .to_return(body: "{}", status: 200)
94
+ result = @client.pipes.update_user_connected_account(user_id: "stub", slug: "stub")
95
+ refute_nil result
96
+ end
97
+
35
98
  def test_delete_user_connected_account_returns_expected_result
36
99
  stub_request(:delete, %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)})
37
100
  .to_return(body: "{}", status: 200)
@@ -48,9 +111,18 @@ class PipesTest < Minitest::Test
48
111
 
49
112
  # Parameterized authentication error tests (one per endpoint).
50
113
  [
114
+ {name: :list_data_integrations, verb: :get, url: %r{\Ahttps://api\.workos\.com/data-integrations(\?|\z)}},
115
+ {name: :create_data_integration, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations(\?|\z)}, args: {provider: "stub"}},
116
+ {name: :get_data_integration, verb: :get, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub(\?|\z)}, args: {slug: "stub"}},
117
+ {name: :update_data_integration, verb: :put, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub(\?|\z)}, args: {slug: "stub"}},
118
+ {name: :delete_data_integration, verb: :delete, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub(\?|\z)}, args: {slug: "stub"}},
119
+ {name: :update_data_integration_api_key, verb: :put, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/api-key(\?|\z)}, args: {slug: "stub", user_id: "stub", secret: "stub"}},
51
120
  {name: :authorize_data_integration, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/authorize(\?|\z)}, args: {slug: "stub", user_id: "stub"}},
121
+ {name: :create_data_integration_credential, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/credentials(\?|\z)}, args: {slug: "stub", user_id: "stub"}},
52
122
  {name: :get_access_token, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/token(\?|\z)}, args: {provider: "stub", user_id: "stub"}},
53
123
  {name: :get_user_connected_account, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}},
124
+ {name: :create_user_connected_account, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}},
125
+ {name: :update_user_connected_account, verb: :put, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}},
54
126
  {name: :delete_user_connected_account, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}},
55
127
  {name: :list_user_data_providers, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/data_providers(\?|\z)}, args: {user_id: "stub"}}
56
128
  ].each do |spec|
@@ -0,0 +1,389 @@
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 PipesModelRoundTripTest < Minitest::Test
8
+ def test_data_integration_credentials_dto_round_trip
9
+ fixture = {
10
+ "type" => "stub",
11
+ "client_id" => "stub",
12
+ "client_secret" => "stub"
13
+ }
14
+ model = WorkOS::DataIntegrationCredentialsDto.new(fixture.to_json)
15
+ json = model.to_h
16
+ assert_kind_of Hash, json
17
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
18
+ end
19
+
20
+ def test_custom_provider_definition_round_trip
21
+ fixture = {
22
+ "name" => "stub",
23
+ "authorization_url" => "stub",
24
+ "token_url" => "stub",
25
+ "refresh_token_url" => nil,
26
+ "pkce_enabled" => true,
27
+ "request_scope_separator" => "stub",
28
+ "scopes_required" => true,
29
+ "client_secret_required" => true,
30
+ "additional_authorization_parameters" => {},
31
+ "token_body_content_type" => "stub",
32
+ "authenticate_via" => "stub"
33
+ }
34
+ model = WorkOS::CustomProviderDefinition.new(fixture.to_json)
35
+ json = model.to_h
36
+ assert_kind_of Hash, json
37
+ assert_equal fixture["name"], json[:name]
38
+ assert_equal fixture["authorization_url"], json[:authorization_url]
39
+ assert_equal fixture["token_url"], json[:token_url]
40
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
41
+ end
42
+
43
+ def test_create_data_integration_round_trip
44
+ fixture = {
45
+ "provider" => "stub",
46
+ "description" => nil,
47
+ "enabled" => true,
48
+ "scopes" => nil,
49
+ "credentials" => {},
50
+ "custom_provider" => {}
51
+ }
52
+ model = WorkOS::CreateDataIntegration.new(fixture.to_json)
53
+ json = model.to_h
54
+ assert_kind_of Hash, json
55
+ assert_equal fixture["provider"], json[:provider]
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_update_custom_provider_definition_round_trip
60
+ fixture = {
61
+ "name" => "stub",
62
+ "authorization_url" => "stub",
63
+ "token_url" => "stub",
64
+ "refresh_token_url" => nil,
65
+ "pkce_enabled" => true,
66
+ "request_scope_separator" => "stub",
67
+ "scopes_required" => true,
68
+ "client_secret_required" => true,
69
+ "additional_authorization_parameters" => {},
70
+ "token_body_content_type" => "stub",
71
+ "authenticate_via" => "stub"
72
+ }
73
+ model = WorkOS::UpdateCustomProviderDefinition.new(fixture.to_json)
74
+ json = model.to_h
75
+ assert_kind_of Hash, json
76
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
77
+ end
78
+
79
+ def test_update_data_integration_round_trip
80
+ fixture = {
81
+ "description" => nil,
82
+ "enabled" => true,
83
+ "scopes" => nil,
84
+ "credentials" => {},
85
+ "custom_provider" => {}
86
+ }
87
+ model = WorkOS::UpdateDataIntegration.new(fixture.to_json)
88
+ json = model.to_h
89
+ assert_kind_of Hash, json
90
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
91
+ end
92
+
93
+ def test_connected_account_dto_round_trip
94
+ fixture = {
95
+ "access_token" => "stub",
96
+ "refresh_token" => "stub",
97
+ "expires_at" => "stub",
98
+ "scopes" => [],
99
+ "state" => "stub"
100
+ }
101
+ model = WorkOS::ConnectedAccountDto.new(fixture.to_json)
102
+ json = model.to_h
103
+ assert_kind_of Hash, json
104
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
105
+ end
106
+
107
+ def test_data_integration_round_trip
108
+ fixture = {
109
+ "object" => "data_integration",
110
+ "id" => "stub",
111
+ "slug" => "stub",
112
+ "integration_type" => "stub",
113
+ "description" => nil,
114
+ "enabled" => true,
115
+ "state" => "stub",
116
+ "scopes" => nil,
117
+ "redirect_uri" => "stub",
118
+ "credentials" => {},
119
+ "custom_provider" => nil,
120
+ "created_at" => "stub",
121
+ "updated_at" => "stub"
122
+ }
123
+ model = WorkOS::DataIntegration.new(fixture.to_json)
124
+ json = model.to_h
125
+ assert_kind_of Hash, json
126
+ assert_equal fixture["id"], json[:id]
127
+ assert_equal fixture["slug"], json[:slug]
128
+ assert_equal fixture["integration_type"], json[:integration_type]
129
+ assert_nil json[:description]
130
+ assert_equal fixture["enabled"], json[:enabled]
131
+ assert_equal fixture["redirect_uri"], json[:redirect_uri]
132
+ assert_equal fixture["created_at"], json[:created_at]
133
+ assert_equal fixture["updated_at"], json[:updated_at]
134
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
135
+ end
136
+
137
+ def test_data_integration_authorize_url_response_round_trip
138
+ fixture = {
139
+ "url" => "stub"
140
+ }
141
+ model = WorkOS::DataIntegrationAuthorizeUrlResponse.new(fixture.to_json)
142
+ json = model.to_h
143
+ assert_kind_of Hash, json
144
+ assert_equal fixture["url"], json[:url]
145
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
146
+ end
147
+
148
+ def test_data_integration_access_token_response_round_trip
149
+ fixture = {
150
+ "active" => true,
151
+ "access_token" => {},
152
+ "error" => "stub"
153
+ }
154
+ model = WorkOS::DataIntegrationAccessTokenResponse.new(fixture.to_json)
155
+ json = model.to_h
156
+ assert_kind_of Hash, json
157
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
158
+ end
159
+
160
+ def test_data_integration_credentials_response_round_trip
161
+ fixture = {
162
+ "active" => true,
163
+ "credential" => {},
164
+ "error" => "stub"
165
+ }
166
+ model = WorkOS::DataIntegrationCredentialsResponse.new(fixture.to_json)
167
+ json = model.to_h
168
+ assert_kind_of Hash, json
169
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
170
+ end
171
+
172
+ def test_connected_account_round_trip
173
+ fixture = {
174
+ "object" => "connected_account",
175
+ "id" => "stub",
176
+ "user_id" => nil,
177
+ "organization_id" => nil,
178
+ "scopes" => [],
179
+ "auth_method" => "stub",
180
+ "api_key_last_4" => nil,
181
+ "state" => "stub",
182
+ "created_at" => "stub",
183
+ "updated_at" => "stub"
184
+ }
185
+ model = WorkOS::ConnectedAccount.new(fixture.to_json)
186
+ json = model.to_h
187
+ assert_kind_of Hash, json
188
+ assert_equal fixture["id"], json[:id]
189
+ assert_nil json[:user_id]
190
+ assert_nil json[:organization_id]
191
+ assert_equal fixture["created_at"], json[:created_at]
192
+ assert_equal fixture["updated_at"], json[:updated_at]
193
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
194
+ end
195
+
196
+ def test_data_integrations_list_response_round_trip
197
+ fixture = {
198
+ "object" => "list",
199
+ "data" => []
200
+ }
201
+ model = WorkOS::DataIntegrationsListResponse.new(fixture.to_json)
202
+ json = model.to_h
203
+ assert_kind_of Hash, json
204
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
205
+ end
206
+
207
+ def test_data_integrations_list_response_data_round_trip
208
+ fixture = {
209
+ "object" => "data_provider",
210
+ "id" => "stub",
211
+ "name" => "stub",
212
+ "description" => nil,
213
+ "slug" => "stub",
214
+ "integration_type" => "stub",
215
+ "credentials_type" => "stub",
216
+ "scopes" => nil,
217
+ "auth_methods" => [],
218
+ "ownership" => "stub",
219
+ "created_at" => "stub",
220
+ "updated_at" => "stub",
221
+ "connected_account" => nil
222
+ }
223
+ model = WorkOS::DataIntegrationsListResponseData.new(fixture.to_json)
224
+ json = model.to_h
225
+ assert_kind_of Hash, json
226
+ assert_equal fixture["id"], json[:id]
227
+ assert_equal fixture["name"], json[:name]
228
+ assert_nil json[:description]
229
+ assert_equal fixture["slug"], json[:slug]
230
+ assert_equal fixture["integration_type"], json[:integration_type]
231
+ assert_equal fixture["credentials_type"], json[:credentials_type]
232
+ assert_equal fixture["created_at"], json[:created_at]
233
+ assert_equal fixture["updated_at"], json[:updated_at]
234
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
235
+ end
236
+
237
+ def test_data_integration_credentials_response_credential_round_trip
238
+ fixture = {
239
+ "object" => "credential",
240
+ "auth_method" => "oauth",
241
+ "value" => "stub",
242
+ "expires_at" => nil,
243
+ "scopes" => [],
244
+ "missing_scopes" => []
245
+ }
246
+ model = WorkOS::DataIntegrationCredentialsResponseCredential.new(fixture.to_json)
247
+ json = model.to_h
248
+ assert_kind_of Hash, json
249
+ assert_equal fixture["value"], json[:value]
250
+ assert_nil json[:expires_at]
251
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
252
+ end
253
+
254
+ def test_data_integration_access_token_response_access_token_round_trip
255
+ fixture = {
256
+ "object" => "access_token",
257
+ "access_token" => "stub",
258
+ "expires_at" => nil,
259
+ "scopes" => [],
260
+ "missing_scopes" => []
261
+ }
262
+ model = WorkOS::DataIntegrationAccessTokenResponseAccessToken.new(fixture.to_json)
263
+ json = model.to_h
264
+ assert_kind_of Hash, json
265
+ assert_equal fixture["access_token"], json[:access_token]
266
+ assert_nil json[:expires_at]
267
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
268
+ end
269
+
270
+ def test_data_integration_credential_round_trip
271
+ fixture = {
272
+ "type" => "stub",
273
+ "client_id" => nil,
274
+ "redacted_client_secret" => nil
275
+ }
276
+ model = WorkOS::DataIntegrationCredential.new(fixture.to_json)
277
+ json = model.to_h
278
+ assert_kind_of Hash, json
279
+ assert_nil json[:client_id]
280
+ assert_nil json[:redacted_client_secret]
281
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
282
+ end
283
+
284
+ def test_data_integration_custom_provider_round_trip
285
+ fixture = {
286
+ "name" => "stub",
287
+ "authorization_url" => nil,
288
+ "token_url" => nil,
289
+ "refresh_token_url" => nil,
290
+ "pkce_enabled" => true,
291
+ "request_scope_separator" => "stub",
292
+ "scopes_required" => true,
293
+ "client_secret_required" => true,
294
+ "additional_authorization_parameters" => {},
295
+ "token_body_content_type" => "stub",
296
+ "authenticate_via" => "stub"
297
+ }
298
+ model = WorkOS::DataIntegrationCustomProvider.new(fixture.to_json)
299
+ json = model.to_h
300
+ assert_kind_of Hash, json
301
+ assert_equal fixture["name"], json[:name]
302
+ assert_nil json[:authorization_url]
303
+ assert_nil json[:token_url]
304
+ assert_nil json[:refresh_token_url]
305
+ assert_equal fixture["pkce_enabled"], json[:pkce_enabled]
306
+ assert_equal fixture["request_scope_separator"], json[:request_scope_separator]
307
+ assert_equal fixture["scopes_required"], json[:scopes_required]
308
+ assert_equal fixture["client_secret_required"], json[:client_secret_required]
309
+ assert_equal fixture["token_body_content_type"], json[:token_body_content_type]
310
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
311
+ end
312
+
313
+ def test_data_integrations_upsert_api_key_request_round_trip
314
+ fixture = {
315
+ "user_id" => "stub",
316
+ "organization_id" => "stub",
317
+ "secret" => "stub"
318
+ }
319
+ model = WorkOS::DataIntegrationsUpsertApiKeyRequest.new(fixture.to_json)
320
+ json = model.to_h
321
+ assert_kind_of Hash, json
322
+ assert_equal fixture["user_id"], json[:user_id]
323
+ assert_equal fixture["secret"], json[:secret]
324
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
325
+ end
326
+
327
+ def test_data_integrations_get_data_integration_authorize_url_request_round_trip
328
+ fixture = {
329
+ "user_id" => "stub",
330
+ "organization_id" => "stub",
331
+ "return_to" => "stub"
332
+ }
333
+ model = WorkOS::DataIntegrationsGetDataIntegrationAuthorizeUrlRequest.new(fixture.to_json)
334
+ json = model.to_h
335
+ assert_kind_of Hash, json
336
+ assert_equal fixture["user_id"], json[:user_id]
337
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
338
+ end
339
+
340
+ def test_data_integrations_vend_credentials_request_round_trip
341
+ fixture = {
342
+ "user_id" => "stub",
343
+ "organization_id" => "stub"
344
+ }
345
+ model = WorkOS::DataIntegrationsVendCredentialsRequest.new(fixture.to_json)
346
+ json = model.to_h
347
+ assert_kind_of Hash, json
348
+ assert_equal fixture["user_id"], json[:user_id]
349
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
350
+ end
351
+
352
+ def test_data_integrations_get_user_token_request_round_trip
353
+ fixture = {
354
+ "user_id" => "stub",
355
+ "organization_id" => nil
356
+ }
357
+ model = WorkOS::DataIntegrationsGetUserTokenRequest.new(fixture.to_json)
358
+ json = model.to_h
359
+ assert_kind_of Hash, json
360
+ assert_equal fixture["user_id"], json[:user_id]
361
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
362
+ end
363
+
364
+ def test_data_integrations_list_response_data_connected_account_round_trip
365
+ fixture = {
366
+ "object" => "connected_account",
367
+ "id" => "stub",
368
+ "user_id" => nil,
369
+ "organization_id" => nil,
370
+ "scopes" => [],
371
+ "auth_method" => "stub",
372
+ "api_key_last_4" => nil,
373
+ "state" => "stub",
374
+ "created_at" => "stub",
375
+ "updated_at" => "stub",
376
+ "userlandUserId" => nil
377
+ }
378
+ model = WorkOS::DataIntegrationsListResponseDataConnectedAccount.new(fixture.to_json)
379
+ json = model.to_h
380
+ assert_kind_of Hash, json
381
+ assert_equal fixture["id"], json[:id]
382
+ assert_nil json[:user_id]
383
+ assert_nil json[:organization_id]
384
+ assert_equal fixture["created_at"], json[:created_at]
385
+ assert_equal fixture["updated_at"], json[:updated_at]
386
+ assert_nil json[:userlandUserId]
387
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
388
+ end
389
+ end
@@ -0,0 +1,85 @@
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 RadarModelRoundTripTest < Minitest::Test
8
+ def test_radar_standalone_response_round_trip
9
+ fixture = {
10
+ "verdict" => "stub",
11
+ "reason" => "stub",
12
+ "attempt_id" => "stub",
13
+ "control" => "stub",
14
+ "blocklist_type" => "stub"
15
+ }
16
+ model = WorkOS::RadarStandaloneResponse.new(fixture.to_json)
17
+ json = model.to_h
18
+ assert_kind_of Hash, json
19
+ assert_equal fixture["reason"], json[:reason]
20
+ assert_equal fixture["attempt_id"], json[:attempt_id]
21
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
22
+ end
23
+
24
+ def test_radar_list_entry_already_present_response_round_trip
25
+ fixture = {
26
+ "message" => "stub"
27
+ }
28
+ model = WorkOS::RadarListEntryAlreadyPresentResponse.new(fixture.to_json)
29
+ json = model.to_h
30
+ assert_kind_of Hash, json
31
+ assert_equal fixture["message"], json[:message]
32
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
33
+ end
34
+
35
+ def test_radar_standalone_assess_request_round_trip
36
+ fixture = {
37
+ "ip_address" => "stub",
38
+ "user_agent" => "stub",
39
+ "email" => "stub",
40
+ "auth_method" => "stub",
41
+ "action" => "stub",
42
+ "signals_id" => "stub"
43
+ }
44
+ model = WorkOS::RadarStandaloneAssessRequest.new(fixture.to_json)
45
+ json = model.to_h
46
+ assert_kind_of Hash, json
47
+ assert_equal fixture["ip_address"], json[:ip_address]
48
+ assert_equal fixture["user_agent"], json[:user_agent]
49
+ assert_equal fixture["email"], json[:email]
50
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
51
+ end
52
+
53
+ def test_radar_standalone_update_radar_attempt_request_round_trip
54
+ fixture = {
55
+ "challenge_status" => "success",
56
+ "attempt_status" => "success"
57
+ }
58
+ model = WorkOS::RadarStandaloneUpdateRadarAttemptRequest.new(fixture.to_json)
59
+ json = model.to_h
60
+ assert_kind_of Hash, json
61
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
62
+ end
63
+
64
+ def test_radar_standalone_update_radar_list_request_round_trip
65
+ fixture = {
66
+ "entry" => "stub"
67
+ }
68
+ model = WorkOS::RadarStandaloneUpdateRadarListRequest.new(fixture.to_json)
69
+ json = model.to_h
70
+ assert_kind_of Hash, json
71
+ assert_equal fixture["entry"], json[:entry]
72
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
73
+ end
74
+
75
+ def test_radar_standalone_delete_radar_list_entry_request_round_trip
76
+ fixture = {
77
+ "entry" => "stub"
78
+ }
79
+ model = WorkOS::RadarStandaloneDeleteRadarListEntryRequest.new(fixture.to_json)
80
+ json = model.to_h
81
+ assert_kind_of Hash, json
82
+ assert_equal fixture["entry"], json[:entry]
83
+ fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
84
+ end
85
+ end