Class: ThePlaidApi::HistoricalBalance
- Defined in:
- lib/the_plaid_api/models/historical_balance.rb
Overview
An object representing a balance held by an account in the past
Instance Attribute Summary collapse
-
#current ⇒ Float
The total amount of funds in the account, calculated from the ‘current` balance in the `balance` object by subtracting inflows and adding back outflows according to the posted date of each transaction.
-
#date ⇒ Date
The date of the calculated historical balance, in an [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD).
-
#iso_currency_code ⇒ String
The ISO-4217 currency code of the balance.
-
#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(date:, current:, iso_currency_code:, unofficial_currency_code:, additional_properties: nil) ⇒ HistoricalBalance
constructor
A new instance of HistoricalBalance.
-
#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(date:, current:, iso_currency_code:, unofficial_currency_code:, additional_properties: nil) ⇒ HistoricalBalance
Returns a new instance of HistoricalBalance.
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/the_plaid_api/models/historical_balance.rb', line 63 def initialize(date:, current:, iso_currency_code:, unofficial_currency_code:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @date = date @current = current @iso_currency_code = iso_currency_code @unofficial_currency_code = unofficial_currency_code @additional_properties = additional_properties end |
Instance Attribute Details
#current ⇒ Float
The total amount of funds in the account, calculated from the ‘current` balance in the `balance` object by subtracting inflows and adding back outflows according to the posted date of each transaction. If the account has any pending transactions, historical balance amounts on or after the date of the earliest pending transaction may differ if retrieved in subsequent Asset Reports as a result of those pending transactions posting.
25 26 27 |
# File 'lib/the_plaid_api/models/historical_balance.rb', line 25 def current @current end |
#date ⇒ Date
The date of the calculated historical balance, in an [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD)
15 16 17 |
# File 'lib/the_plaid_api/models/historical_balance.rb', line 15 def date @date end |
#iso_currency_code ⇒ String
The ISO-4217 currency code of the balance. Always ‘null` if `unofficial_currency_code` is non-`null`.
30 31 32 |
# File 'lib/the_plaid_api/models/historical_balance.rb', line 30 def iso_currency_code @iso_currency_code end |
#unofficial_currency_code ⇒ String
The unofficial currency code associated with the balance. 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.
38 39 40 |
# File 'lib/the_plaid_api/models/historical_balance.rb', line 38 def unofficial_currency_code @unofficial_currency_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/the_plaid_api/models/historical_balance.rb', line 76 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. date = hash.key?('date') ? hash['date'] : nil current = hash.key?('current') ? hash['current'] : 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 # 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. HistoricalBalance.new(date: date, current: current, iso_currency_code: iso_currency_code, unofficial_currency_code: unofficial_currency_code, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 |
# File 'lib/the_plaid_api/models/historical_balance.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['date'] = 'date' @_hash['current'] = 'current' @_hash['iso_currency_code'] = 'iso_currency_code' @_hash['unofficial_currency_code'] = 'unofficial_currency_code' @_hash end |
.nullables ⇒ Object
An array for nullable fields
56 57 58 59 60 61 |
# File 'lib/the_plaid_api/models/historical_balance.rb', line 56 def self.nullables %w[ iso_currency_code unofficial_currency_code ] end |
.optionals ⇒ Object
An array for optional fields
51 52 53 |
# File 'lib/the_plaid_api/models/historical_balance.rb', line 51 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
111 112 113 114 115 116 |
# File 'lib/the_plaid_api/models/historical_balance.rb', line 111 def inspect class_name = self.class.name.split('::').last "<#{class_name} date: #{@date.inspect}, current: #{@current.inspect}, iso_currency_code:"\ " #{@iso_currency_code.inspect}, unofficial_currency_code:"\ " #{@unofficial_currency_code.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
103 104 105 106 107 108 |
# File 'lib/the_plaid_api/models/historical_balance.rb', line 103 def to_s class_name = self.class.name.split('::').last "<#{class_name} date: #{@date}, current: #{@current}, iso_currency_code:"\ " #{@iso_currency_code}, unofficial_currency_code: #{@unofficial_currency_code},"\ " additional_properties: #{@additional_properties}>" end |