Class: PreludeSDK::Resources::Watch

Inherits:
Object
  • Object
show all
Defined in:
lib/prelude_sdk/resources/watch.rb,
sig/prelude_sdk/resources/watch.rbs

Overview

Evaluate email addresses and phone numbers for trustworthiness.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Watch

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Watch.

Parameters:



149
150
151
# File 'lib/prelude_sdk/resources/watch.rb', line 149

def initialize(client:)
  @client = client
end

Instance Method Details

#evaluate(flow_id:, target:, attributes: nil, dispatch_id: nil, signals: nil, request_options: {}) ⇒ PreludeSDK::Models::WatchEvaluateResponse

Some parameter documentations has been truncated, see Models::WatchEvaluateParams for more details.

Beta. The request and response shapes may still change, and flows and recipes are configured by Prelude on your behalf for now. Talk to us before you build against it.

Score a target against the rules configured for one moment in your product — signup, checkout, password reset. The flow selects which recipes run; each recipe scores its rules against a threshold and returns its own verdict, and the evaluation answers with the most severe verdict and action across them. Where Predict returns a single model-derived outcome, Eval returns the full breakdown, so you can see which rules fired and which could not run. Scoring-only — it does not update counters by itself.

Parameters:

  • flow_id (String) —

    The flow to evaluate. A flow names the moment you are guarding and selects the r

  • target (PreludeSDK::Models::Target) —

    The identifier to score — a phone number or email address.

  • attributes (Hash{Symbol=>String}) —

    Values for the attributes the flow's recipes declare, keyed without the attr.

  • dispatch_id (String) —

    The identifier of the dispatch that came from the front-end SDK. Signals it carr

  • signals (PreludeSDK::Models::Signals) —

    The signals used for anti-fraud. For more details, refer to [Signals](/verify/v2

  • request_options (PreludeSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



39
40
41
42
43
44
45
46
47
48
# File 'lib/prelude_sdk/resources/watch.rb', line 39

def evaluate(params)
  parsed, options = PreludeSDK::WatchEvaluateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v2/watch/eval",
    body: parsed,
    model: PreludeSDK::Models::WatchEvaluateResponse,
    options: options
  )
end

#predict(target:, dispatch_id: nil, metadata: nil, signals: nil, request_options: {}) ⇒ PreludeSDK::Models::WatchPredictResponse

Some parameter documentations has been truncated, see Models::WatchPredictParams for more details.

At signup, score the user's phone number or email address (target) as legitimate or suspicious. Scoring-only — does not update counters by itself. When using Feedback, call predict before verification.started on the same target (and correlation_id when used) so feedback can warm Watch auth-start counters. Use Events for product fraud labels; use Feedback only if you run your own phone verification funnel outside Prelude Verify.

Parameters:

Returns:

See Also:



75
76
77
78
79
80
81
82
83
84
# File 'lib/prelude_sdk/resources/watch.rb', line 75

def predict(params)
  parsed, options = PreludeSDK::WatchPredictParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v2/watch/predict",
    body: parsed,
    model: PreludeSDK::Models::WatchPredictResponse,
    options: options
  )
end

#send_events(events:, request_options: {}) ⇒ PreludeSDK::Models::WatchSendEventsResponse

Some parameter documentations has been truncated, see Models::WatchSendEventsParams for more details.

Send custom fraud signals from your application (labels and confidence levels). Events capture product-specific risk patterns and are weighted when scoring traffic. Use without Predict or Feedback if you only need to report product-side abuse (for example account.banned). Feedback is a separate, optional endpoint for self-hosted phone verification funnels.

Parameters:

Returns:

See Also:



104
105
106
107
108
109
110
111
112
113
# File 'lib/prelude_sdk/resources/watch.rb', line 104

def send_events(params)
  parsed, options = PreludeSDK::WatchSendEventsParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v2/watch/event",
    body: parsed,
    model: PreludeSDK::Models::WatchSendEventsResponse,
    options: options
  )
end

#send_feedbacks(feedbacks:, request_options: {}) ⇒ PreludeSDK::Models::WatchSendFeedbacksResponse

Some parameter documentations has been truncated, see Models::WatchSendFeedbacksParams for more details.

Optional. Report verification-funnel steps (verification.started, verification.completed) when you run phone verification outside Prelude Verify. Feeds Watch abuse-rate counters for your own flow. Call Predict on the same target before verification.started and reuse metadata.correlation_id so auth-start counters receive predict signals; without a linked predict, only attempt-rate counters update on started. Not required if you only use Events and/or Predict, or if Verify already handles verification for that traffic.

Parameters:

Returns:

See Also:



135
136
137
138
139
140
141
142
143
144
# File 'lib/prelude_sdk/resources/watch.rb', line 135

def send_feedbacks(params)
  parsed, options = PreludeSDK::WatchSendFeedbacksParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v2/watch/feedback",
    body: parsed,
    model: PreludeSDK::Models::WatchSendFeedbacksResponse,
    options: options
  )
end