Class: ThePlaidApi::MortgageLiability

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

Overview

Contains details about a mortgage 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(account_id:, account_number:, current_late_fee:, escrow_balance:, has_pmi:, has_prepayment_penalty:, interest_rate:, last_payment_amount:, last_payment_date:, loan_type_description:, loan_term:, maturity_date:, next_monthly_payment:, next_payment_due_date:, origination_date:, origination_principal_amount:, past_due_amount:, property_address:, ytd_interest_paid:, ytd_principal_paid:, additional_properties: nil) ⇒ MortgageLiability

Returns a new instance of MortgageLiability.



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 154

def initialize(account_id:, account_number:, current_late_fee:,
               escrow_balance:, has_pmi:, has_prepayment_penalty:,
               interest_rate:, last_payment_amount:, last_payment_date:,
               loan_type_description:, loan_term:, maturity_date:,
               next_monthly_payment:, next_payment_due_date:,
               origination_date:, origination_principal_amount:,
               past_due_amount:, property_address:, ytd_interest_paid:,
               ytd_principal_paid:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_id = 
  @account_number = 
  @current_late_fee = current_late_fee
  @escrow_balance = escrow_balance
  @has_pmi = has_pmi
  @has_prepayment_penalty = has_prepayment_penalty
  @interest_rate = interest_rate
  @last_payment_amount = last_payment_amount
  @last_payment_date = last_payment_date
  @loan_type_description = loan_type_description
  @loan_term = loan_term
  @maturity_date = maturity_date
  @next_monthly_payment = next_monthly_payment
  @next_payment_due_date = next_payment_due_date
  @origination_date = origination_date
  @origination_principal_amount = origination_principal_amount
  @past_due_amount = past_due_amount
  @property_address = property_address
  @ytd_interest_paid = ytd_interest_paid
  @ytd_principal_paid = ytd_principal_paid
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

The ID of the account that this liability belongs to.

Returns:

  • (String)


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

def 
  @account_id
end

#account_numberString

The account number of the loan.

Returns:

  • (String)


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

def 
  @account_number
end

#current_late_feeFloat

The current outstanding amount charged for late payment.

Returns:

  • (Float)


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

def current_late_fee
  @current_late_fee
end

#escrow_balanceFloat

Total amount held in escrow to pay taxes and insurance on behalf of the borrower.

Returns:

  • (Float)


27
28
29
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 27

def escrow_balance
  @escrow_balance
end

#has_pmiTrueClass | FalseClass

Indicates whether the borrower has private mortgage insurance in effect.

Returns:

  • (TrueClass | FalseClass)


31
32
33
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 31

def has_pmi
  @has_pmi
end

#has_prepayment_penaltyTrueClass | FalseClass

Indicates whether the borrower will pay a penalty for early payoff of mortgage.

Returns:

  • (TrueClass | FalseClass)


36
37
38
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 36

def has_prepayment_penalty
  @has_prepayment_penalty
end

#interest_rateMortgageInterestRate

Object containing metadata about the interest rate for the mortgage.



40
41
42
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 40

def interest_rate
  @interest_rate
end

#last_payment_amountFloat

The amount of the last payment.

Returns:

  • (Float)


44
45
46
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 44

def last_payment_amount
  @last_payment_amount
end

#last_payment_dateDate

The date of the last payment. Dates are returned in an [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD).

Returns:

  • (Date)


49
50
51
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 49

def last_payment_date
  @last_payment_date
end

#loan_termString

Full duration of mortgage as at origination (e.g. ‘10 year`).

Returns:

  • (String)


59
60
61
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 59

def loan_term
  @loan_term
end

#loan_type_descriptionString

Description of the type of loan, for example ‘conventional`, `fixed`, or `variable`. This field is provided directly from the loan servicer and does not have an enumerated set of possible values.

Returns:

  • (String)


55
56
57
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 55

def loan_type_description
  @loan_type_description
end

#maturity_dateDate

Original date on which mortgage is due in full. Dates are returned in an [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD).

Returns:

  • (Date)


64
65
66
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 64

def maturity_date
  @maturity_date
end

#next_monthly_paymentFloat

The amount of the next payment.

Returns:

  • (Float)


68
69
70
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 68

def next_monthly_payment
  @next_monthly_payment
end

#next_payment_due_dateDate

The due date for the next payment. Dates are returned in an [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD).

Returns:

  • (Date)


73
74
75
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 73

def next_payment_due_date
  @next_payment_due_date
end

#origination_dateDate

The date on which the loan was initially lent. Dates are returned in an [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD).

Returns:

  • (Date)


78
79
80
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 78

def origination_date
  @origination_date
end

#origination_principal_amountFloat

The original principal balance of the mortgage.

Returns:

  • (Float)


82
83
84
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 82

def origination_principal_amount
  @origination_principal_amount
end

#past_due_amountFloat

Amount of loan (principal + interest) past due for payment.

Returns:

  • (Float)


86
87
88
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 86

def past_due_amount
  @past_due_amount
end

#property_addressMortgagePropertyAddress

Object containing fields describing property address.



90
91
92
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 90

def property_address
  @property_address
end

#ytd_interest_paidFloat

The year to date (YTD) interest paid.

Returns:

  • (Float)


94
95
96
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 94

def ytd_interest_paid
  @ytd_interest_paid
end

#ytd_principal_paidFloat

The YTD principal paid.

Returns:

  • (Float)


98
99
100
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 98

def ytd_principal_paid
  @ytd_principal_paid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 189

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('account_id') ? hash['account_id'] : nil
   =
    hash.key?('account_number') ? hash['account_number'] : nil
  current_late_fee =
    hash.key?('current_late_fee') ? hash['current_late_fee'] : nil
  escrow_balance =
    hash.key?('escrow_balance') ? hash['escrow_balance'] : nil
  has_pmi = hash.key?('has_pmi') ? hash['has_pmi'] : nil
  has_prepayment_penalty =
    hash.key?('has_prepayment_penalty') ? hash['has_prepayment_penalty'] : nil
  interest_rate = MortgageInterestRate.from_hash(hash['interest_rate']) if
    hash['interest_rate']
  last_payment_amount =
    hash.key?('last_payment_amount') ? hash['last_payment_amount'] : nil
  last_payment_date =
    hash.key?('last_payment_date') ? hash['last_payment_date'] : nil
  loan_type_description =
    hash.key?('loan_type_description') ? hash['loan_type_description'] : nil
  loan_term = hash.key?('loan_term') ? hash['loan_term'] : nil
  maturity_date = hash.key?('maturity_date') ? hash['maturity_date'] : nil
  next_monthly_payment =
    hash.key?('next_monthly_payment') ? hash['next_monthly_payment'] : nil
  next_payment_due_date =
    hash.key?('next_payment_due_date') ? hash['next_payment_due_date'] : nil
  origination_date =
    hash.key?('origination_date') ? hash['origination_date'] : nil
  origination_principal_amount =
    hash.key?('origination_principal_amount') ? hash['origination_principal_amount'] : nil
  past_due_amount =
    hash.key?('past_due_amount') ? hash['past_due_amount'] : nil
  property_address = MortgagePropertyAddress.from_hash(hash['property_address']) if
    hash['property_address']
  ytd_interest_paid =
    hash.key?('ytd_interest_paid') ? hash['ytd_interest_paid'] : nil
  ytd_principal_paid =
    hash.key?('ytd_principal_paid') ? hash['ytd_principal_paid'] : 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.
  MortgageLiability.new(account_id: ,
                        account_number: ,
                        current_late_fee: current_late_fee,
                        escrow_balance: escrow_balance,
                        has_pmi: has_pmi,
                        has_prepayment_penalty: has_prepayment_penalty,
                        interest_rate: interest_rate,
                        last_payment_amount: last_payment_amount,
                        last_payment_date: last_payment_date,
                        loan_type_description: loan_type_description,
                        loan_term: loan_term,
                        maturity_date: maturity_date,
                        next_monthly_payment: next_monthly_payment,
                        next_payment_due_date: next_payment_due_date,
                        origination_date: origination_date,
                        origination_principal_amount: origination_principal_amount,
                        past_due_amount: past_due_amount,
                        property_address: property_address,
                        ytd_interest_paid: ytd_interest_paid,
                        ytd_principal_paid: ytd_principal_paid,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 101

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_id'] = 'account_id'
  @_hash['account_number'] = 'account_number'
  @_hash['current_late_fee'] = 'current_late_fee'
  @_hash['escrow_balance'] = 'escrow_balance'
  @_hash['has_pmi'] = 'has_pmi'
  @_hash['has_prepayment_penalty'] = 'has_prepayment_penalty'
  @_hash['interest_rate'] = 'interest_rate'
  @_hash['last_payment_amount'] = 'last_payment_amount'
  @_hash['last_payment_date'] = 'last_payment_date'
  @_hash['loan_type_description'] = 'loan_type_description'
  @_hash['loan_term'] = 'loan_term'
  @_hash['maturity_date'] = 'maturity_date'
  @_hash['next_monthly_payment'] = 'next_monthly_payment'
  @_hash['next_payment_due_date'] = 'next_payment_due_date'
  @_hash['origination_date'] = 'origination_date'
  @_hash['origination_principal_amount'] = 'origination_principal_amount'
  @_hash['past_due_amount'] = 'past_due_amount'
  @_hash['property_address'] = 'property_address'
  @_hash['ytd_interest_paid'] = 'ytd_interest_paid'
  @_hash['ytd_principal_paid'] = 'ytd_principal_paid'
  @_hash
end

.nullablesObject

An array for nullable fields



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 132

def self.nullables
  %w[
    account_number
    current_late_fee
    escrow_balance
    has_pmi
    has_prepayment_penalty
    last_payment_amount
    last_payment_date
    loan_type_description
    loan_term
    maturity_date
    next_monthly_payment
    next_payment_due_date
    origination_date
    origination_principal_amount
    past_due_amount
    ytd_interest_paid
    ytd_principal_paid
  ]
end

.optionalsObject

An array for optional fields



127
128
129
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 127

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 278

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id.inspect}, account_number:"\
  " #{@account_number.inspect}, current_late_fee: #{@current_late_fee.inspect},"\
  " escrow_balance: #{@escrow_balance.inspect}, has_pmi: #{@has_pmi.inspect},"\
  " has_prepayment_penalty: #{@has_prepayment_penalty.inspect}, interest_rate:"\
  " #{@interest_rate.inspect}, last_payment_amount: #{@last_payment_amount.inspect},"\
  " last_payment_date: #{@last_payment_date.inspect}, loan_type_description:"\
  " #{@loan_type_description.inspect}, loan_term: #{@loan_term.inspect}, maturity_date:"\
  " #{@maturity_date.inspect}, next_monthly_payment: #{@next_monthly_payment.inspect},"\
  " next_payment_due_date: #{@next_payment_due_date.inspect}, origination_date:"\
  " #{@origination_date.inspect}, origination_principal_amount:"\
  " #{@origination_principal_amount.inspect}, past_due_amount: #{@past_due_amount.inspect},"\
  " property_address: #{@property_address.inspect}, ytd_interest_paid:"\
  " #{@ytd_interest_paid.inspect}, ytd_principal_paid: #{@ytd_principal_paid.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/the_plaid_api/models/mortgage_liability.rb', line 262

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id}, account_number: #{@account_number},"\
  " current_late_fee: #{@current_late_fee}, escrow_balance: #{@escrow_balance}, has_pmi:"\
  " #{@has_pmi}, has_prepayment_penalty: #{@has_prepayment_penalty}, interest_rate:"\
  " #{@interest_rate}, last_payment_amount: #{@last_payment_amount}, last_payment_date:"\
  " #{@last_payment_date}, loan_type_description: #{@loan_type_description}, loan_term:"\
  " #{@loan_term}, maturity_date: #{@maturity_date}, next_monthly_payment:"\
  " #{@next_monthly_payment}, next_payment_due_date: #{@next_payment_due_date},"\
  " origination_date: #{@origination_date}, origination_principal_amount:"\
  " #{@origination_principal_amount}, past_due_amount: #{@past_due_amount}, property_address:"\
  " #{@property_address}, ytd_interest_paid: #{@ytd_interest_paid}, ytd_principal_paid:"\
  " #{@ytd_principal_paid}, additional_properties: #{@additional_properties}>"
end