prelude-sdk 0.2.0 → 0.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 (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +81 -0
  3. data/README.md +1 -1
  4. data/lib/prelude_sdk/client.rb +22 -1
  5. data/lib/prelude_sdk/internal/transport/pooled_net_requester.rb +13 -11
  6. data/lib/prelude_sdk/internal/util.rb +61 -10
  7. data/lib/prelude_sdk/models/lookup_lookup_params.rb +9 -1
  8. data/lib/prelude_sdk/models/notify_get_subscription_config_params.rb +7 -1
  9. data/lib/prelude_sdk/models/notify_get_subscription_phone_number_params.rb +7 -1
  10. data/lib/prelude_sdk/models/notify_list_subscription_phone_number_events_params.rb +8 -1
  11. data/lib/prelude_sdk/models/notify_list_subscription_phone_numbers_params.rb +8 -1
  12. data/lib/prelude_sdk/models/notify_send_batch_params.rb +55 -1
  13. data/lib/prelude_sdk/models/notify_send_batch_response.rb +39 -1
  14. data/lib/prelude_sdk/models/notify_send_params.rb +92 -1
  15. data/lib/prelude_sdk/models/notify_send_response.rb +36 -1
  16. data/lib/prelude_sdk/models/transactional_send_params.rb +54 -1
  17. data/lib/prelude_sdk/models/verification_create_params.rb +35 -48
  18. data/lib/prelude_sdk/models/verification_create_response.rb +66 -1
  19. data/lib/prelude_sdk/models/verification_management_delete_phone_number_params.rb +8 -1
  20. data/lib/prelude_sdk/models/verification_management_list_phone_numbers_params.rb +7 -1
  21. data/lib/prelude_sdk/models/verification_management_set_phone_number_params.rb +8 -1
  22. data/lib/prelude_sdk/models/watch_predict_params.rb +16 -12
  23. data/lib/prelude_sdk/models/watch_predict_response.rb +51 -1
  24. data/lib/prelude_sdk/models/watch_send_events_params.rb +6 -2
  25. data/lib/prelude_sdk/models/watch_send_feedbacks_params.rb +7 -130
  26. data/lib/prelude_sdk/resources/lookup.rb +4 -1
  27. data/lib/prelude_sdk/resources/notify.rb +19 -7
  28. data/lib/prelude_sdk/resources/transactional.rb +4 -1
  29. data/lib/prelude_sdk/resources/verification.rb +1 -0
  30. data/lib/prelude_sdk/resources/verification_management.rb +1 -0
  31. data/lib/prelude_sdk/resources/watch.rb +9 -2
  32. data/lib/prelude_sdk/version.rb +1 -1
  33. data/rbi/prelude_sdk/client.rbi +7 -0
  34. data/rbi/prelude_sdk/internal/util.rbi +29 -1
  35. data/rbi/prelude_sdk/models/lookup_lookup_params.rbi +8 -0
  36. data/rbi/prelude_sdk/models/notify_get_subscription_config_params.rbi +13 -5
  37. data/rbi/prelude_sdk/models/notify_get_subscription_phone_number_params.rbi +10 -2
  38. data/rbi/prelude_sdk/models/notify_list_subscription_phone_number_events_params.rbi +6 -0
  39. data/rbi/prelude_sdk/models/notify_list_subscription_phone_numbers_params.rbi +6 -0
  40. data/rbi/prelude_sdk/models/notify_send_batch_params.rbi +88 -0
  41. data/rbi/prelude_sdk/models/notify_send_batch_response.rbi +80 -0
  42. data/rbi/prelude_sdk/models/notify_send_params.rbi +145 -0
  43. data/rbi/prelude_sdk/models/notify_send_response.rbi +75 -0
  44. data/rbi/prelude_sdk/models/transactional_send_params.rbi +83 -0
  45. data/rbi/prelude_sdk/models/verification_create_params.rbi +53 -93
  46. data/rbi/prelude_sdk/models/verification_create_response.rbi +178 -0
  47. data/rbi/prelude_sdk/models/verification_management_delete_phone_number_params.rbi +16 -1
  48. data/rbi/prelude_sdk/models/verification_management_list_phone_numbers_params.rbi +21 -4
  49. data/rbi/prelude_sdk/models/verification_management_set_phone_number_params.rbi +16 -1
  50. data/rbi/prelude_sdk/models/watch_predict_params.rbi +24 -16
  51. data/rbi/prelude_sdk/models/watch_predict_response.rbi +152 -3
  52. data/rbi/prelude_sdk/models/watch_send_events_params.rbi +4 -2
  53. data/rbi/prelude_sdk/models/watch_send_feedbacks_params.rbi +7 -245
  54. data/rbi/prelude_sdk/resources/lookup.rbi +2 -0
  55. data/rbi/prelude_sdk/resources/notify.rbi +36 -2
  56. data/rbi/prelude_sdk/resources/transactional.rbi +13 -0
  57. data/rbi/prelude_sdk/resources/verification.rbi +1 -0
  58. data/rbi/prelude_sdk/resources/verification_management.rbi +1 -0
  59. data/rbi/prelude_sdk/resources/watch.rbi +5 -2
  60. data/sig/prelude_sdk/internal/util.rbs +14 -0
  61. data/sig/prelude_sdk/models/lookup_lookup_params.rbs +8 -1
  62. data/sig/prelude_sdk/models/notify_get_subscription_config_params.rbs +11 -3
  63. data/sig/prelude_sdk/models/notify_get_subscription_phone_number_params.rbs +6 -1
  64. data/sig/prelude_sdk/models/notify_list_subscription_phone_number_events_params.rbs +10 -1
  65. data/sig/prelude_sdk/models/notify_list_subscription_phone_numbers_params.rbs +5 -0
  66. data/sig/prelude_sdk/models/notify_send_batch_params.rbs +25 -1
  67. data/sig/prelude_sdk/models/notify_send_batch_response.rbs +27 -0
  68. data/sig/prelude_sdk/models/notify_send_params.rbs +51 -1
  69. data/sig/prelude_sdk/models/notify_send_response.rbs +27 -0
  70. data/sig/prelude_sdk/models/transactional_send_params.rbs +23 -0
  71. data/sig/prelude_sdk/models/verification_create_params.rbs +2 -21
  72. data/sig/prelude_sdk/models/verification_create_response.rbs +40 -1
  73. data/sig/prelude_sdk/models/verification_management_delete_phone_number_params.rbs +9 -1
  74. data/sig/prelude_sdk/models/verification_management_list_phone_numbers_params.rbs +14 -3
  75. data/sig/prelude_sdk/models/verification_management_set_phone_number_params.rbs +9 -1
  76. data/sig/prelude_sdk/models/watch_predict_response.rbs +41 -3
  77. data/sig/prelude_sdk/models/watch_send_feedbacks_params.rbs +3 -110
  78. data/sig/prelude_sdk/resources/notify.rbs +4 -0
  79. data/sig/prelude_sdk/resources/transactional.rbs +1 -0
  80. metadata +16 -2
@@ -24,6 +24,13 @@ module PreludeSDK
24
24
  attr_accessor :verification_method
25
25
 
26
26
  # The status of the verification.
27
+ #
28
+ # - `success` - A new verification window was created.
29
+ # - `retry` - A new attempt was created for an existing verification window.
30
+ # - `challenged` - The verification is suspicious and is restricted to non-SMS and
31
+ # non-voice channels only. This mode must be enabled for your customer account
32
+ # by Prelude support.
33
+ # - `blocked` - The verification was blocked.
27
34
  sig do
28
35
  returns(
29
36
  PreludeSDK::Models::VerificationCreateResponse::Status::TaggedSymbol
@@ -107,6 +114,51 @@ module PreludeSDK
107
114
  sig { params(request_id: String).void }
108
115
  attr_writer :request_id
109
116
 
117
+ # The risk factors that contributed to the verification being blocked. Only
118
+ # present when status is "blocked" and the anti-fraud system detected specific
119
+ # risk signals.
120
+ #
121
+ # - `behavioral_pattern` - The phone number past behavior during verification
122
+ # flows exhibits suspicious patterns.
123
+ # - `device_attribute` - The device exhibits characteristics associated with
124
+ # suspicious activity patterns.
125
+ # - `fraud_database` - The phone number has been flagged as suspicious in one or
126
+ # more of our fraud databases.
127
+ # - `location_discrepancy` - The phone number prefix and IP address discrepancy
128
+ # indicates potential fraud.
129
+ # - `network_fingerprint` - The network connection exhibits characteristics
130
+ # associated with suspicious activity patterns.
131
+ # - `poor_conversion_history` - The phone number has a history of poorly
132
+ # converting to a verified phone number.
133
+ # - `prefix_concentration` - The phone number is part of a range known to be
134
+ # associated with suspicious activity patterns.
135
+ # - `suspected_request_tampering` - The SDK signature is invalid and the request
136
+ # is considered to be tampered with.
137
+ # - `suspicious_ip_address` - The IP address is deemed to be associated with
138
+ # suspicious activity patterns.
139
+ # - `temporary_phone_number` - The phone number is known to be a temporary or
140
+ # disposable number.
141
+ sig do
142
+ returns(
143
+ T.nilable(
144
+ T::Array[
145
+ PreludeSDK::Models::VerificationCreateResponse::RiskFactor::TaggedSymbol
146
+ ]
147
+ )
148
+ )
149
+ end
150
+ attr_reader :risk_factors
151
+
152
+ sig do
153
+ params(
154
+ risk_factors:
155
+ T::Array[
156
+ PreludeSDK::Models::VerificationCreateResponse::RiskFactor::OrSymbol
157
+ ]
158
+ ).void
159
+ end
160
+ attr_writer :risk_factors
161
+
110
162
  # The silent verification specific properties.
111
163
  sig do
112
164
  returns(
@@ -138,6 +190,10 @@ module PreludeSDK
138
190
  reason:
139
191
  PreludeSDK::Models::VerificationCreateResponse::Reason::OrSymbol,
140
192
  request_id: String,
193
+ risk_factors:
194
+ T::Array[
195
+ PreludeSDK::Models::VerificationCreateResponse::RiskFactor::OrSymbol
196
+ ],
141
197
  silent: PreludeSDK::Models::VerificationCreateResponse::Silent::OrHash
142
198
  ).returns(T.attached_class)
143
199
  end
@@ -147,6 +203,13 @@ module PreludeSDK
147
203
  # The method used for verifying this phone number.
148
204
  verification_method:,
149
205
  # The status of the verification.
206
+ #
207
+ # - `success` - A new verification window was created.
208
+ # - `retry` - A new attempt was created for an existing verification window.
209
+ # - `challenged` - The verification is suspicious and is restricted to non-SMS and
210
+ # non-voice channels only. This mode must be enabled for your customer account
211
+ # by Prelude support.
212
+ # - `blocked` - The verification was blocked.
150
213
  status:,
151
214
  # The ordered sequence of channels to be used for verification
152
215
  channels: nil,
@@ -169,6 +232,31 @@ module PreludeSDK
169
232
  # anti-fraud system.
170
233
  reason: nil,
171
234
  request_id: nil,
235
+ # The risk factors that contributed to the verification being blocked. Only
236
+ # present when status is "blocked" and the anti-fraud system detected specific
237
+ # risk signals.
238
+ #
239
+ # - `behavioral_pattern` - The phone number past behavior during verification
240
+ # flows exhibits suspicious patterns.
241
+ # - `device_attribute` - The device exhibits characteristics associated with
242
+ # suspicious activity patterns.
243
+ # - `fraud_database` - The phone number has been flagged as suspicious in one or
244
+ # more of our fraud databases.
245
+ # - `location_discrepancy` - The phone number prefix and IP address discrepancy
246
+ # indicates potential fraud.
247
+ # - `network_fingerprint` - The network connection exhibits characteristics
248
+ # associated with suspicious activity patterns.
249
+ # - `poor_conversion_history` - The phone number has a history of poorly
250
+ # converting to a verified phone number.
251
+ # - `prefix_concentration` - The phone number is part of a range known to be
252
+ # associated with suspicious activity patterns.
253
+ # - `suspected_request_tampering` - The SDK signature is invalid and the request
254
+ # is considered to be tampered with.
255
+ # - `suspicious_ip_address` - The IP address is deemed to be associated with
256
+ # suspicious activity patterns.
257
+ # - `temporary_phone_number` - The phone number is known to be a temporary or
258
+ # disposable number.
259
+ risk_factors: nil,
172
260
  # The silent verification specific properties.
173
261
  silent: nil
174
262
  )
@@ -190,6 +278,10 @@ module PreludeSDK
190
278
  reason:
191
279
  PreludeSDK::Models::VerificationCreateResponse::Reason::TaggedSymbol,
192
280
  request_id: String,
281
+ risk_factors:
282
+ T::Array[
283
+ PreludeSDK::Models::VerificationCreateResponse::RiskFactor::TaggedSymbol
284
+ ],
193
285
  silent: PreludeSDK::Models::VerificationCreateResponse::Silent
194
286
  }
195
287
  )
@@ -243,6 +335,13 @@ module PreludeSDK
243
335
  end
244
336
 
245
337
  # The status of the verification.
338
+ #
339
+ # - `success` - A new verification window was created.
340
+ # - `retry` - A new attempt was created for an existing verification window.
341
+ # - `challenged` - The verification is suspicious and is restricted to non-SMS and
342
+ # non-voice channels only. This mode must be enabled for your customer account
343
+ # by Prelude support.
344
+ # - `blocked` - The verification was blocked.
246
345
  module Status
247
346
  extend PreludeSDK::Internal::Type::Enum
248
347
 
@@ -265,6 +364,11 @@ module PreludeSDK
265
364
  :retry,
266
365
  PreludeSDK::Models::VerificationCreateResponse::Status::TaggedSymbol
267
366
  )
367
+ CHALLENGED =
368
+ T.let(
369
+ :challenged,
370
+ PreludeSDK::Models::VerificationCreateResponse::Status::TaggedSymbol
371
+ )
268
372
  BLOCKED =
269
373
  T.let(
270
374
  :blocked,
@@ -451,6 +555,80 @@ module PreludeSDK
451
555
  end
452
556
  end
453
557
 
558
+ module RiskFactor
559
+ extend PreludeSDK::Internal::Type::Enum
560
+
561
+ TaggedSymbol =
562
+ T.type_alias do
563
+ T.all(
564
+ Symbol,
565
+ PreludeSDK::Models::VerificationCreateResponse::RiskFactor
566
+ )
567
+ end
568
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
569
+
570
+ BEHAVIORAL_PATTERN =
571
+ T.let(
572
+ :behavioral_pattern,
573
+ PreludeSDK::Models::VerificationCreateResponse::RiskFactor::TaggedSymbol
574
+ )
575
+ DEVICE_ATTRIBUTE =
576
+ T.let(
577
+ :device_attribute,
578
+ PreludeSDK::Models::VerificationCreateResponse::RiskFactor::TaggedSymbol
579
+ )
580
+ FRAUD_DATABASE =
581
+ T.let(
582
+ :fraud_database,
583
+ PreludeSDK::Models::VerificationCreateResponse::RiskFactor::TaggedSymbol
584
+ )
585
+ LOCATION_DISCREPANCY =
586
+ T.let(
587
+ :location_discrepancy,
588
+ PreludeSDK::Models::VerificationCreateResponse::RiskFactor::TaggedSymbol
589
+ )
590
+ NETWORK_FINGERPRINT =
591
+ T.let(
592
+ :network_fingerprint,
593
+ PreludeSDK::Models::VerificationCreateResponse::RiskFactor::TaggedSymbol
594
+ )
595
+ POOR_CONVERSION_HISTORY =
596
+ T.let(
597
+ :poor_conversion_history,
598
+ PreludeSDK::Models::VerificationCreateResponse::RiskFactor::TaggedSymbol
599
+ )
600
+ PREFIX_CONCENTRATION =
601
+ T.let(
602
+ :prefix_concentration,
603
+ PreludeSDK::Models::VerificationCreateResponse::RiskFactor::TaggedSymbol
604
+ )
605
+ SUSPECTED_REQUEST_TAMPERING =
606
+ T.let(
607
+ :suspected_request_tampering,
608
+ PreludeSDK::Models::VerificationCreateResponse::RiskFactor::TaggedSymbol
609
+ )
610
+ SUSPICIOUS_IP_ADDRESS =
611
+ T.let(
612
+ :suspicious_ip_address,
613
+ PreludeSDK::Models::VerificationCreateResponse::RiskFactor::TaggedSymbol
614
+ )
615
+ TEMPORARY_PHONE_NUMBER =
616
+ T.let(
617
+ :temporary_phone_number,
618
+ PreludeSDK::Models::VerificationCreateResponse::RiskFactor::TaggedSymbol
619
+ )
620
+
621
+ sig do
622
+ override.returns(
623
+ T::Array[
624
+ PreludeSDK::Models::VerificationCreateResponse::RiskFactor::TaggedSymbol
625
+ ]
626
+ )
627
+ end
628
+ def self.values
629
+ end
630
+ end
631
+
454
632
  class Silent < PreludeSDK::Internal::Type::BaseModel
455
633
  OrHash =
456
634
  T.type_alias do
@@ -14,17 +14,27 @@ module PreludeSDK
14
14
  )
15
15
  end
16
16
 
17
+ sig do
18
+ returns(
19
+ PreludeSDK::VerificationManagementDeletePhoneNumberParams::Action::OrSymbol
20
+ )
21
+ end
22
+ attr_accessor :action
23
+
17
24
  # An E.164 formatted phone number to remove from the list.
18
25
  sig { returns(String) }
19
26
  attr_accessor :phone_number
20
27
 
21
28
  sig do
22
29
  params(
30
+ action:
31
+ PreludeSDK::VerificationManagementDeletePhoneNumberParams::Action::OrSymbol,
23
32
  phone_number: String,
24
33
  request_options: PreludeSDK::RequestOptions::OrHash
25
34
  ).returns(T.attached_class)
26
35
  end
27
36
  def self.new(
37
+ action:,
28
38
  # An E.164 formatted phone number to remove from the list.
29
39
  phone_number:,
30
40
  request_options: {}
@@ -33,7 +43,12 @@ module PreludeSDK
33
43
 
34
44
  sig do
35
45
  override.returns(
36
- { phone_number: String, request_options: PreludeSDK::RequestOptions }
46
+ {
47
+ action:
48
+ PreludeSDK::VerificationManagementDeletePhoneNumberParams::Action::OrSymbol,
49
+ phone_number: String,
50
+ request_options: PreludeSDK::RequestOptions
51
+ }
37
52
  )
38
53
  end
39
54
  def to_hash
@@ -15,14 +15,31 @@ module PreludeSDK
15
15
  end
16
16
 
17
17
  sig do
18
- params(request_options: PreludeSDK::RequestOptions::OrHash).returns(
19
- T.attached_class
18
+ returns(
19
+ PreludeSDK::VerificationManagementListPhoneNumbersParams::Action::OrSymbol
20
20
  )
21
21
  end
22
- def self.new(request_options: {})
22
+ attr_accessor :action
23
+
24
+ sig do
25
+ params(
26
+ action:
27
+ PreludeSDK::VerificationManagementListPhoneNumbersParams::Action::OrSymbol,
28
+ request_options: PreludeSDK::RequestOptions::OrHash
29
+ ).returns(T.attached_class)
30
+ end
31
+ def self.new(action:, request_options: {})
23
32
  end
24
33
 
25
- sig { override.returns({ request_options: PreludeSDK::RequestOptions }) }
34
+ sig do
35
+ override.returns(
36
+ {
37
+ action:
38
+ PreludeSDK::VerificationManagementListPhoneNumbersParams::Action::OrSymbol,
39
+ request_options: PreludeSDK::RequestOptions
40
+ }
41
+ )
42
+ end
26
43
  def to_hash
27
44
  end
28
45
 
@@ -14,17 +14,27 @@ module PreludeSDK
14
14
  )
15
15
  end
16
16
 
17
+ sig do
18
+ returns(
19
+ PreludeSDK::VerificationManagementSetPhoneNumberParams::Action::OrSymbol
20
+ )
21
+ end
22
+ attr_accessor :action
23
+
17
24
  # An E.164 formatted phone number to add to the list.
18
25
  sig { returns(String) }
19
26
  attr_accessor :phone_number
20
27
 
21
28
  sig do
22
29
  params(
30
+ action:
31
+ PreludeSDK::VerificationManagementSetPhoneNumberParams::Action::OrSymbol,
23
32
  phone_number: String,
24
33
  request_options: PreludeSDK::RequestOptions::OrHash
25
34
  ).returns(T.attached_class)
26
35
  end
27
36
  def self.new(
37
+ action:,
28
38
  # An E.164 formatted phone number to add to the list.
29
39
  phone_number:,
30
40
  request_options: {}
@@ -33,7 +43,12 @@ module PreludeSDK
33
43
 
34
44
  sig do
35
45
  override.returns(
36
- { phone_number: String, request_options: PreludeSDK::RequestOptions }
46
+ {
47
+ action:
48
+ PreludeSDK::VerificationManagementSetPhoneNumberParams::Action::OrSymbol,
49
+ phone_number: String,
50
+ request_options: PreludeSDK::RequestOptions
51
+ }
37
52
  )
38
53
  end
39
54
  def to_hash
@@ -206,8 +206,9 @@ module PreludeSDK
206
206
  sig { params(app_version: String).void }
207
207
  attr_writer :app_version
208
208
 
209
- # The unique identifier for the user's device. For Android, this corresponds to
210
- # the `ANDROID_ID` and for iOS, this corresponds to the `identifierForVendor`.
209
+ # A unique ID for the user's device. You should ensure that each user device has a
210
+ # unique `device_id` value. Ideally, for Android, this corresponds to the
211
+ # `ANDROID_ID` and for iOS, this corresponds to the `identifierForVendor`.
211
212
  sig { returns(T.nilable(String)) }
212
213
  attr_reader :device_id
213
214
 
@@ -239,15 +240,18 @@ module PreludeSDK
239
240
  end
240
241
  attr_writer :device_platform
241
242
 
242
- # The IP address of the user's device.
243
+ # The public IP v4 or v6 address of the end-user's device. You should collect this
244
+ # from your backend. If your backend is behind a proxy, use the `X-Forwarded-For`,
245
+ # `Forwarded`, `True-Client-IP`, `CF-Connecting-IP` or an equivalent header to get
246
+ # the actual public IP of the end-user's device.
243
247
  sig { returns(T.nilable(String)) }
244
248
  attr_reader :ip
245
249
 
246
250
  sig { params(ip: String).void }
247
251
  attr_writer :ip
248
252
 
249
- # This signal should provide a higher level of trust, indicating that the user is
250
- # genuine. Contact us to discuss your use case. For more details, refer to
253
+ # This signal should indicate a higher level of trust, explicitly stating that the
254
+ # user is genuine. Contact us to discuss your use case. For more details, refer to
251
255
  # [Signals](/verify/v2/documentation/prevent-fraud#signals).
252
256
  sig { returns(T.nilable(T::Boolean)) }
253
257
  attr_reader :is_trusted_user
@@ -255,9 +259,9 @@ module PreludeSDK
255
259
  sig { params(is_trusted_user: T::Boolean).void }
256
260
  attr_writer :is_trusted_user
257
261
 
258
- # The JA4 fingerprint observed for the connection. Prelude will infer it
259
- # automatically when requests go through our client SDK (which uses Prelude's
260
- # edge), but you can also provide it explicitly if you terminate TLS yourself.
262
+ # The JA4 fingerprint observed for the end-user's connection. Prelude will infer
263
+ # it automatically when you use our Frontend SDKs (which use Prelude's edge
264
+ # network), but you can also forward the value if you terminate TLS yourself.
261
265
  sig { returns(T.nilable(String)) }
262
266
  attr_reader :ja4_fingerprint
263
267
 
@@ -299,22 +303,26 @@ module PreludeSDK
299
303
  def self.new(
300
304
  # The version of your application.
301
305
  app_version: nil,
302
- # The unique identifier for the user's device. For Android, this corresponds to
303
- # the `ANDROID_ID` and for iOS, this corresponds to the `identifierForVendor`.
306
+ # A unique ID for the user's device. You should ensure that each user device has a
307
+ # unique `device_id` value. Ideally, for Android, this corresponds to the
308
+ # `ANDROID_ID` and for iOS, this corresponds to the `identifierForVendor`.
304
309
  device_id: nil,
305
310
  # The model of the user's device.
306
311
  device_model: nil,
307
312
  # The type of the user's device.
308
313
  device_platform: nil,
309
- # The IP address of the user's device.
314
+ # The public IP v4 or v6 address of the end-user's device. You should collect this
315
+ # from your backend. If your backend is behind a proxy, use the `X-Forwarded-For`,
316
+ # `Forwarded`, `True-Client-IP`, `CF-Connecting-IP` or an equivalent header to get
317
+ # the actual public IP of the end-user's device.
310
318
  ip: nil,
311
- # This signal should provide a higher level of trust, indicating that the user is
312
- # genuine. Contact us to discuss your use case. For more details, refer to
319
+ # This signal should indicate a higher level of trust, explicitly stating that the
320
+ # user is genuine. Contact us to discuss your use case. For more details, refer to
313
321
  # [Signals](/verify/v2/documentation/prevent-fraud#signals).
314
322
  is_trusted_user: nil,
315
- # The JA4 fingerprint observed for the connection. Prelude will infer it
316
- # automatically when requests go through our client SDK (which uses Prelude's
317
- # edge), but you can also provide it explicitly if you terminate TLS yourself.
323
+ # The JA4 fingerprint observed for the end-user's connection. Prelude will infer
324
+ # it automatically when you use our Frontend SDKs (which use Prelude's edge
325
+ # network), but you can also forward the value if you terminate TLS yourself.
318
326
  ja4_fingerprint: nil,
319
327
  # The version of the user's device operating system.
320
328
  os_version: nil,
@@ -28,12 +28,61 @@ module PreludeSDK
28
28
  sig { returns(String) }
29
29
  attr_accessor :request_id
30
30
 
31
+ # The risk factors that contributed to the suspicious prediction. Only present
32
+ # when prediction is "suspicious" and the anti-fraud system detected specific risk
33
+ # signals.
34
+ #
35
+ # - `behavioral_pattern` - The phone number past behavior during verification
36
+ # flows exhibits suspicious patterns.
37
+ # - `device_attribute` - The device exhibits characteristics associated with
38
+ # suspicious activity patterns.
39
+ # - `fraud_database` - The phone number has been flagged as suspicious in one or
40
+ # more of our fraud databases.
41
+ # - `location_discrepancy` - The phone number prefix and IP address discrepancy
42
+ # indicates potential fraud.
43
+ # - `network_fingerprint` - The network connection exhibits characteristics
44
+ # associated with suspicious activity patterns.
45
+ # - `poor_conversion_history` - The phone number has a history of poorly
46
+ # converting to a verified phone number.
47
+ # - `prefix_concentration` - The phone number is part of a range known to be
48
+ # associated with suspicious activity patterns.
49
+ # - `suspected_request_tampering` - The SDK signature is invalid and the request
50
+ # is considered to be tampered with.
51
+ # - `suspicious_ip_address` - The IP address is deemed to be associated with
52
+ # suspicious activity patterns.
53
+ # - `temporary_phone_number` - The phone number is known to be a temporary or
54
+ # disposable number.
55
+ sig do
56
+ returns(
57
+ T.nilable(
58
+ T::Array[
59
+ PreludeSDK::Models::WatchPredictResponse::RiskFactor::TaggedSymbol
60
+ ]
61
+ )
62
+ )
63
+ end
64
+ attr_reader :risk_factors
65
+
66
+ sig do
67
+ params(
68
+ risk_factors:
69
+ T::Array[
70
+ PreludeSDK::Models::WatchPredictResponse::RiskFactor::OrSymbol
71
+ ]
72
+ ).void
73
+ end
74
+ attr_writer :risk_factors
75
+
31
76
  sig do
32
77
  params(
33
78
  id: String,
34
79
  prediction:
35
80
  PreludeSDK::Models::WatchPredictResponse::Prediction::OrSymbol,
36
- request_id: String
81
+ request_id: String,
82
+ risk_factors:
83
+ T::Array[
84
+ PreludeSDK::Models::WatchPredictResponse::RiskFactor::OrSymbol
85
+ ]
37
86
  ).returns(T.attached_class)
38
87
  end
39
88
  def self.new(
@@ -43,7 +92,32 @@ module PreludeSDK
43
92
  prediction:,
44
93
  # A string that identifies this specific request. Report it back to us to help us
45
94
  # diagnose your issues.
46
- request_id:
95
+ request_id:,
96
+ # The risk factors that contributed to the suspicious prediction. Only present
97
+ # when prediction is "suspicious" and the anti-fraud system detected specific risk
98
+ # signals.
99
+ #
100
+ # - `behavioral_pattern` - The phone number past behavior during verification
101
+ # flows exhibits suspicious patterns.
102
+ # - `device_attribute` - The device exhibits characteristics associated with
103
+ # suspicious activity patterns.
104
+ # - `fraud_database` - The phone number has been flagged as suspicious in one or
105
+ # more of our fraud databases.
106
+ # - `location_discrepancy` - The phone number prefix and IP address discrepancy
107
+ # indicates potential fraud.
108
+ # - `network_fingerprint` - The network connection exhibits characteristics
109
+ # associated with suspicious activity patterns.
110
+ # - `poor_conversion_history` - The phone number has a history of poorly
111
+ # converting to a verified phone number.
112
+ # - `prefix_concentration` - The phone number is part of a range known to be
113
+ # associated with suspicious activity patterns.
114
+ # - `suspected_request_tampering` - The SDK signature is invalid and the request
115
+ # is considered to be tampered with.
116
+ # - `suspicious_ip_address` - The IP address is deemed to be associated with
117
+ # suspicious activity patterns.
118
+ # - `temporary_phone_number` - The phone number is known to be a temporary or
119
+ # disposable number.
120
+ risk_factors: nil
47
121
  )
48
122
  end
49
123
 
@@ -53,7 +127,11 @@ module PreludeSDK
53
127
  id: String,
54
128
  prediction:
55
129
  PreludeSDK::Models::WatchPredictResponse::Prediction::TaggedSymbol,
56
- request_id: String
130
+ request_id: String,
131
+ risk_factors:
132
+ T::Array[
133
+ PreludeSDK::Models::WatchPredictResponse::RiskFactor::TaggedSymbol
134
+ ]
57
135
  }
58
136
  )
59
137
  end
@@ -91,6 +169,77 @@ module PreludeSDK
91
169
  def self.values
92
170
  end
93
171
  end
172
+
173
+ module RiskFactor
174
+ extend PreludeSDK::Internal::Type::Enum
175
+
176
+ TaggedSymbol =
177
+ T.type_alias do
178
+ T.all(Symbol, PreludeSDK::Models::WatchPredictResponse::RiskFactor)
179
+ end
180
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
181
+
182
+ BEHAVIORAL_PATTERN =
183
+ T.let(
184
+ :behavioral_pattern,
185
+ PreludeSDK::Models::WatchPredictResponse::RiskFactor::TaggedSymbol
186
+ )
187
+ DEVICE_ATTRIBUTE =
188
+ T.let(
189
+ :device_attribute,
190
+ PreludeSDK::Models::WatchPredictResponse::RiskFactor::TaggedSymbol
191
+ )
192
+ FRAUD_DATABASE =
193
+ T.let(
194
+ :fraud_database,
195
+ PreludeSDK::Models::WatchPredictResponse::RiskFactor::TaggedSymbol
196
+ )
197
+ LOCATION_DISCREPANCY =
198
+ T.let(
199
+ :location_discrepancy,
200
+ PreludeSDK::Models::WatchPredictResponse::RiskFactor::TaggedSymbol
201
+ )
202
+ NETWORK_FINGERPRINT =
203
+ T.let(
204
+ :network_fingerprint,
205
+ PreludeSDK::Models::WatchPredictResponse::RiskFactor::TaggedSymbol
206
+ )
207
+ POOR_CONVERSION_HISTORY =
208
+ T.let(
209
+ :poor_conversion_history,
210
+ PreludeSDK::Models::WatchPredictResponse::RiskFactor::TaggedSymbol
211
+ )
212
+ PREFIX_CONCENTRATION =
213
+ T.let(
214
+ :prefix_concentration,
215
+ PreludeSDK::Models::WatchPredictResponse::RiskFactor::TaggedSymbol
216
+ )
217
+ SUSPECTED_REQUEST_TAMPERING =
218
+ T.let(
219
+ :suspected_request_tampering,
220
+ PreludeSDK::Models::WatchPredictResponse::RiskFactor::TaggedSymbol
221
+ )
222
+ SUSPICIOUS_IP_ADDRESS =
223
+ T.let(
224
+ :suspicious_ip_address,
225
+ PreludeSDK::Models::WatchPredictResponse::RiskFactor::TaggedSymbol
226
+ )
227
+ TEMPORARY_PHONE_NUMBER =
228
+ T.let(
229
+ :temporary_phone_number,
230
+ PreludeSDK::Models::WatchPredictResponse::RiskFactor::TaggedSymbol
231
+ )
232
+
233
+ sig do
234
+ override.returns(
235
+ T::Array[
236
+ PreludeSDK::Models::WatchPredictResponse::RiskFactor::TaggedSymbol
237
+ ]
238
+ )
239
+ end
240
+ def self.values
241
+ end
242
+ end
94
243
  end
95
244
  end
96
245
  end
@@ -14,7 +14,8 @@ module PreludeSDK
14
14
  )
15
15
  end
16
16
 
17
- # A list of events to dispatch.
17
+ # A list of events to dispatch. A maximum of 100 events can be sent in a single
18
+ # request.
18
19
  sig { returns(T::Array[PreludeSDK::WatchSendEventsParams::Event]) }
19
20
  attr_accessor :events
20
21
 
@@ -25,7 +26,8 @@ module PreludeSDK
25
26
  ).returns(T.attached_class)
26
27
  end
27
28
  def self.new(
28
- # A list of events to dispatch.
29
+ # A list of events to dispatch. A maximum of 100 events can be sent in a single
30
+ # request.
29
31
  events:,
30
32
  request_options: {}
31
33
  )