Class: ThePlaidApi::LinkTokenGetSessionsResponse

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

Overview

An object containing information about a link session. Session data will be provided for up to six hours after the session has ended.

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(link_session_id:, started_at: SKIP, finished_at: SKIP, on_success: SKIP, on_exit: SKIP, exit: SKIP, events: SKIP, results: SKIP, additional_properties: nil) ⇒ LinkTokenGetSessionsResponse

Returns a new instance of LinkTokenGetSessionsResponse.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/the_plaid_api/models/link_token_get_sessions_response.rb', line 103

def initialize(link_session_id:, started_at: SKIP, finished_at: SKIP,
               on_success: SKIP, on_exit: SKIP, exit: SKIP, events: SKIP,
               results: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @link_session_id = link_session_id
  @started_at = started_at unless started_at == SKIP
  @finished_at = finished_at unless finished_at == SKIP
  @on_success = on_success unless on_success == SKIP
  @on_exit = on_exit unless on_exit == SKIP
  @exit = exit unless exit == SKIP
  @events = events unless events == SKIP
  @results = results unless results == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#eventsArray[LinkEvent]

List of customer-related Link events

Returns:



59
60
61
# File 'lib/the_plaid_api/models/link_token_get_sessions_response.rb', line 59

def events
  @events
end

#exitLinkSessionExit

An object representing an [onExit](plaid.com/docs/link/web/#onexit) callback from Link. If you are not receiving this field and are instead receiving the deprecated ‘on_exit` field, contact your Account Manager to update your integration.

Returns:



55
56
57
# File 'lib/the_plaid_api/models/link_token_get_sessions_response.rb', line 55

def exit
  @exit
end

#finished_atDateTime

The timestamp at which the link session was finished, if available, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format.

Returns:

  • (DateTime)


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

def finished_at
  @finished_at
end

The unique ID for the link session.

Returns:

  • (String)


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

def link_session_id
  @link_session_id
end

#on_exitLinkSessionExitDeprecated

An object representing an [onExit](plaid.com/docs/link/web/#onexit) callback from Link. This field is returned only for legacy implementations and has been deprecated in favor of [‘exit`](plaid.com/docs/api/link/#link-token-get-response-link-ses sions-exit), for improved naming consistency. If you are receiving this field, contact your Account Manager to migrate to the newer `exit` field.



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

def on_exit
  @on_exit
end

#on_successLinkSessionSuccess

An object representing an [onSuccess](plaid.com/docs/link/web/#onsuccess) callback from Link. This field is returned only for legacy integrations and is deprecated in favor of [‘results.item_add_results`](plaid.com/docs/api/link/#link-token-g et-response-link-sessions-results-item-add-results) which can support multiple public tokens in a single Link session, for flows such as multi-Item Link. If you are receiving `on_success`, contact your Account Manager to migrate to `results.item_add_results` instead.

Returns:



38
39
40
# File 'lib/the_plaid_api/models/link_token_get_sessions_response.rb', line 38

def on_success
  @on_success
end

#resultsLinkSessionResults

The set of results for a Link session.

Returns:



63
64
65
# File 'lib/the_plaid_api/models/link_token_get_sessions_response.rb', line 63

def results
  @results
end

#started_atDateTime

The timestamp at which the link session was first started, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format.

Returns:

  • (DateTime)


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

def started_at
  @started_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/the_plaid_api/models/link_token_get_sessions_response.rb', line 121

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  link_session_id =
    hash.key?('link_session_id') ? hash['link_session_id'] : nil
  started_at = if hash.key?('started_at')
                 (DateTimeHelper.from_rfc3339(hash['started_at']) if hash['started_at'])
               else
                 SKIP
               end
  finished_at = if hash.key?('finished_at')
                  (DateTimeHelper.from_rfc3339(hash['finished_at']) if hash['finished_at'])
                else
                  SKIP
                end
  on_success = LinkSessionSuccess.from_hash(hash['on_success']) if hash['on_success']
  on_exit = LinkSessionExitDeprecated.from_hash(hash['on_exit']) if hash['on_exit']
  exit = LinkSessionExit.from_hash(hash['exit']) if hash['exit']
  # Parameter is an array, so we need to iterate through it
  events = nil
  unless hash['events'].nil?
    events = []
    hash['events'].each do |structure|
      events << (LinkEvent.from_hash(structure) if structure)
    end
  end

  events = SKIP unless hash.key?('events')
  results = LinkSessionResults.from_hash(hash['results']) if hash['results']

  # 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.
  LinkTokenGetSessionsResponse.new(link_session_id: link_session_id,
                                   started_at: started_at,
                                   finished_at: finished_at,
                                   on_success: on_success,
                                   on_exit: on_exit,
                                   exit: exit,
                                   events: events,
                                   results: results,
                                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/the_plaid_api/models/link_token_get_sessions_response.rb', line 66

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['link_session_id'] = 'link_session_id'
  @_hash['started_at'] = 'started_at'
  @_hash['finished_at'] = 'finished_at'
  @_hash['on_success'] = 'on_success'
  @_hash['on_exit'] = 'on_exit'
  @_hash['exit'] = 'exit'
  @_hash['events'] = 'events'
  @_hash['results'] = 'results'
  @_hash
end

.nullablesObject

An array for nullable fields



93
94
95
96
97
98
99
100
101
# File 'lib/the_plaid_api/models/link_token_get_sessions_response.rb', line 93

def self.nullables
  %w[
    finished_at
    on_success
    on_exit
    exit
    results
  ]
end

.optionalsObject

An array for optional fields



80
81
82
83
84
85
86
87
88
89
90
# File 'lib/the_plaid_api/models/link_token_get_sessions_response.rb', line 80

def self.optionals
  %w[
    started_at
    finished_at
    on_success
    on_exit
    exit
    events
    results
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



189
190
191
192
193
194
195
196
# File 'lib/the_plaid_api/models/link_token_get_sessions_response.rb', line 189

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} link_session_id: #{@link_session_id.inspect}, started_at:"\
  " #{@started_at.inspect}, finished_at: #{@finished_at.inspect}, on_success:"\
  " #{@on_success.inspect}, on_exit: #{@on_exit.inspect}, exit: #{@exit.inspect}, events:"\
  " #{@events.inspect}, results: #{@results.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_finished_atObject



175
176
177
# File 'lib/the_plaid_api/models/link_token_get_sessions_response.rb', line 175

def to_custom_finished_at
  DateTimeHelper.to_rfc3339(finished_at)
end

#to_custom_started_atObject



171
172
173
# File 'lib/the_plaid_api/models/link_token_get_sessions_response.rb', line 171

def to_custom_started_at
  DateTimeHelper.to_rfc3339(started_at)
end

#to_sObject

Provides a human-readable string representation of the object.



180
181
182
183
184
185
186
# File 'lib/the_plaid_api/models/link_token_get_sessions_response.rb', line 180

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} link_session_id: #{@link_session_id}, started_at: #{@started_at},"\
  " finished_at: #{@finished_at}, on_success: #{@on_success}, on_exit: #{@on_exit}, exit:"\
  " #{@exit}, events: #{@events}, results: #{@results}, additional_properties:"\
  " #{@additional_properties}>"
end