Class: ThePlaidApi::ItemActivityListResponse

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

Overview

Describes a historical log of user consent events.

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(request_id:, activities:, last_data_access_times:, cursor: SKIP, additional_properties: nil) ⇒ ItemActivityListResponse

Returns a new instance of ItemActivityListResponse.



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

def initialize(request_id:, activities:, last_data_access_times:,
               cursor: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @request_id = request_id
  @activities = activities
  @last_data_access_times = last_data_access_times
  @cursor = cursor unless cursor == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#activitiesArray[Activity]

A list of activities.

Returns:



20
21
22
# File 'lib/the_plaid_api/models/item_activity_list_response.rb', line 20

def activities
  @activities
end

#cursorString

Cursor used for pagination.

Returns:

  • (String)


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

def cursor
  @cursor
end

#last_data_access_timesArray[LastDataAccessTimes]

An array of objects containing timestamps for the last time each data type was accessed per application.

Returns:



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

def last_data_access_times
  @last_data_access_times
end

#request_idString

A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.

Returns:

  • (String)


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

def request_id
  @request_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
100
101
102
103
104
105
106
# File 'lib/the_plaid_api/models/item_activity_list_response.rb', line 66

def self.from_hash(hash)
  return nil unless hash

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

  activities = nil unless hash.key?('activities')
  # Parameter is an array, so we need to iterate through it
  last_data_access_times = nil
  unless hash['last_data_access_times'].nil?
    last_data_access_times = []
    hash['last_data_access_times'].each do |structure|
      last_data_access_times << (LastDataAccessTimes.from_hash(structure) if structure)
    end
  end

  last_data_access_times = nil unless hash.key?('last_data_access_times')
  cursor = hash.key?('cursor') ? hash['cursor'] : 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.
  ItemActivityListResponse.new(request_id: request_id,
                               activities: activities,
                               last_data_access_times: last_data_access_times,
                               cursor: cursor,
                               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/item_activity_list_response.rb', line 32

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['request_id'] = 'request_id'
  @_hash['activities'] = 'activities'
  @_hash['last_data_access_times'] = 'last_data_access_times'
  @_hash['cursor'] = 'cursor'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/the_plaid_api/models/item_activity_list_response.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



42
43
44
45
46
# File 'lib/the_plaid_api/models/item_activity_list_response.rb', line 42

def self.optionals
  %w[
    cursor
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



117
118
119
120
121
122
# File 'lib/the_plaid_api/models/item_activity_list_response.rb', line 117

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

#to_sObject

Provides a human-readable string representation of the object.



109
110
111
112
113
114
# File 'lib/the_plaid_api/models/item_activity_list_response.rb', line 109

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