Class: ThePlaidApi::CraVoaReportAttributes

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

Overview

Attributes for the VOA report.

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(total_inflow_amount:, total_outflow_amount:, additional_properties: nil) ⇒ CraVoaReportAttributes

Returns a new instance of CraVoaReportAttributes.



45
46
47
48
49
50
51
52
53
# File 'lib/the_plaid_api/models/cra_voa_report_attributes.rb', line 45

def initialize(total_inflow_amount:, total_outflow_amount:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @total_inflow_amount = total_inflow_amount
  @total_outflow_amount = total_outflow_amount
  @additional_properties = additional_properties
end

Instance Attribute Details

#total_inflow_amountTotalReportInflowAmount

Total amount of debit transactions into the report’s accounts in the time period of the report. This field only takes into account USD transactions from the accounts.



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

def total_inflow_amount
  @total_inflow_amount
end

#total_outflow_amountTotalReportOutflowAmount

Total amount of credit transactions into the report’s accounts in the time period of the report. This field only takes into account USD transactions from the accounts.



22
23
24
# File 'lib/the_plaid_api/models/cra_voa_report_attributes.rb', line 22

def total_outflow_amount
  @total_outflow_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/the_plaid_api/models/cra_voa_report_attributes.rb', line 56

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  total_inflow_amount = TotalReportInflowAmount.from_hash(hash['total_inflow_amount']) if
    hash['total_inflow_amount']
  total_outflow_amount = TotalReportOutflowAmount.from_hash(hash['total_outflow_amount']) if
    hash['total_outflow_amount']

  # 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.
  CraVoaReportAttributes.new(total_inflow_amount: total_inflow_amount,
                             total_outflow_amount: total_outflow_amount,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
# File 'lib/the_plaid_api/models/cra_voa_report_attributes.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['total_inflow_amount'] = 'total_inflow_amount'
  @_hash['total_outflow_amount'] = 'total_outflow_amount'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    total_inflow_amount
    total_outflow_amount
  ]
end

.optionalsObject

An array for optional fields



33
34
35
# File 'lib/the_plaid_api/models/cra_voa_report_attributes.rb', line 33

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



86
87
88
89
90
# File 'lib/the_plaid_api/models/cra_voa_report_attributes.rb', line 86

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

#to_sObject

Provides a human-readable string representation of the object.



79
80
81
82
83
# File 'lib/the_plaid_api/models/cra_voa_report_attributes.rb', line 79

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