Class: ThePlaidApi::RiskCheckBehavior

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

Overview

Result summary object specifying values for ‘behavior` attributes of risk check, when available.

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(user_interactions:, fraud_ring_detected:, bot_detected:, risk_level: SKIP, additional_properties: nil) ⇒ RiskCheckBehavior

Returns a new instance of RiskCheckBehavior.



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

def initialize(user_interactions:, fraud_ring_detected:, bot_detected:,
               risk_level: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @user_interactions = user_interactions
  @fraud_ring_detected = fraud_ring_detected
  @bot_detected = bot_detected
  @risk_level = risk_level unless risk_level == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#bot_detectedRiskCheckBehaviorBotDetectedLabel

Field describing the outcome of a bot detection behavior risk check. ‘yes` indicates that automated activity was detected. `no` indicates that automated activity was not detected. `no_data` indicates there was not enough information available to give an accurate signal.



42
43
44
# File 'lib/the_plaid_api/models/risk_check_behavior.rb', line 42

def bot_detected
  @bot_detected
end

#fraud_ring_detectedRiskCheckBehaviorFraudRingDetectedLabel

Field describing the outcome of a fraud ring behavior risk check. ‘yes` indicates that fraud ring activity was detected. `no` indicates that fraud ring activity was not detected. `no_data` indicates there was not enough information available to give an accurate signal.



34
35
36
# File 'lib/the_plaid_api/models/risk_check_behavior.rb', line 34

def fraud_ring_detected
  @fraud_ring_detected
end

#risk_levelRiskLevelWithNoData

Risk level for the given risk check type, when available.

Returns:



46
47
48
# File 'lib/the_plaid_api/models/risk_check_behavior.rb', line 46

def risk_level
  @risk_level
end

#user_interactionsRiskCheckBehaviorUserInteractionsLabel

Field describing the overall user interaction signals of a behavior risk check. This value represents how familiar the user is with the personal data they provide, based on a number of signals that are collected during their session. ‘genuine` indicates the user has high familiarity with the data they are providing, and that fraud is unlikely. `neutral` indicates some signals are present in between `risky` and `genuine`, but there are not enough clear signals to determine an outcome. `risky` indicates the user has low familiarity with the data they are providing, and that fraud is likely. `no_data` indicates there is not sufficient information to give an accurate signal.



26
27
28
# File 'lib/the_plaid_api/models/risk_check_behavior.rb', line 26

def user_interactions
  @user_interactions
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/the_plaid_api/models/risk_check_behavior.rb', line 83

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  user_interactions =
    hash.key?('user_interactions') ? hash['user_interactions'] : nil
  fraud_ring_detected =
    hash.key?('fraud_ring_detected') ? hash['fraud_ring_detected'] : nil
  bot_detected = hash.key?('bot_detected') ? hash['bot_detected'] : nil
  risk_level = hash.key?('risk_level') ? hash['risk_level'] : SKIP

  # 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.
  RiskCheckBehavior.new(user_interactions: user_interactions,
                        fraud_ring_detected: fraud_ring_detected,
                        bot_detected: bot_detected,
                        risk_level: risk_level,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
# File 'lib/the_plaid_api/models/risk_check_behavior.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['user_interactions'] = 'user_interactions'
  @_hash['fraud_ring_detected'] = 'fraud_ring_detected'
  @_hash['bot_detected'] = 'bot_detected'
  @_hash['risk_level'] = 'risk_level'
  @_hash
end

.nullablesObject

An array for nullable fields



66
67
68
# File 'lib/the_plaid_api/models/risk_check_behavior.rb', line 66

def self.nullables
  []
end

.optionalsObject

An array for optional fields



59
60
61
62
63
# File 'lib/the_plaid_api/models/risk_check_behavior.rb', line 59

def self.optionals
  %w[
    risk_level
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



118
119
120
121
122
123
# File 'lib/the_plaid_api/models/risk_check_behavior.rb', line 118

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} user_interactions: #{@user_interactions.inspect}, fraud_ring_detected:"\
  " #{@fraud_ring_detected.inspect}, bot_detected: #{@bot_detected.inspect}, risk_level:"\
  " #{@risk_level.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



110
111
112
113
114
115
# File 'lib/the_plaid_api/models/risk_check_behavior.rb', line 110

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} user_interactions: #{@user_interactions}, fraud_ring_detected:"\
  " #{@fraud_ring_detected}, bot_detected: #{@bot_detected}, risk_level: #{@risk_level},"\
  " additional_properties: #{@additional_properties}>"
end