Class: ThePlaidApi::LoanAccount

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

Overview

A loan type account.

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(auto:, business:, commercial:, construction:, consumer:, home_equity:, line_of_credit:, loan:, mortgage:, other:, overdraft:, student:, additional_properties: nil) ⇒ LoanAccount

Returns a new instance of LoanAccount.



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/loan_account.rb', line 88

def initialize(auto:, business:, commercial:, construction:, consumer:,
               home_equity:, line_of_credit:, loan:, mortgage:, other:,
               overdraft:, student:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @auto = auto
  @business = business
  @commercial = commercial
  @construction = construction
  @consumer = consumer
  @home_equity = home_equity
  @line_of_credit = line_of_credit
  @loan = loan
  @mortgage = mortgage
  @other = other
  @overdraft = overdraft
  @student = student
  @additional_properties = additional_properties
end

Instance Attribute Details

#autoString

Auto loan

Returns:

  • (String)


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

def auto
  @auto
end

#businessString

Business loan

Returns:

  • (String)


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

def business
  @business
end

#commercialString

Commercial loan

Returns:

  • (String)


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

def commercial
  @commercial
end

#constructionString

Construction loan

Returns:

  • (String)


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

def construction
  @construction
end

#consumerString

Consumer loan

Returns:

  • (String)


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

def consumer
  @consumer
end

#home_equityString

Home Equity Line of Credit (HELOC)

Returns:

  • (String)


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

def home_equity
  @home_equity
end

#line_of_creditString

Pre-approved line of credit

Returns:

  • (String)


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

def line_of_credit
  @line_of_credit
end

#loanString

General loan

Returns:

  • (String)


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

def loan
  @loan
end

#mortgageString

Mortgage loan

Returns:

  • (String)


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

def mortgage
  @mortgage
end

#otherString

Other loan type or unknown loan type

Returns:

  • (String)


50
51
52
# File 'lib/the_plaid_api/models/loan_account.rb', line 50

def other
  @other
end

#overdraftString

Pre-approved overdraft account, usually tied to a checking account

Returns:

  • (String)


54
55
56
# File 'lib/the_plaid_api/models/loan_account.rb', line 54

def overdraft
  @overdraft
end

#studentString

Student loan

Returns:

  • (String)


58
59
60
# File 'lib/the_plaid_api/models/loan_account.rb', line 58

def student
  @student
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/the_plaid_api/models/loan_account.rb', line 110

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  auto = hash.key?('auto') ? hash['auto'] : nil
  business = hash.key?('business') ? hash['business'] : nil
  commercial = hash.key?('commercial') ? hash['commercial'] : nil
  construction = hash.key?('construction') ? hash['construction'] : nil
  consumer = hash.key?('consumer') ? hash['consumer'] : nil
  home_equity = hash.key?('home equity') ? hash['home equity'] : nil
  line_of_credit =
    hash.key?('line of credit') ? hash['line of credit'] : nil
  loan = hash.key?('loan') ? hash['loan'] : nil
  mortgage = hash.key?('mortgage') ? hash['mortgage'] : nil
  other = hash.key?('other') ? hash['other'] : nil
  overdraft = hash.key?('overdraft') ? hash['overdraft'] : nil
  student = hash.key?('student') ? hash['student'] : 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.
  LoanAccount.new(auto: auto,
                  business: business,
                  commercial: commercial,
                  construction: construction,
                  consumer: consumer,
                  home_equity: home_equity,
                  line_of_credit: line_of_credit,
                  loan: loan,
                  mortgage: mortgage,
                  other: other,
                  overdraft: overdraft,
                  student: student,
                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['auto'] = 'auto'
  @_hash['business'] = 'business'
  @_hash['commercial'] = 'commercial'
  @_hash['construction'] = 'construction'
  @_hash['consumer'] = 'consumer'
  @_hash['home_equity'] = 'home equity'
  @_hash['line_of_credit'] = 'line of credit'
  @_hash['loan'] = 'loan'
  @_hash['mortgage'] = 'mortgage'
  @_hash['other'] = 'other'
  @_hash['overdraft'] = 'overdraft'
  @_hash['student'] = 'student'
  @_hash
end

.nullablesObject

An array for nullable fields



84
85
86
# File 'lib/the_plaid_api/models/loan_account.rb', line 84

def self.nullables
  []
end

.optionalsObject

An array for optional fields



79
80
81
# File 'lib/the_plaid_api/models/loan_account.rb', line 79

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



162
163
164
165
166
167
168
169
170
# File 'lib/the_plaid_api/models/loan_account.rb', line 162

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} auto: #{@auto.inspect}, business: #{@business.inspect}, commercial:"\
  " #{@commercial.inspect}, construction: #{@construction.inspect}, consumer:"\
  " #{@consumer.inspect}, home_equity: #{@home_equity.inspect}, line_of_credit:"\
  " #{@line_of_credit.inspect}, loan: #{@loan.inspect}, mortgage: #{@mortgage.inspect}, other:"\
  " #{@other.inspect}, overdraft: #{@overdraft.inspect}, student: #{@student.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} auto: #{@auto}, business: #{@business}, commercial: #{@commercial},"\
  " construction: #{@construction}, consumer: #{@consumer}, home_equity: #{@home_equity},"\
  " line_of_credit: #{@line_of_credit}, loan: #{@loan}, mortgage: #{@mortgage}, other:"\
  " #{@other}, overdraft: #{@overdraft}, student: #{@student}, additional_properties:"\
  " #{@additional_properties}>"
end