Class: ThePlaidApi::SignalEvaluateResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/signal_evaluate_response.rb

Overview

SignalEvaluateResponse defines the response schema for ‘/signal/evaluate`

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(request_id:, scores:, warnings:, core_attributes: SKIP, risk_profile: SKIP, ruleset: SKIP, additional_properties: nil) ⇒ SignalEvaluateResponse

Returns a new instance of SignalEvaluateResponse.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/the_plaid_api/models/signal_evaluate_response.rb', line 97

def initialize(request_id:, scores:, warnings:, core_attributes: SKIP,
               risk_profile: SKIP, ruleset: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @request_id = request_id
  @scores = scores
  @core_attributes = core_attributes unless core_attributes == SKIP
  @risk_profile = risk_profile unless risk_profile == SKIP
  @ruleset = ruleset unless ruleset == SKIP
  @warnings = warnings
  @additional_properties = additional_properties
end

Instance Attribute Details

#core_attributesSignalEvaluateCoreAttributes

The core attributes object contains additional data that can be used to assess the ACH return risk. If using a Balance-only ruleset, only ‘available_balance` and `current_balance` will be returned as core attributes. If using a Signal Transaction Scores ruleset, over 80 core attributes will be returned. Examples of attributes include: `available_balance` and `current_balance`: The balance in the ACH transaction funding account `days_since_first_plaid_connection`: The number of days since the first time the Item was connected to an application via Plaid `plaid_connections_count_7d`: The number of times the Item has been connected to applications via Plaid over the past 7 days `plaid_connections_count_30d`: The number of times the Item has been connected to applications via Plaid over the past 30 days `total_plaid_connections_count`: The number of times the Item has been connected to applications via Plaid `is_savings_or_money_market_account`: Indicates whether the ACH transaction funding account is a savings/money market account For the full list and detailed documentation of core attributes available, or to request that core attributes not be returned, contact Sales or your Plaid account manager.



45
46
47
# File 'lib/the_plaid_api/models/signal_evaluate_response.rb', line 45

def core_attributes
  @core_attributes
end

#request_idString

A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.

Returns:

  • (String)


16
17
18
# File 'lib/the_plaid_api/models/signal_evaluate_response.rb', line 16

def request_id
  @request_id
end

#risk_profileSignalEvaluateRiskProfile

RiskProfile is deprecated, use ‘ruleset` instead.



49
50
51
# File 'lib/the_plaid_api/models/signal_evaluate_response.rb', line 49

def risk_profile
  @risk_profile
end

#rulesetSignalEvaluateRuleset

Details about the transaction result after evaluation by the requested Ruleset. If a ‘ruleset_key` is not provided, for customers who began using Signal Transaction Scores before October 15, 2025, by default, this field will be omitted. To learn more, see [Signal Rules](plaid.com/docs/signal/signal-rules/).



57
58
59
# File 'lib/the_plaid_api/models/signal_evaluate_response.rb', line 57

def ruleset
  @ruleset
end

#scoresSignalEvaluateScores

Risk scoring details broken down by risk category. When using a Balance-only ruleset, this object will not be returned.



21
22
23
# File 'lib/the_plaid_api/models/signal_evaluate_response.rb', line 21

def scores
  @scores
end

#warningsArray[SignalWarning]

If bank information was not available to be used in the Signal Transaction Scores model, this array contains warnings describing why bank data is missing. If you want to receive an API error instead of results in the case of missing bank data, file a support ticket or contact your Plaid account manager.

Returns:



65
66
67
# File 'lib/the_plaid_api/models/signal_evaluate_response.rb', line 65

def warnings
  @warnings
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/the_plaid_api/models/signal_evaluate_response.rb', line 113

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  request_id = hash.key?('request_id') ? hash['request_id'] : nil
  scores = SignalEvaluateScores.from_hash(hash['scores']) if hash['scores']
  # Parameter is an array, so we need to iterate through it
  warnings = nil
  unless hash['warnings'].nil?
    warnings = []
    hash['warnings'].each do |structure|
      warnings << (SignalWarning.from_hash(structure) if structure)
    end
  end

  warnings = nil unless hash.key?('warnings')
  core_attributes = SignalEvaluateCoreAttributes.from_hash(hash['core_attributes']) if
    hash['core_attributes']
  risk_profile = SignalEvaluateRiskProfile.from_hash(hash['risk_profile']) if
    hash['risk_profile']
  ruleset = SignalEvaluateRuleset.from_hash(hash['ruleset']) if hash['ruleset']

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  SignalEvaluateResponse.new(request_id: request_id,
                             scores: scores,
                             warnings: warnings,
                             core_attributes: core_attributes,
                             risk_profile: risk_profile,
                             ruleset: ruleset,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



68
69
70
71
72
73
74
75
76
77
# File 'lib/the_plaid_api/models/signal_evaluate_response.rb', line 68

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['request_id'] = 'request_id'
  @_hash['scores'] = 'scores'
  @_hash['core_attributes'] = 'core_attributes'
  @_hash['risk_profile'] = 'risk_profile'
  @_hash['ruleset'] = 'ruleset'
  @_hash['warnings'] = 'warnings'
  @_hash
end

.nullablesObject

An array for nullable fields



89
90
91
92
93
94
95
# File 'lib/the_plaid_api/models/signal_evaluate_response.rb', line 89

def self.nullables
  %w[
    scores
    risk_profile
    ruleset
  ]
end

.optionalsObject

An array for optional fields



80
81
82
83
84
85
86
# File 'lib/the_plaid_api/models/signal_evaluate_response.rb', line 80

def self.optionals
  %w[
    core_attributes
    risk_profile
    ruleset
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



161
162
163
164
165
166
167
# File 'lib/the_plaid_api/models/signal_evaluate_response.rb', line 161

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} request_id: #{@request_id.inspect}, scores: #{@scores.inspect},"\
  " core_attributes: #{@core_attributes.inspect}, risk_profile: #{@risk_profile.inspect},"\
  " ruleset: #{@ruleset.inspect}, warnings: #{@warnings.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



153
154
155
156
157
158
# File 'lib/the_plaid_api/models/signal_evaluate_response.rb', line 153

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} request_id: #{@request_id}, scores: #{@scores}, core_attributes:"\
  " #{@core_attributes}, risk_profile: #{@risk_profile}, ruleset: #{@ruleset}, warnings:"\
  " #{@warnings}, additional_properties: #{@additional_properties}>"
end