Class: ThePlaidApi::CraCashflowInsightsReport

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

Overview

Contains data for the CRA Cashflow Insights 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(report_id:, generated_time:, attributes: SKIP, additional_properties: nil) ⇒ CraCashflowInsightsReport

Returns a new instance of CraCashflowInsightsReport.



49
50
51
52
53
54
55
56
57
58
# File 'lib/the_plaid_api/models/cra_cashflow_insights_report.rb', line 49

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

  @report_id = report_id
  @generated_time = generated_time
  @attributes = attributes unless attributes == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#attributesObject

A map of cash flow attributes, where the key is a string, and the value is a float, int, or boolean. The specific list of attributes will depend on the cash flow attributes version used. For a full list of attributes, contact your account manager.

Returns:

  • (Object)


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

def attributes
  @attributes
end

#generated_timeDateTime

The time when the report was generated.

Returns:

  • (DateTime)


19
20
21
# File 'lib/the_plaid_api/models/cra_cashflow_insights_report.rb', line 19

def generated_time
  @generated_time
end

#report_idString

The unique identifier associated with the report object.

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/cra_cashflow_insights_report.rb', line 15

def report_id
  @report_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/the_plaid_api/models/cra_cashflow_insights_report.rb', line 61

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  report_id = hash.key?('report_id') ? hash['report_id'] : nil
  generated_time = if hash.key?('generated_time')
                     (DateTimeHelper.from_rfc3339(hash['generated_time']) if hash['generated_time'])
                   end
  attributes = hash.key?('attributes') ? hash['attributes'] : SKIP

  # 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.
  CraCashflowInsightsReport.new(report_id: report_id,
                                generated_time: generated_time,
                                attributes: attributes,
                                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
# File 'lib/the_plaid_api/models/cra_cashflow_insights_report.rb', line 29

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

.nullablesObject

An array for nullable fields



45
46
47
# File 'lib/the_plaid_api/models/cra_cashflow_insights_report.rb', line 45

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    attributes
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



97
98
99
100
101
102
# File 'lib/the_plaid_api/models/cra_cashflow_insights_report.rb', line 97

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

#to_custom_generated_timeObject



85
86
87
# File 'lib/the_plaid_api/models/cra_cashflow_insights_report.rb', line 85

def to_custom_generated_time
  DateTimeHelper.to_rfc3339(generated_time)
end

#to_sObject

Provides a human-readable string representation of the object.



90
91
92
93
94
# File 'lib/the_plaid_api/models/cra_cashflow_insights_report.rb', line 90

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