Class: ThePlaidApi::NetworkInsightsReport

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

Overview

Contains data for the Network 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:, network_attributes:, items:, additional_properties: nil) ⇒ NetworkInsightsReport

Returns a new instance of NetworkInsightsReport.



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

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

  @report_id = report_id
  @generated_time = generated_time
  @network_attributes = network_attributes
  @items = items
  @additional_properties = additional_properties
end

Instance Attribute Details

#generated_timeDateTime

The time when the Network Insights Report was generated.

Returns:

  • (DateTime)


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

def generated_time
  @generated_time
end

#itemsArray[NetworkInsightsItem]

A list of Items associated with the provided ‘access_tokens`.

Returns:



29
30
31
# File 'lib/the_plaid_api/models/network_insights_report.rb', line 29

def items
  @items
end

#network_attributesObject

A map of network attributes, where the key is a string, and the value is a float, int, or boolean. For a full list of attributes, contact your account manager.

Returns:

  • (Object)


25
26
27
# File 'lib/the_plaid_api/models/network_insights_report.rb', line 25

def network_attributes
  @network_attributes
end

#report_idString

The unique identifier associated with the Network Insights report object.

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/network_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.



64
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
# File 'lib/the_plaid_api/models/network_insights_report.rb', line 64

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
  network_attributes =
    hash.key?('network_attributes') ? hash['network_attributes'] : 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 << (NetworkInsightsItem.from_hash(structure) if structure)
    end
  end

  items = nil unless hash.key?('items')

  # 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.
  NetworkInsightsReport.new(report_id: report_id,
                            generated_time: generated_time,
                            network_attributes: network_attributes,
                            items: items,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



42
43
44
# File 'lib/the_plaid_api/models/network_insights_report.rb', line 42

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_custom_generated_timeObject



100
101
102
# File 'lib/the_plaid_api/models/network_insights_report.rb', line 100

def to_custom_generated_time
  DateTimeHelper.to_rfc3339(generated_time)
end

#to_sObject

Provides a human-readable string representation of the object.



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

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