Class: ThePlaidApi::InvestmentAccountBalance
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::InvestmentAccountBalance
- Defined in:
- lib/the_plaid_api/models/investment_account_balance.rb
Overview
A set of fields describing the balance for an account, including margin loan information for investment accounts.
Instance Attribute Summary collapse
-
#available ⇒ Float
The amount of funds available to be withdrawn from the account, as determined by the financial institution.
-
#current ⇒ Float
The total amount of funds in or owed by the account.
-
#iso_currency_code ⇒ String
The ISO-4217 currency code of the balance.
-
#last_updated_datetime ⇒ DateTime
Timestamp in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format (‘YYYY-MM-DDTHH:mm:ssZ`) indicating the last time the balance was updated.
-
#limit ⇒ Float
For ‘credit`-type accounts, this represents the credit limit.
-
#margin_loan_amount ⇒ Float
The total amount of borrowed funds in the account, as determined by the financial institution.
-
#unofficial_currency_code ⇒ String
The unofficial currency code associated with the balance.
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(available:, current:, limit:, iso_currency_code:, unofficial_currency_code:, margin_loan_amount:, last_updated_datetime: SKIP, additional_properties: nil) ⇒ InvestmentAccountBalance
constructor
A new instance of InvestmentAccountBalance.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_last_updated_datetime ⇒ Object
-
#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(available:, current:, limit:, iso_currency_code:, unofficial_currency_code:, margin_loan_amount:, last_updated_datetime: SKIP, additional_properties: nil) ⇒ InvestmentAccountBalance
Returns a new instance of InvestmentAccountBalance.
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/the_plaid_api/models/investment_account_balance.rb', line 131 def initialize(available:, current:, limit:, iso_currency_code:, unofficial_currency_code:, margin_loan_amount:, last_updated_datetime: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @available = available @current = current @limit = limit @iso_currency_code = iso_currency_code @unofficial_currency_code = unofficial_currency_code @last_updated_datetime = last_updated_datetime unless last_updated_datetime == SKIP @margin_loan_amount = margin_loan_amount @additional_properties = additional_properties end |
Instance Attribute Details
#available ⇒ Float
The amount of funds available to be withdrawn from the account, as determined by the financial institution. For ‘credit`-type accounts, the `available` balance typically equals the `limit` less the `current` balance, less any pending outflows plus any pending inflows. For `depository`-type accounts, the `available` balance typically equals the `current` balance less any pending outflows plus any pending inflows. For `depository`-type accounts, the `available` balance does not include the overdraft limit. For `investment`-type accounts (or `brokerage`-type accounts for API versions 2018-05-22 and earlier), the `available` balance is the total cash available to withdraw as presented by the institution. Note that not all institutions calculate the `available` balance. In the event that `available` balance is unavailable, Plaid will return an `available` balance value of `null`. Available balance may be cached and is not guaranteed to be up-to-date in realtime unless the value was returned by `/accounts/balance/get`, or by `/signal/evaluate` with a Balance-only ruleset. If `current` is `null` this field is guaranteed not to be `null`.
34 35 36 |
# File 'lib/the_plaid_api/models/investment_account_balance.rb', line 34 def available @available end |
#current ⇒ Float
The total amount of funds in or owed by the account. For ‘credit`-type accounts, a positive balance indicates the amount owed; a negative amount indicates the lender owing the account holder. For `loan`-type accounts, the current balance is the principal remaining on the loan, except in the case of student loan accounts at Sallie Mae (`ins_116944`). For Sallie Mae student loans, the account’s balance includes both principal and any outstanding interest. Similar to ‘credit`-type accounts, a positive balance is typically expected, while a negative amount indicates the lender owing the account holder. For `investment`-type accounts (or `brokerage`-type accounts for API versions 2018-05-22 and earlier), the current balance is the total value of assets as presented by the institution. Note that balance information may be cached unless the value was returned by `/accounts/balance/get` or by `/signal/evaluate` with a Balance-only ruleset; if the Item is enabled for Transactions, the balance will be at least as recent as the most recent Transaction update. If you require realtime balance information, use the `available` balance as provided by `/accounts/balance/get` or `/signal/evaluate` called with a Balance-only `ruleset_key`. When returned by `/accounts/balance/get`, this field may be `null`. When this happens, `available` is guaranteed not to be `null`.
58 59 60 |
# File 'lib/the_plaid_api/models/investment_account_balance.rb', line 58 def current @current end |
#iso_currency_code ⇒ String
The ISO-4217 currency code of the balance. Always null if ‘unofficial_currency_code` is non-null.
71 72 73 |
# File 'lib/the_plaid_api/models/investment_account_balance.rb', line 71 def iso_currency_code @iso_currency_code end |
#last_updated_datetime ⇒ DateTime
Timestamp in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format (‘YYYY-MM-DDTHH:mm:ssZ`) indicating the last time the balance was updated. This field is returned only when the institution is `ins_128026` (Capital One).
88 89 90 |
# File 'lib/the_plaid_api/models/investment_account_balance.rb', line 88 def last_updated_datetime @last_updated_datetime end |
#limit ⇒ Float
For ‘credit`-type accounts, this represents the credit limit. For `depository`-type accounts, this represents the pre-arranged overdraft limit, which is common for current (checking) accounts in Europe. In North America, this field is typically only available for `credit`-type accounts.
66 67 68 |
# File 'lib/the_plaid_api/models/investment_account_balance.rb', line 66 def limit @limit end |
#margin_loan_amount ⇒ Float
The total amount of borrowed funds in the account, as determined by the financial institution. For investment-type accounts, the margin balance is the total value of borrowed assets in the account, as presented by the institution. This is commonly referred to as margin or a loan.
96 97 98 |
# File 'lib/the_plaid_api/models/investment_account_balance.rb', line 96 def margin_loan_amount @margin_loan_amount end |
#unofficial_currency_code ⇒ String
The unofficial currency code associated with the balance. Always null if ‘iso_currency_code` is non-null. Unofficial currency codes are used for currencies that do not have official ISO currency codes, such as cryptocurrencies and the currencies of certain countries. See the [currency code schema](plaid.com/docs/api/accounts#currency-code-schema) for a full listing of supported `unofficial_currency_code`s.
81 82 83 |
# File 'lib/the_plaid_api/models/investment_account_balance.rb', line 81 def unofficial_currency_code @unofficial_currency_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/the_plaid_api/models/investment_account_balance.rb', line 148 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. available = hash.key?('available') ? hash['available'] : nil current = hash.key?('current') ? hash['current'] : nil limit = hash.key?('limit') ? hash['limit'] : nil iso_currency_code = hash.key?('iso_currency_code') ? hash['iso_currency_code'] : nil unofficial_currency_code = hash.key?('unofficial_currency_code') ? hash['unofficial_currency_code'] : nil margin_loan_amount = hash.key?('margin_loan_amount') ? hash['margin_loan_amount'] : nil last_updated_datetime = if hash.key?('last_updated_datetime') (DateTimeHelper.from_rfc3339(hash['last_updated_datetime']) if hash['last_updated_datetime']) else SKIP end # 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. InvestmentAccountBalance.new(available: available, current: current, limit: limit, iso_currency_code: iso_currency_code, unofficial_currency_code: unofficial_currency_code, margin_loan_amount: margin_loan_amount, last_updated_datetime: last_updated_datetime, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/the_plaid_api/models/investment_account_balance.rb', line 99 def self.names @_hash = {} if @_hash.nil? @_hash['available'] = 'available' @_hash['current'] = 'current' @_hash['limit'] = 'limit' @_hash['iso_currency_code'] = 'iso_currency_code' @_hash['unofficial_currency_code'] = 'unofficial_currency_code' @_hash['last_updated_datetime'] = 'last_updated_datetime' @_hash['margin_loan_amount'] = 'margin_loan_amount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/the_plaid_api/models/investment_account_balance.rb', line 119 def self.nullables %w[ available current limit iso_currency_code unofficial_currency_code last_updated_datetime margin_loan_amount ] end |
.optionals ⇒ Object
An array for optional fields
112 113 114 115 116 |
# File 'lib/the_plaid_api/models/investment_account_balance.rb', line 112 def self.optionals %w[ last_updated_datetime ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
200 201 202 203 204 205 206 207 |
# File 'lib/the_plaid_api/models/investment_account_balance.rb', line 200 def inspect class_name = self.class.name.split('::').last "<#{class_name} available: #{@available.inspect}, current: #{@current.inspect}, limit:"\ " #{@limit.inspect}, iso_currency_code: #{@iso_currency_code.inspect},"\ " unofficial_currency_code: #{@unofficial_currency_code.inspect}, last_updated_datetime:"\ " #{@last_updated_datetime.inspect}, margin_loan_amount: #{@margin_loan_amount.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_last_updated_datetime ⇒ Object
185 186 187 |
# File 'lib/the_plaid_api/models/investment_account_balance.rb', line 185 def to_custom_last_updated_datetime DateTimeHelper.to_rfc3339(last_updated_datetime) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
190 191 192 193 194 195 196 197 |
# File 'lib/the_plaid_api/models/investment_account_balance.rb', line 190 def to_s class_name = self.class.name.split('::').last "<#{class_name} available: #{@available}, current: #{@current}, limit: #{@limit},"\ " iso_currency_code: #{@iso_currency_code}, unofficial_currency_code:"\ " #{@unofficial_currency_code}, last_updated_datetime: #{@last_updated_datetime},"\ " margin_loan_amount: #{@margin_loan_amount}, additional_properties:"\ " #{@additional_properties}>" end |