Class: Plaid::LoanAccount

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

Overview

A loan type account. Supported products for ‘loan` accounts are: Balance, Liabilities, and Transactions.

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:, loan:, mortgage:, overdraft:, line_of_credit:, student:, other:, additional_properties: nil) ⇒ LoanAccount

Returns a new instance of LoanAccount.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/plaid/models/loan_account.rb', line 89

def initialize(auto:, business:, commercial:, construction:, consumer:,
               home_equity:, loan:, mortgage:, overdraft:, line_of_credit:,
               student:, other:, 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
  @loan = loan
  @mortgage = mortgage
  @overdraft = overdraft
  @line_of_credit = line_of_credit
  @student = student
  @other = other
  @additional_properties = additional_properties
end

Instance Attribute Details

#autoString

Auto loan

Returns:

  • (String)


15
16
17
# File 'lib/plaid/models/loan_account.rb', line 15

def auto
  @auto
end

#businessString

Business loan

Returns:

  • (String)


19
20
21
# File 'lib/plaid/models/loan_account.rb', line 19

def business
  @business
end

#commercialString

Commercial loan

Returns:

  • (String)


23
24
25
# File 'lib/plaid/models/loan_account.rb', line 23

def commercial
  @commercial
end

#constructionString

Construction loan

Returns:

  • (String)


27
28
29
# File 'lib/plaid/models/loan_account.rb', line 27

def construction
  @construction
end

#consumerString

Consumer loan

Returns:

  • (String)


31
32
33
# File 'lib/plaid/models/loan_account.rb', line 31

def consumer
  @consumer
end

#home_equityString

Home Equity Line of Credit (HELOC)

Returns:

  • (String)


35
36
37
# File 'lib/plaid/models/loan_account.rb', line 35

def home_equity
  @home_equity
end

#line_of_creditString

Pre-approved line of credit

Returns:

  • (String)


51
52
53
# File 'lib/plaid/models/loan_account.rb', line 51

def line_of_credit
  @line_of_credit
end

#loanString

General loan

Returns:

  • (String)


39
40
41
# File 'lib/plaid/models/loan_account.rb', line 39

def loan
  @loan
end

#mortgageString

Mortgage loan

Returns:

  • (String)


43
44
45
# File 'lib/plaid/models/loan_account.rb', line 43

def mortgage
  @mortgage
end

#otherString

Other loan type or unknown loan type

Returns:

  • (String)


59
60
61
# File 'lib/plaid/models/loan_account.rb', line 59

def other
  @other
end

#overdraftString

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

Returns:

  • (String)


47
48
49
# File 'lib/plaid/models/loan_account.rb', line 47

def overdraft
  @overdraft
end

#studentString

Student loan

Returns:

  • (String)


55
56
57
# File 'lib/plaid/models/loan_account.rb', line 55

def student
  @student
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
150
# File 'lib/plaid/models/loan_account.rb', line 111

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
  loan = hash.key?('loan') ? hash['loan'] : nil
  mortgage = hash.key?('mortgage') ? hash['mortgage'] : nil
  overdraft = hash.key?('overdraft') ? hash['overdraft'] : nil
  line_of_credit =
    hash.key?('line of credit') ? hash['line of credit'] : nil
  student = hash.key?('student') ? hash['student'] : nil
  other = hash.key?('other') ? hash['other'] : 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,
                  loan: loan,
                  mortgage: mortgage,
                  overdraft: overdraft,
                  line_of_credit: line_of_credit,
                  student: student,
                  other: other,
                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

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['loan'] = 'loan'
  @_hash['mortgage'] = 'mortgage'
  @_hash['overdraft'] = 'overdraft'
  @_hash['line_of_credit'] = 'line of credit'
  @_hash['student'] = 'student'
  @_hash['other'] = 'other'
  @_hash
end

.nullablesObject

An array for nullable fields



85
86
87
# File 'lib/plaid/models/loan_account.rb', line 85

def self.nullables
  []
end

.optionalsObject

An array for optional fields



80
81
82
# File 'lib/plaid/models/loan_account.rb', line 80

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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}, loan: #{@loan.inspect},"\
  " mortgage: #{@mortgage.inspect}, overdraft: #{@overdraft.inspect}, line_of_credit:"\
  " #{@line_of_credit.inspect}, student: #{@student.inspect}, other: #{@other.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

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},"\
  " loan: #{@loan}, mortgage: #{@mortgage}, overdraft: #{@overdraft}, line_of_credit:"\
  " #{@line_of_credit}, student: #{@student}, other: #{@other}, additional_properties:"\
  " #{@additional_properties}>"
end