Class: ThePlaidApi::LendScore

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

Overview

The results of the LendScore

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(score: SKIP, reason_codes: SKIP, error_reason: SKIP, additional_properties: nil) ⇒ LendScore

Returns a new instance of LendScore.



54
55
56
57
58
59
60
61
62
63
# File 'lib/the_plaid_api/models/lend_score.rb', line 54

def initialize(score: SKIP, reason_codes: SKIP, error_reason: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @score = score unless score == SKIP
  @reason_codes = reason_codes unless reason_codes == SKIP
  @error_reason = error_reason unless error_reason == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#error_reasonString

Human-readable description of why the LendScore could not be computed.

Returns:

  • (String)


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

def error_reason
  @error_reason
end

#reason_codesArray[String]

The reasons for an individual having risk according to the LendScore. For a full list of possible reason codes and a mapping of reason codes to human-readable reasons, contact your Plaid Account Manager. Different LendScore versions will use different sets of reason codes.

Returns:

  • (Array[String])


22
23
24
# File 'lib/the_plaid_api/models/lend_score.rb', line 22

def reason_codes
  @reason_codes
end

#scoreInteger

The score returned by the LendScore model. Will be an integer in the range 1 to 99. Higher scores indicate lower credit risk.

Returns:

  • (Integer)


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

def score
  @score
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/the_plaid_api/models/lend_score.rb', line 66

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  score = hash.key?('score') ? hash['score'] : SKIP
  reason_codes = hash.key?('reason_codes') ? hash['reason_codes'] : SKIP
  error_reason = hash.key?('error_reason') ? hash['error_reason'] : 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.
  LendScore.new(score: score,
                reason_codes: reason_codes,
                error_reason: error_reason,
                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
# File 'lib/the_plaid_api/models/lend_score.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['score'] = 'score'
  @_hash['reason_codes'] = 'reason_codes'
  @_hash['error_reason'] = 'error_reason'
  @_hash
end

.nullablesObject

An array for nullable fields



47
48
49
50
51
52
# File 'lib/the_plaid_api/models/lend_score.rb', line 47

def self.nullables
  %w[
    score
    error_reason
  ]
end

.optionalsObject

An array for optional fields



38
39
40
41
42
43
44
# File 'lib/the_plaid_api/models/lend_score.rb', line 38

def self.optionals
  %w[
    score
    reason_codes
    error_reason
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



96
97
98
99
100
# File 'lib/the_plaid_api/models/lend_score.rb', line 96

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} score: #{@score.inspect}, reason_codes: #{@reason_codes.inspect},"\
  " error_reason: #{@error_reason.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} score: #{@score}, reason_codes: #{@reason_codes}, error_reason:"\
  " #{@error_reason}, additional_properties: #{@additional_properties}>"
end