Class: ThePlaidApi::CreditSessionResults

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

Overview

The set of results for a Link session.

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(item_add_results: SKIP, bank_income_results: SKIP, bank_employment_results: SKIP, payroll_income_results: SKIP, document_income_results: SKIP, additional_properties: nil) ⇒ CreditSessionResults

Returns a new instance of CreditSessionResults.



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/the_plaid_api/models/credit_session_results.rb', line 61

def initialize(item_add_results: SKIP, bank_income_results: SKIP,
               bank_employment_results: SKIP, payroll_income_results: SKIP,
               document_income_results: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @item_add_results = item_add_results unless item_add_results == SKIP
  @bank_income_results = bank_income_results unless bank_income_results == SKIP
  @bank_employment_results = bank_employment_results unless bank_employment_results == SKIP
  @payroll_income_results = payroll_income_results unless payroll_income_results == SKIP
  @document_income_results = document_income_results unless document_income_results == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#bank_employment_resultsArray[CreditSessionBankEmploymentResult]

The set of bank employment verifications for the Link session.



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

def bank_employment_results
  @bank_employment_results
end

#bank_income_resultsArray[CreditSessionBankIncomeResult]

The set of bank income verifications for the Link session.

Returns:



18
19
20
# File 'lib/the_plaid_api/models/credit_session_results.rb', line 18

def bank_income_results
  @bank_income_results
end

#document_income_resultsCreditSessionDocumentIncomeResult

The details of a document income verification in Link



30
31
32
# File 'lib/the_plaid_api/models/credit_session_results.rb', line 30

def document_income_results
  @document_income_results
end

#item_add_resultsArray[CreditSessionItemAddResult]

The set of Item adds for the Link session.

Returns:



14
15
16
# File 'lib/the_plaid_api/models/credit_session_results.rb', line 14

def item_add_results
  @item_add_results
end

#payroll_income_resultsArray[CreditSessionPayrollIncomeResult]

The set of payroll income verifications for the Link session.



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

def payroll_income_results
  @payroll_income_results
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



76
77
78
79
80
81
82
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
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
137
138
# File 'lib/the_plaid_api/models/credit_session_results.rb', line 76

def self.from_hash(hash)
  return nil unless hash

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

  item_add_results = SKIP unless hash.key?('item_add_results')
  # Parameter is an array, so we need to iterate through it
  bank_income_results = nil
  unless hash['bank_income_results'].nil?
    bank_income_results = []
    hash['bank_income_results'].each do |structure|
      bank_income_results << (CreditSessionBankIncomeResult.from_hash(structure) if structure)
    end
  end

  bank_income_results = SKIP unless hash.key?('bank_income_results')
  # Parameter is an array, so we need to iterate through it
  bank_employment_results = nil
  unless hash['bank_employment_results'].nil?
    bank_employment_results = []
    hash['bank_employment_results'].each do |structure|
      bank_employment_results << (CreditSessionBankEmploymentResult.from_hash(structure) if structure)
    end
  end

  bank_employment_results = SKIP unless hash.key?('bank_employment_results')
  # Parameter is an array, so we need to iterate through it
  payroll_income_results = nil
  unless hash['payroll_income_results'].nil?
    payroll_income_results = []
    hash['payroll_income_results'].each do |structure|
      payroll_income_results << (CreditSessionPayrollIncomeResult.from_hash(structure) if structure)
    end
  end

  payroll_income_results = SKIP unless hash.key?('payroll_income_results')
  if hash['document_income_results']
    document_income_results = CreditSessionDocumentIncomeResult.from_hash(hash['document_income_results'])
  end

  # 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.
  CreditSessionResults.new(item_add_results: item_add_results,
                           bank_income_results: bank_income_results,
                           bank_employment_results: bank_employment_results,
                           payroll_income_results: payroll_income_results,
                           document_income_results: document_income_results,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/the_plaid_api/models/credit_session_results.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['item_add_results'] = 'item_add_results'
  @_hash['bank_income_results'] = 'bank_income_results'
  @_hash['bank_employment_results'] = 'bank_employment_results'
  @_hash['payroll_income_results'] = 'payroll_income_results'
  @_hash['document_income_results'] = 'document_income_results'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
58
59
# File 'lib/the_plaid_api/models/credit_session_results.rb', line 55

def self.nullables
  %w[
    document_income_results
  ]
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
52
# File 'lib/the_plaid_api/models/credit_session_results.rb', line 44

def self.optionals
  %w[
    item_add_results
    bank_income_results
    bank_employment_results
    payroll_income_results
    document_income_results
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



150
151
152
153
154
155
156
157
# File 'lib/the_plaid_api/models/credit_session_results.rb', line 150

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} item_add_results: #{@item_add_results.inspect}, bank_income_results:"\
  " #{@bank_income_results.inspect}, bank_employment_results:"\
  " #{@bank_employment_results.inspect}, payroll_income_results:"\
  " #{@payroll_income_results.inspect}, document_income_results:"\
  " #{@document_income_results.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



141
142
143
144
145
146
147
# File 'lib/the_plaid_api/models/credit_session_results.rb', line 141

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} item_add_results: #{@item_add_results}, bank_income_results:"\
  " #{@bank_income_results}, bank_employment_results: #{@bank_employment_results},"\
  " payroll_income_results: #{@payroll_income_results}, document_income_results:"\
  " #{@document_income_results}, additional_properties: #{@additional_properties}>"
end