Class: ThePlaidApi::LoanPaymentsIndicators
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::LoanPaymentsIndicators
- Defined in:
- lib/the_plaid_api/models/loan_payments_indicators.rb
Overview
Insights into loan payment transactions made by the user, tracking outgoing payments to loan providers.
Instance Attribute Summary collapse
-
#amount ⇒ Float
The total value of outflow transactions categorized as ‘LOAN_PAYMENTS`, across all the accounts in the report within the requested time window.
-
#category_details ⇒ Array[CategoryExpenses]
Detailed categories view of all the transactions that fall into the ‘LOAN_PAYMENTS` credit category within the given time window, across all the accounts in the report.
-
#days_since_last_occurrence ⇒ Integer
The number of days since the last transaction that falls into the ‘LOAN_PAYMENTS` credit category, across all the accounts in the report.
-
#iso_currency_code ⇒ String
The ISO-4217 currency code of the amount.
-
#monthly_average ⇒ MonthlyAverage
The monthly average amount calculated by dividing the total by the number of calendar months in the time period.
-
#monthly_summaries ⇒ Array[MonthlySummary]
The monthly summaries of the transactions that fall into the ‘LOAN_PAYMENTS` credit category within the given time window, across all the accounts in the report.
-
#percentage_of_income ⇒ Float
The percentage of the user’s monthly inflows that was spent on transactions that fall into the ‘LOAN_PAYMENTS` credit category within the given time window, across all the accounts in the report.
-
#top_providers ⇒ Array[String]
Up to 3 top service providers that the user had the most transactions for in the given time window, in descending order of total spend.
-
#transactions_count ⇒ Integer
The total number of transactions that fall into the ‘LOAN_PAYMENTS` credit category, across all the accounts in the report.
-
#unofficial_currency_code ⇒ String
The unofficial currency code associated with the amount.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(amount: SKIP, iso_currency_code: SKIP, unofficial_currency_code: SKIP, monthly_average: SKIP, category_details: SKIP, top_providers: SKIP, transactions_count: SKIP, monthly_summaries: SKIP, days_since_last_occurrence: SKIP, percentage_of_income: SKIP, additional_properties: nil) ⇒ LoanPaymentsIndicators
constructor
A new instance of LoanPaymentsIndicators.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(amount: SKIP, iso_currency_code: SKIP, unofficial_currency_code: SKIP, monthly_average: SKIP, category_details: SKIP, top_providers: SKIP, transactions_count: SKIP, monthly_summaries: SKIP, days_since_last_occurrence: SKIP, percentage_of_income: SKIP, additional_properties: nil) ⇒ LoanPaymentsIndicators
Returns a new instance of LoanPaymentsIndicators.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/the_plaid_api/models/loan_payments_indicators.rb', line 120 def initialize(amount: SKIP, iso_currency_code: SKIP, unofficial_currency_code: SKIP, monthly_average: SKIP, category_details: SKIP, top_providers: SKIP, transactions_count: SKIP, monthly_summaries: SKIP, days_since_last_occurrence: SKIP, percentage_of_income: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @amount = amount unless amount == SKIP @iso_currency_code = iso_currency_code unless iso_currency_code == SKIP @unofficial_currency_code = unofficial_currency_code unless unofficial_currency_code == SKIP @monthly_average = monthly_average unless monthly_average == SKIP @category_details = category_details unless category_details == SKIP @top_providers = top_providers unless top_providers == SKIP @transactions_count = transactions_count unless transactions_count == SKIP @monthly_summaries = monthly_summaries unless monthly_summaries == SKIP unless days_since_last_occurrence == SKIP @days_since_last_occurrence = days_since_last_occurrence end @percentage_of_income = percentage_of_income unless percentage_of_income == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ Float
The total value of outflow transactions categorized as ‘LOAN_PAYMENTS`, across all the accounts in the report within the requested time window.
16 17 18 |
# File 'lib/the_plaid_api/models/loan_payments_indicators.rb', line 16 def amount @amount end |
#category_details ⇒ Array[CategoryExpenses]
Detailed categories view of all the transactions that fall into the ‘LOAN_PAYMENTS` credit category within the given time window, across all the accounts in the report.
40 41 42 |
# File 'lib/the_plaid_api/models/loan_payments_indicators.rb', line 40 def category_details @category_details end |
#days_since_last_occurrence ⇒ Integer
The number of days since the last transaction that falls into the ‘LOAN_PAYMENTS` credit category, across all the accounts in the report.
63 64 65 |
# File 'lib/the_plaid_api/models/loan_payments_indicators.rb', line 63 def days_since_last_occurrence @days_since_last_occurrence end |
#iso_currency_code ⇒ String
The ISO-4217 currency code of the amount. Always ‘null` if `unofficial_currency_code` is non-`null`.
21 22 23 |
# File 'lib/the_plaid_api/models/loan_payments_indicators.rb', line 21 def iso_currency_code @iso_currency_code end |
#monthly_average ⇒ MonthlyAverage
The monthly average amount calculated by dividing the total by the number of calendar months in the time period.
34 35 36 |
# File 'lib/the_plaid_api/models/loan_payments_indicators.rb', line 34 def monthly_average @monthly_average end |
#monthly_summaries ⇒ Array[MonthlySummary]
The monthly summaries of the transactions that fall into the ‘LOAN_PAYMENTS` credit category within the given time window, across all the accounts in the report.
58 59 60 |
# File 'lib/the_plaid_api/models/loan_payments_indicators.rb', line 58 def monthly_summaries @monthly_summaries end |
#percentage_of_income ⇒ Float
The percentage of the user’s monthly inflows that was spent on transactions that fall into the ‘LOAN_PAYMENTS` credit category within the given time window, across all the accounts in the report. For example, a value of 100 indicates that 100% of the inflows were spent on transactions that fall into the `LOAN_PAYMENTS` credit category. If there’s no available income for the giving time period, this field value will be ‘-1`
73 74 75 |
# File 'lib/the_plaid_api/models/loan_payments_indicators.rb', line 73 def percentage_of_income @percentage_of_income end |
#top_providers ⇒ Array[String]
Up to 3 top service providers that the user had the most transactions for in the given time window, in descending order of total spend. If the user has not spent money on any provider in the given time window, this list will be empty.
47 48 49 |
# File 'lib/the_plaid_api/models/loan_payments_indicators.rb', line 47 def top_providers @top_providers end |
#transactions_count ⇒ Integer
The total number of transactions that fall into the ‘LOAN_PAYMENTS` credit category, across all the accounts in the report.
52 53 54 |
# File 'lib/the_plaid_api/models/loan_payments_indicators.rb', line 52 def transactions_count @transactions_count end |
#unofficial_currency_code ⇒ String
The unofficial currency code associated with the amount. Always ‘null` if `iso_currency_code` is non-`null`. See the [currency code schema](plaid.com/docs/api/accounts#currency-code-schema) for a full listing of supported `unofficial_currency_code`s.
29 30 31 |
# File 'lib/the_plaid_api/models/loan_payments_indicators.rb', line 29 def unofficial_currency_code @unofficial_currency_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
146 147 148 149 150 151 152 153 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 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/the_plaid_api/models/loan_payments_indicators.rb', line 146 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. amount = hash.key?('amount') ? hash['amount'] : SKIP iso_currency_code = hash.key?('iso_currency_code') ? hash['iso_currency_code'] : SKIP unofficial_currency_code = hash.key?('unofficial_currency_code') ? hash['unofficial_currency_code'] : SKIP monthly_average = MonthlyAverage.from_hash(hash['monthly_average']) if hash['monthly_average'] # Parameter is an array, so we need to iterate through it category_details = nil unless hash['category_details'].nil? category_details = [] hash['category_details'].each do |structure| category_details << (CategoryExpenses.from_hash(structure) if structure) end end category_details = SKIP unless hash.key?('category_details') top_providers = hash.key?('top_providers') ? hash['top_providers'] : SKIP transactions_count = hash.key?('transactions_count') ? hash['transactions_count'] : SKIP # Parameter is an array, so we need to iterate through it monthly_summaries = nil unless hash['monthly_summaries'].nil? monthly_summaries = [] hash['monthly_summaries'].each do |structure| monthly_summaries << (MonthlySummary.from_hash(structure) if structure) end end monthly_summaries = SKIP unless hash.key?('monthly_summaries') days_since_last_occurrence = hash.key?('days_since_last_occurrence') ? hash['days_since_last_occurrence'] : SKIP percentage_of_income = hash.key?('percentage_of_income') ? hash['percentage_of_income'] : 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. LoanPaymentsIndicators.new(amount: amount, iso_currency_code: iso_currency_code, unofficial_currency_code: unofficial_currency_code, monthly_average: monthly_average, category_details: category_details, top_providers: top_providers, transactions_count: transactions_count, monthly_summaries: monthly_summaries, days_since_last_occurrence: days_since_last_occurrence, percentage_of_income: percentage_of_income, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/the_plaid_api/models/loan_payments_indicators.rb', line 76 def self.names @_hash = {} if @_hash.nil? @_hash['amount'] = 'amount' @_hash['iso_currency_code'] = 'iso_currency_code' @_hash['unofficial_currency_code'] = 'unofficial_currency_code' @_hash['monthly_average'] = 'monthly_average' @_hash['category_details'] = 'category_details' @_hash['top_providers'] = 'top_providers' @_hash['transactions_count'] = 'transactions_count' @_hash['monthly_summaries'] = 'monthly_summaries' @_hash['days_since_last_occurrence'] = 'days_since_last_occurrence' @_hash['percentage_of_income'] = 'percentage_of_income' @_hash end |
.nullables ⇒ Object
An array for nullable fields
108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/the_plaid_api/models/loan_payments_indicators.rb', line 108 def self.nullables %w[ amount iso_currency_code unofficial_currency_code monthly_average transactions_count days_since_last_occurrence percentage_of_income ] end |
.optionals ⇒ Object
An array for optional fields
92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/the_plaid_api/models/loan_payments_indicators.rb', line 92 def self.optionals %w[ amount iso_currency_code unofficial_currency_code monthly_average category_details top_providers transactions_count monthly_summaries days_since_last_occurrence percentage_of_income ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/the_plaid_api/models/loan_payments_indicators.rb', line 219 def inspect class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount.inspect}, iso_currency_code:"\ " #{@iso_currency_code.inspect}, unofficial_currency_code:"\ " #{@unofficial_currency_code.inspect}, monthly_average: #{@monthly_average.inspect},"\ " category_details: #{@category_details.inspect}, top_providers: #{@top_providers.inspect},"\ " transactions_count: #{@transactions_count.inspect}, monthly_summaries:"\ " #{@monthly_summaries.inspect}, days_since_last_occurrence:"\ " #{@days_since_last_occurrence.inspect}, percentage_of_income:"\ " #{@percentage_of_income.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
207 208 209 210 211 212 213 214 215 216 |
# File 'lib/the_plaid_api/models/loan_payments_indicators.rb', line 207 def to_s class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount}, iso_currency_code: #{@iso_currency_code},"\ " unofficial_currency_code: #{@unofficial_currency_code}, monthly_average:"\ " #{@monthly_average}, category_details: #{@category_details}, top_providers:"\ " #{@top_providers}, transactions_count: #{@transactions_count}, monthly_summaries:"\ " #{@monthly_summaries}, days_since_last_occurrence: #{@days_since_last_occurrence},"\ " percentage_of_income: #{@percentage_of_income}, additional_properties:"\ " #{@additional_properties}>" end |