Class: ThePlaidApi::CreditCardLiability

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

Overview

An object representing a credit card 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:, aprs:, is_overdue:, last_payment_amount:, last_payment_date:, last_statement_issue_date:, last_statement_balance:, minimum_payment_amount:, next_payment_due_date:, additional_properties: nil) ⇒ CreditCardLiability

Returns a new instance of CreditCardLiability.



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

def initialize(account_id:, aprs:, is_overdue:, last_payment_amount:,
               last_payment_date:, last_statement_issue_date:,
               last_statement_balance:, minimum_payment_amount:,
               next_payment_due_date:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_id = 
  @aprs = aprs
  @is_overdue = is_overdue
  @last_payment_amount = last_payment_amount
  @last_payment_date = last_payment_date
  @last_statement_issue_date = last_statement_issue_date
  @last_statement_balance = last_statement_balance
  @minimum_payment_amount = minimum_payment_amount
  @next_payment_due_date = next_payment_due_date
  @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/credit_card_liability.rb', line 14

def 
  @account_id
end

#aprsArray[Apr]

The various interest rates that apply to the account. APR information is not provided by all card issuers; if APR data is not available, this array will be empty.

Returns:



20
21
22
# File 'lib/the_plaid_api/models/credit_card_liability.rb', line 20

def aprs
  @aprs
end

#is_overdueTrueClass | FalseClass

true if a payment is currently overdue. Availability for this field is limited.

Returns:

  • (TrueClass | FalseClass)


25
26
27
# File 'lib/the_plaid_api/models/credit_card_liability.rb', line 25

def is_overdue
  @is_overdue
end

#last_payment_amountFloat

The amount of the last payment.

Returns:

  • (Float)


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

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). Availability for this field is limited.

Returns:

  • (Date)


35
36
37
# File 'lib/the_plaid_api/models/credit_card_liability.rb', line 35

def last_payment_date
  @last_payment_date
end

#last_statement_balanceFloat

The total amount owed as of the last statement issued

Returns:

  • (Float)


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

def last_statement_balance
  @last_statement_balance
end

#last_statement_issue_dateDate

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

Returns:

  • (Date)


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

def last_statement_issue_date
  @last_statement_issue_date
end

#minimum_payment_amountFloat

The minimum payment due for the next billing cycle.

Returns:

  • (Float)


48
49
50
# File 'lib/the_plaid_api/models/credit_card_liability.rb', line 48

def minimum_payment_amount
  @minimum_payment_amount
end

#next_payment_due_dateDate

The due date for the next payment. The due date is ‘null` if a payment is not expected. Dates are returned in an [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD).

Returns:

  • (Date)


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

def next_payment_due_date
  @next_payment_due_date
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
150
151
152
153
154
155
156
157
# File 'lib/the_plaid_api/models/credit_card_liability.rb', line 110

def self.from_hash(hash)
  return nil unless hash

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

  aprs = nil unless hash.key?('aprs')
  is_overdue = hash.key?('is_overdue') ? hash['is_overdue'] : nil
  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
  last_statement_issue_date =
    hash.key?('last_statement_issue_date') ? hash['last_statement_issue_date'] : nil
  last_statement_balance =
    hash.key?('last_statement_balance') ? hash['last_statement_balance'] : nil
  minimum_payment_amount =
    hash.key?('minimum_payment_amount') ? hash['minimum_payment_amount'] : nil
  next_payment_due_date =
    hash.key?('next_payment_due_date') ? hash['next_payment_due_date'] : 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.
  CreditCardLiability.new(account_id: ,
                          aprs: aprs,
                          is_overdue: is_overdue,
                          last_payment_amount: last_payment_amount,
                          last_payment_date: last_payment_date,
                          last_statement_issue_date: last_statement_issue_date,
                          last_statement_balance: last_statement_balance,
                          minimum_payment_amount: minimum_payment_amount,
                          next_payment_due_date: next_payment_due_date,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/the_plaid_api/models/credit_card_liability.rb', line 57

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_id'] = 'account_id'
  @_hash['aprs'] = 'aprs'
  @_hash['is_overdue'] = 'is_overdue'
  @_hash['last_payment_amount'] = 'last_payment_amount'
  @_hash['last_payment_date'] = 'last_payment_date'
  @_hash['last_statement_issue_date'] = 'last_statement_issue_date'
  @_hash['last_statement_balance'] = 'last_statement_balance'
  @_hash['minimum_payment_amount'] = 'minimum_payment_amount'
  @_hash['next_payment_due_date'] = 'next_payment_due_date'
  @_hash
end

.nullablesObject

An array for nullable fields



77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/the_plaid_api/models/credit_card_liability.rb', line 77

def self.nullables
  %w[
    account_id
    is_overdue
    last_payment_amount
    last_payment_date
    last_statement_issue_date
    last_statement_balance
    minimum_payment_amount
    next_payment_due_date
  ]
end

.optionalsObject

An array for optional fields



72
73
74
# File 'lib/the_plaid_api/models/credit_card_liability.rb', line 72

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



171
172
173
174
175
176
177
178
179
180
# File 'lib/the_plaid_api/models/credit_card_liability.rb', line 171

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id.inspect}, aprs: #{@aprs.inspect}, is_overdue:"\
  " #{@is_overdue.inspect}, last_payment_amount: #{@last_payment_amount.inspect},"\
  " last_payment_date: #{@last_payment_date.inspect}, last_statement_issue_date:"\
  " #{@last_statement_issue_date.inspect}, last_statement_balance:"\
  " #{@last_statement_balance.inspect}, minimum_payment_amount:"\
  " #{@minimum_payment_amount.inspect}, next_payment_due_date:"\
  " #{@next_payment_due_date.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



160
161
162
163
164
165
166
167
168
# File 'lib/the_plaid_api/models/credit_card_liability.rb', line 160

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id}, aprs: #{@aprs}, is_overdue: #{@is_overdue},"\
  " last_payment_amount: #{@last_payment_amount}, last_payment_date: #{@last_payment_date},"\
  " last_statement_issue_date: #{@last_statement_issue_date}, last_statement_balance:"\
  " #{@last_statement_balance}, minimum_payment_amount: #{@minimum_payment_amount},"\
  " next_payment_due_date: #{@next_payment_due_date}, additional_properties:"\
  " #{@additional_properties}>"
end