Class: ThePlaidApi::DocumentRiskSignal

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

Overview

Details about a certain reason as to why a document could potentially be fraudulent.

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(type:, field:, has_fraud_risk:, institution_metadata:, expected_value:, actual_value:, signal_description:, page_number:, additional_properties: nil) ⇒ DocumentRiskSignal

Returns a new instance of DocumentRiskSignal.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/the_plaid_api/models/document_risk_signal.rb', line 83

def initialize(type:, field:, has_fraud_risk:, institution_metadata:,
               expected_value:, actual_value:, signal_description:,
               page_number:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @type = type
  @field = field
  @has_fraud_risk = has_fraud_risk
  @institution_metadata = 
  @expected_value = expected_value
  @actual_value = actual_value
  @signal_description = signal_description
  @page_number = page_number
  @additional_properties = additional_properties
end

Instance Attribute Details

#actual_valueString

The derived value obtained in the risk signal calculation process for this field

Returns:

  • (String)


38
39
40
# File 'lib/the_plaid_api/models/document_risk_signal.rb', line 38

def actual_value
  @actual_value
end

#expected_valueString

The expected value of the field, as seen on the document

Returns:

  • (String)


33
34
35
# File 'lib/the_plaid_api/models/document_risk_signal.rb', line 33

def expected_value
  @expected_value
end

#fieldString

The field which the risk signal was computed for

Returns:

  • (String)


19
20
21
# File 'lib/the_plaid_api/models/document_risk_signal.rb', line 19

def field
  @field
end

#has_fraud_riskTrueClass | FalseClass

A flag used to quickly identify if the signal indicates that this field is authentic or fraudulent

Returns:

  • (TrueClass | FalseClass)


24
25
26
# File 'lib/the_plaid_api/models/document_risk_signal.rb', line 24

def has_fraud_risk
  @has_fraud_risk
end

#institution_metadataDocumentRiskSignalInstitutionMetadata

An object which contains additional metadata about the institution used to compute the verification attribute



29
30
31
# File 'lib/the_plaid_api/models/document_risk_signal.rb', line 29

def 
  @institution_metadata
end

#page_numberInteger

The relevant page associated with the risk signal. If the risk signal is not associated with a specific page, the value will be 0.

Returns:

  • (Integer)


48
49
50
# File 'lib/the_plaid_api/models/document_risk_signal.rb', line 48

def page_number
  @page_number
end

#signal_descriptionString

A human-readable explanation providing more detail into the particular risk signal

Returns:

  • (String)


43
44
45
# File 'lib/the_plaid_api/models/document_risk_signal.rb', line 43

def signal_description
  @signal_description
end

#typeString

The type of risk found in the risk signal check.

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/document_risk_signal.rb', line 15

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/the_plaid_api/models/document_risk_signal.rb', line 101

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash.key?('type') ? hash['type'] : nil
  field = hash.key?('field') ? hash['field'] : nil
  has_fraud_risk =
    hash.key?('has_fraud_risk') ? hash['has_fraud_risk'] : nil
  if hash['institution_metadata']
     = DocumentRiskSignalInstitutionMetadata.from_hash(hash['institution_metadata'])
  end
  expected_value =
    hash.key?('expected_value') ? hash['expected_value'] : nil
  actual_value = hash.key?('actual_value') ? hash['actual_value'] : nil
  signal_description =
    hash.key?('signal_description') ? hash['signal_description'] : nil
  page_number = hash.key?('page_number') ? hash['page_number'] : nil

  # 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.
  DocumentRiskSignal.new(type: type,
                         field: field,
                         has_fraud_risk: has_fraud_risk,
                         institution_metadata: ,
                         expected_value: expected_value,
                         actual_value: actual_value,
                         signal_description: signal_description,
                         page_number: page_number,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/the_plaid_api/models/document_risk_signal.rb', line 51

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['type'] = 'type'
  @_hash['field'] = 'field'
  @_hash['has_fraud_risk'] = 'has_fraud_risk'
  @_hash['institution_metadata'] = 'institution_metadata'
  @_hash['expected_value'] = 'expected_value'
  @_hash['actual_value'] = 'actual_value'
  @_hash['signal_description'] = 'signal_description'
  @_hash['page_number'] = 'page_number'
  @_hash
end

.nullablesObject

An array for nullable fields



70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/the_plaid_api/models/document_risk_signal.rb', line 70

def self.nullables
  %w[
    type
    field
    has_fraud_risk
    institution_metadata
    expected_value
    actual_value
    signal_description
    page_number
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



148
149
150
151
152
153
154
155
# File 'lib/the_plaid_api/models/document_risk_signal.rb', line 148

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type.inspect}, field: #{@field.inspect}, has_fraud_risk:"\
  " #{@has_fraud_risk.inspect}, institution_metadata: #{@institution_metadata.inspect},"\
  " expected_value: #{@expected_value.inspect}, actual_value: #{@actual_value.inspect},"\
  " signal_description: #{@signal_description.inspect}, page_number: #{@page_number.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



139
140
141
142
143
144
145
# File 'lib/the_plaid_api/models/document_risk_signal.rb', line 139

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type}, field: #{@field}, has_fraud_risk: #{@has_fraud_risk},"\
  " institution_metadata: #{@institution_metadata}, expected_value: #{@expected_value},"\
  " actual_value: #{@actual_value}, signal_description: #{@signal_description}, page_number:"\
  " #{@page_number}, additional_properties: #{@additional_properties}>"
end