Class: ThePlaidApi::AssetReportAccountBalance
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::AssetReportAccountBalance
- Defined in:
- lib/the_plaid_api/models/asset_report_account_balance.rb
Overview
A set of fields describing the balance for an account. Balance information may be cached unless the balance object was returned by ‘/accounts/balance/get`.
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 oldest acceptable balance when making a request to `/accounts/balance/get`.
-
#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:, margin_loan_amount:, iso_currency_code:, unofficial_currency_code:, last_updated_datetime: SKIP, additional_properties: nil) ⇒ AssetReportAccountBalance
constructor
A new instance of AssetReportAccountBalance.
-
#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:, margin_loan_amount:, iso_currency_code:, unofficial_currency_code:, last_updated_datetime: SKIP, additional_properties: nil) ⇒ AssetReportAccountBalance
Returns a new instance of AssetReportAccountBalance.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/the_plaid_api/models/asset_report_account_balance.rb', line 138 def initialize(available:, current:, limit:, margin_loan_amount:, iso_currency_code:, unofficial_currency_code:, 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 @margin_loan_amount = margin_loan_amount @iso_currency_code = iso_currency_code @unofficial_currency_code = unofficial_currency_code @last_updated_datetime = last_updated_datetime unless last_updated_datetime == SKIP @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`. If `current` is `null` this field is guaranteed not to be `null`.
34 35 36 |
# File 'lib/the_plaid_api/models/asset_report_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. 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`; 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`. When returned by `/accounts/balance/get`, this field may be `null`. When this happens, `available` is guaranteed not to be `null`.
54 55 56 |
# File 'lib/the_plaid_api/models/asset_report_account_balance.rb', line 54 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.
75 76 77 |
# File 'lib/the_plaid_api/models/asset_report_account_balance.rb', line 75 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 oldest acceptable balance when making a request to `/accounts/balance/get`. This field is only used and expected when the institution is `ins_128026` (Capital One) and the Item contains one or more accounts with a non-depository account type, in which case a value must be provided or an `INVALID_REQUEST` error with the code of `INVALID_FIELD` will be returned. For Capital One depository accounts as well as all other account types on all other institutions, this field is ignored. See [account type schema](plaid.com/docs/api/accounts/#account-type-schema) for a full list of account types. If the balance that is pulled is older than the given timestamp for Items with this field required, an `INVALID_REQUEST` error with the code of `LAST_UPDATED_DATETIME_OUT_OF_RANGE` will be returned with the most recent timestamp for the requested account contained in the response.
103 104 105 |
# File 'lib/the_plaid_api/models/asset_report_account_balance.rb', line 103 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.
62 63 64 |
# File 'lib/the_plaid_api/models/asset_report_account_balance.rb', line 62 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.
70 71 72 |
# File 'lib/the_plaid_api/models/asset_report_account_balance.rb', line 70 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.
85 86 87 |
# File 'lib/the_plaid_api/models/asset_report_account_balance.rb', line 85 def unofficial_currency_code @unofficial_currency_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/the_plaid_api/models/asset_report_account_balance.rb', line 155 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 margin_loan_amount = hash.key?('margin_loan_amount') ? hash['margin_loan_amount'] : 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 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. AssetReportAccountBalance.new(available: available, current: current, limit: limit, margin_loan_amount: margin_loan_amount, iso_currency_code: iso_currency_code, unofficial_currency_code: unofficial_currency_code, last_updated_datetime: last_updated_datetime, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/the_plaid_api/models/asset_report_account_balance.rb', line 106 def self.names @_hash = {} if @_hash.nil? @_hash['available'] = 'available' @_hash['current'] = 'current' @_hash['limit'] = 'limit' @_hash['margin_loan_amount'] = 'margin_loan_amount' @_hash['iso_currency_code'] = 'iso_currency_code' @_hash['unofficial_currency_code'] = 'unofficial_currency_code' @_hash['last_updated_datetime'] = 'last_updated_datetime' @_hash end |
.nullables ⇒ Object
An array for nullable fields
126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/the_plaid_api/models/asset_report_account_balance.rb', line 126 def self.nullables %w[ available current limit margin_loan_amount iso_currency_code unofficial_currency_code last_updated_datetime ] end |
.optionals ⇒ Object
An array for optional fields
119 120 121 122 123 |
# File 'lib/the_plaid_api/models/asset_report_account_balance.rb', line 119 def self.optionals %w[ last_updated_datetime ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
206 207 208 209 210 211 212 213 |
# File 'lib/the_plaid_api/models/asset_report_account_balance.rb', line 206 def inspect class_name = self.class.name.split('::').last "<#{class_name} available: #{@available.inspect}, current: #{@current.inspect}, limit:"\ " #{@limit.inspect}, margin_loan_amount: #{@margin_loan_amount.inspect}, iso_currency_code:"\ " #{@iso_currency_code.inspect}, unofficial_currency_code:"\ " #{@unofficial_currency_code.inspect}, last_updated_datetime:"\ " #{@last_updated_datetime.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_last_updated_datetime ⇒ Object
192 193 194 |
# File 'lib/the_plaid_api/models/asset_report_account_balance.rb', line 192 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.
197 198 199 200 201 202 203 |
# File 'lib/the_plaid_api/models/asset_report_account_balance.rb', line 197 def to_s class_name = self.class.name.split('::').last "<#{class_name} available: #{@available}, current: #{@current}, limit: #{@limit},"\ " margin_loan_amount: #{@margin_loan_amount}, iso_currency_code: #{@iso_currency_code},"\ " unofficial_currency_code: #{@unofficial_currency_code}, last_updated_datetime:"\ " #{@last_updated_datetime}, additional_properties: #{@additional_properties}>" end |