Class: PreludeSDK::Resources::Watch
- Inherits:
-
Object
- Object
- PreludeSDK::Resources::Watch
- 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
-
#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.
-
#initialize(client:) ⇒ Watch
constructor
private
A new instance of Watch.
-
#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.
-
#send_events(events:, request_options: {}) ⇒ PreludeSDK::Models::WatchSendEventsResponse
Some parameter documentations has been truncated, see Models::WatchSendEventsParams for more details.
-
#send_feedbacks(feedbacks:, request_options: {}) ⇒ PreludeSDK::Models::WatchSendFeedbacksResponse
Some parameter documentations has been truncated, see Models::WatchSendFeedbacksParams for more details.
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.
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.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/prelude_sdk/resources/watch.rb', line 39 def evaluate(params) parsed, = PreludeSDK::WatchEvaluateParams.dump_request(params) @client.request( method: :post, path: "v2/watch/eval", body: parsed, model: PreludeSDK::Models::WatchEvaluateResponse, 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.
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/prelude_sdk/resources/watch.rb', line 75 def predict(params) parsed, = PreludeSDK::WatchPredictParams.dump_request(params) @client.request( method: :post, path: "v2/watch/predict", body: parsed, model: PreludeSDK::Models::WatchPredictResponse, 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.
104 105 106 107 108 109 110 111 112 113 |
# File 'lib/prelude_sdk/resources/watch.rb', line 104 def send_events(params) parsed, = PreludeSDK::WatchSendEventsParams.dump_request(params) @client.request( method: :post, path: "v2/watch/event", body: parsed, model: PreludeSDK::Models::WatchSendEventsResponse, 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.
135 136 137 138 139 140 141 142 143 144 |
# File 'lib/prelude_sdk/resources/watch.rb', line 135 def send_feedbacks(params) parsed, = PreludeSDK::WatchSendFeedbacksParams.dump_request(params) @client.request( method: :post, path: "v2/watch/feedback", body: parsed, model: PreludeSDK::Models::WatchSendFeedbacksResponse, options: ) end |