Class: ThePlaidApi::CraVoaReport

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

Overview

An object representing a 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(generated_time:, days_requested:, items:, attributes:, additional_properties: nil) ⇒ CraVoaReport

Returns a new instance of CraVoaReport.



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/the_plaid_api/models/cra_voa_report.rb', line 52

def initialize(generated_time:, days_requested:, items:, attributes:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @generated_time = generated_time
  @days_requested = days_requested
  @items = items
  @attributes = attributes
  @additional_properties = additional_properties
end

Instance Attribute Details

#attributesCraVoaReportAttributes

Attributes for the VOA report.



30
31
32
# File 'lib/the_plaid_api/models/cra_voa_report.rb', line 30

def attributes
  @attributes
end

#days_requestedFloat

The number of days of transaction history that the VOA report covers.

Returns:

  • (Float)


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

def days_requested
  @days_requested
end

#generated_timeDateTime

The date and time when the VOA Report was created, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (e.g. ā€œ2018-04-12T03:32:11Zā€).

Returns:

  • (DateTime)


17
18
19
# File 'lib/the_plaid_api/models/cra_voa_report.rb', line 17

def generated_time
  @generated_time
end

#itemsArray[CraVoaReportItem]

Data returned by Plaid about each of the Items included in the Base Report.

Returns:



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

def items
  @items
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
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
97
98
99
# File 'lib/the_plaid_api/models/cra_voa_report.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  generated_time = if hash.key?('generated_time')
                     (DateTimeHelper.from_rfc3339(hash['generated_time']) if hash['generated_time'])
                   end
  days_requested =
    hash.key?('days_requested') ? hash['days_requested'] : nil
  # Parameter is an array, so we need to iterate through it
  items = nil
  unless hash['items'].nil?
    items = []
    hash['items'].each do |structure|
      items << (CraVoaReportItem.from_hash(structure) if structure)
    end
  end

  items = nil unless hash.key?('items')
  attributes = CraVoaReportAttributes.from_hash(hash['attributes']) if hash['attributes']

  # 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.
  CraVoaReport.new(generated_time: generated_time,
                   days_requested: days_requested,
                   items: items,
                   attributes: attributes,
                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
# File 'lib/the_plaid_api/models/cra_voa_report.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['generated_time'] = 'generated_time'
  @_hash['days_requested'] = 'days_requested'
  @_hash['items'] = 'items'
  @_hash['attributes'] = 'attributes'
  @_hash
end

.nullablesObject

An array for nullable fields



48
49
50
# File 'lib/the_plaid_api/models/cra_voa_report.rb', line 48

def self.nullables
  []
end

.optionalsObject

An array for optional fields



43
44
45
# File 'lib/the_plaid_api/models/cra_voa_report.rb', line 43

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



114
115
116
117
118
119
# File 'lib/the_plaid_api/models/cra_voa_report.rb', line 114

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

#to_custom_generated_timeObject



101
102
103
# File 'lib/the_plaid_api/models/cra_voa_report.rb', line 101

def to_custom_generated_time
  DateTimeHelper.to_rfc3339(generated_time)
end

#to_sObject

Provides a human-readable string representation of the object.



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

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