Class: Plaid::CreditCardLiability

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/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:, minimum_payment_amount:, next_payment_due_date:, additional_properties: nil) ⇒ CreditCardLiability

Returns a new instance of CreditCardLiability.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/plaid/models/credit_card_liability.rb', line 78

def initialize(account_id:, aprs:, is_overdue:, last_payment_amount:,
               last_payment_date:, last_statement_issue_date:,
               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
  @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/plaid/models/credit_card_liability.rb', line 14

def 
  @account_id
end

#aprsArray[Apr]

The various interest rates that apply to the account.

Returns:



18
19
20
# File 'lib/plaid/models/credit_card_liability.rb', line 18

def aprs
  @aprs
end

#is_overdueTrueClass | FalseClass

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

Returns:

  • (TrueClass | FalseClass)


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

def is_overdue
  @is_overdue
end

#last_payment_amountFloat

The amount of the last payment.

Returns:

  • (Float)


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

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)


33
34
35
# File 'lib/plaid/models/credit_card_liability.rb', line 33

def last_payment_date
  @last_payment_date
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)


38
39
40
# File 'lib/plaid/models/credit_card_liability.rb', line 38

def last_statement_issue_date
  @last_statement_issue_date
end

#minimum_payment_amountFloat

The minimum payment due for the next billing cycle.

Returns:

  • (Float)


42
43
44
# File 'lib/plaid/models/credit_card_liability.rb', line 42

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)


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

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.



97
98
99
100
101
102
103
104
105
106
107
108
109
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
# File 'lib/plaid/models/credit_card_liability.rb', line 97

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
  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,
                          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.



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/plaid/models/credit_card_liability.rb', line 51

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['minimum_payment_amount'] = 'minimum_payment_amount'
  @_hash['next_payment_due_date'] = 'next_payment_due_date'
  @_hash
end

.nullablesObject

An array for nullable fields



70
71
72
73
74
75
76
# File 'lib/plaid/models/credit_card_liability.rb', line 70

def self.nullables
  %w[
    account_id
    is_overdue
    next_payment_due_date
  ]
end

.optionalsObject

An array for optional fields



65
66
67
# File 'lib/plaid/models/credit_card_liability.rb', line 65

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



154
155
156
157
158
159
160
161
162
# File 'lib/plaid/models/credit_card_liability.rb', line 154

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}, 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.



144
145
146
147
148
149
150
151
# File 'lib/plaid/models/credit_card_liability.rb', line 144

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}, minimum_payment_amount:"\
  " #{@minimum_payment_amount}, next_payment_due_date: #{@next_payment_due_date},"\
  " additional_properties: #{@additional_properties}>"
end