Class: ThePlaidApi::CraLoanPaymentHistory

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

Overview

Contains the payment information for a loan payment period.

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(period:, due_date:, days_past_due:, amount_past_due: SKIP, balance_remaining: SKIP, additional_properties: nil) ⇒ CraLoanPaymentHistory

Returns a new instance of CraLoanPaymentHistory.



64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/the_plaid_api/models/cra_loan_payment_history.rb', line 64

def initialize(period:, due_date:, days_past_due:, amount_past_due: SKIP,
               balance_remaining: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @period = period
  @due_date = due_date
  @days_past_due = days_past_due
  @amount_past_due = amount_past_due unless amount_past_due == SKIP
  @balance_remaining = balance_remaining unless balance_remaining == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amount_past_dueFloat

The amount past due or the charge-off amount of the loan at the end of the payment period.

Returns:

  • (Float)


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

def amount_past_due
  @amount_past_due
end

#balance_remainingFloat

The balance remaining on the loan at the end of the payment period.

Returns:

  • (Float)


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

def balance_remaining
  @balance_remaining
end

#days_past_dueInteger

The number of days the loan was delinquent at the end of the pay period. If specified, should be greater of equal to 0.

Returns:

  • (Integer)


29
30
31
# File 'lib/the_plaid_api/models/cra_loan_payment_history.rb', line 29

def days_past_due
  @days_past_due
end

#due_dateDate

The payment due date or end date of the payment period. The date should be in ISO 8601 format (YYYY-MM-DD).

Returns:

  • (Date)


24
25
26
# File 'lib/the_plaid_api/models/cra_loan_payment_history.rb', line 24

def due_date
  @due_date
end

#periodInteger

The index to identify the loan’s payment period, starting from 1. For example:

1 means the period between the loan's opening date and the 1st payment

due date.

2 means the period between the loan's 1st payment due date and 2nd

payment due date.

Returns:

  • (Integer)


19
20
21
# File 'lib/the_plaid_api/models/cra_loan_payment_history.rb', line 19

def period
  @period
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/the_plaid_api/models/cra_loan_payment_history.rb', line 78

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  period = hash.key?('period') ? hash['period'] : nil
  due_date = hash.key?('due_date') ? hash['due_date'] : nil
  days_past_due = hash.key?('days_past_due') ? hash['days_past_due'] : nil
  amount_past_due =
    hash.key?('amount_past_due') ? hash['amount_past_due'] : SKIP
  balance_remaining =
    hash.key?('balance_remaining') ? hash['balance_remaining'] : 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.
  CraLoanPaymentHistory.new(period: period,
                            due_date: due_date,
                            days_past_due: days_past_due,
                            amount_past_due: amount_past_due,
                            balance_remaining: balance_remaining,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
# File 'lib/the_plaid_api/models/cra_loan_payment_history.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['period'] = 'period'
  @_hash['due_date'] = 'due_date'
  @_hash['days_past_due'] = 'days_past_due'
  @_hash['amount_past_due'] = 'amount_past_due'
  @_hash['balance_remaining'] = 'balance_remaining'
  @_hash
end

.nullablesObject

An array for nullable fields



60
61
62
# File 'lib/the_plaid_api/models/cra_loan_payment_history.rb', line 60

def self.nullables
  []
end

.optionalsObject

An array for optional fields



52
53
54
55
56
57
# File 'lib/the_plaid_api/models/cra_loan_payment_history.rb', line 52

def self.optionals
  %w[
    amount_past_due
    balance_remaining
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



115
116
117
118
119
120
121
# File 'lib/the_plaid_api/models/cra_loan_payment_history.rb', line 115

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} period: #{@period.inspect}, due_date: #{@due_date.inspect}, days_past_due:"\
  " #{@days_past_due.inspect}, amount_past_due: #{@amount_past_due.inspect},"\
  " balance_remaining: #{@balance_remaining.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



107
108
109
110
111
112
# File 'lib/the_plaid_api/models/cra_loan_payment_history.rb', line 107

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} period: #{@period}, due_date: #{@due_date}, days_past_due:"\
  " #{@days_past_due}, amount_past_due: #{@amount_past_due}, balance_remaining:"\
  " #{@balance_remaining}, additional_properties: #{@additional_properties}>"
end