Class: ThePlaidApi::CraVoaReportAccountHistoricalBalance

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/cra_voa_report_account_historical_balance.rb

Overview

An object representing a balance held by an account in the past.

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(current:, date:, iso_currency_code:, unofficial_currency_code:, additional_properties: nil) ⇒ CraVoaReportAccountHistoricalBalance

Returns a new instance of CraVoaReportAccountHistoricalBalance.



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/the_plaid_api/models/cra_voa_report_account_historical_balance.rb', line 59

def initialize(current:, date:, iso_currency_code:,
               unofficial_currency_code:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @current = current
  @date = date
  @iso_currency_code = iso_currency_code
  @unofficial_currency_code = unofficial_currency_code
  @additional_properties = additional_properties
end

Instance Attribute Details

#currentFloat

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.

Returns:

  • (Float)


16
17
18
# File 'lib/the_plaid_api/models/cra_voa_report_account_historical_balance.rb', line 16

def current
  @current
end

#dateDate

The date of the calculated historical balance, in an [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD).

Returns:

  • (Date)


21
22
23
# File 'lib/the_plaid_api/models/cra_voa_report_account_historical_balance.rb', line 21

def date
  @date
end

#iso_currency_codeString

The ISO-4217 currency code of the balance. Always ‘null` if `unofficial_currency_code` is non-`null`.

Returns:

  • (String)


26
27
28
# File 'lib/the_plaid_api/models/cra_voa_report_account_historical_balance.rb', line 26

def iso_currency_code
  @iso_currency_code
end

#unofficial_currency_codeString

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.

Returns:

  • (String)


34
35
36
# File 'lib/the_plaid_api/models/cra_voa_report_account_historical_balance.rb', line 34

def unofficial_currency_code
  @unofficial_currency_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/the_plaid_api/models/cra_voa_report_account_historical_balance.rb', line 72

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  current = hash.key?('current') ? hash['current'] : nil
  date = hash.key?('date') ? hash['date'] : 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.
  CraVoaReportAccountHistoricalBalance.new(current: current,
                                           date: date,
                                           iso_currency_code: iso_currency_code,
                                           unofficial_currency_code: unofficial_currency_code,
                                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
# File 'lib/the_plaid_api/models/cra_voa_report_account_historical_balance.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['current'] = 'current'
  @_hash['date'] = 'date'
  @_hash['iso_currency_code'] = 'iso_currency_code'
  @_hash['unofficial_currency_code'] = 'unofficial_currency_code'
  @_hash
end

.nullablesObject

An array for nullable fields



52
53
54
55
56
57
# File 'lib/the_plaid_api/models/cra_voa_report_account_historical_balance.rb', line 52

def self.nullables
  %w[
    iso_currency_code
    unofficial_currency_code
  ]
end

.optionalsObject

An array for optional fields



47
48
49
# File 'lib/the_plaid_api/models/cra_voa_report_account_historical_balance.rb', line 47

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



107
108
109
110
111
112
# File 'lib/the_plaid_api/models/cra_voa_report_account_historical_balance.rb', line 107

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} current: #{@current.inspect}, date: #{@date.inspect}, iso_currency_code:"\
  " #{@iso_currency_code.inspect}, unofficial_currency_code:"\
  " #{@unofficial_currency_code.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



99
100
101
102
103
104
# File 'lib/the_plaid_api/models/cra_voa_report_account_historical_balance.rb', line 99

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} current: #{@current}, date: #{@date}, iso_currency_code:"\
  " #{@iso_currency_code}, unofficial_currency_code: #{@unofficial_currency_code},"\
  " additional_properties: #{@additional_properties}>"
end