Class: ThePlaidApi::LinkEventsWebhook
- Defined in:
- lib/the_plaid_api/models/link_events_webhook.rb
Overview
This webhook contains a summary of the events from a Link session and will be fired after the user finishes going through Link. If the user abandons the Link flow (i.e., closes the hosted link webpage or leaves Link open for too long without taking any action), the webhook will be fired 5-15 minutes after the last user interaction. A single Link session may occasionally generate multiple ‘EVENTS` webhooks. If this occurs, the new webhook will contain all previous events for the session, as well as new events that occurred since the previous `EVENTS` webhook was sent. If this occurs, events can be grouped using the `link_session_id` field and, if necessary, de-duplicated using the `event_id` field. By default, the `EVENTS` webhook is sent only for sessions where the end user goes through a Hosted Link flow (including Link Recovery flows). If you would like to receive this webhook for sessions not using Hosted Link, contact your Account Manager or Support. This enablement will also cause you to receive the `SESSION_FINISHED` webhook for non-Hosted-Link sessions and to be able to use `/link/token/get` to receive events data for non-Hosted Link sessions.
Instance Attribute Summary collapse
-
#events ⇒ Array[LinkEvent]
The Link events emitted during the Link session.
-
#link_session_id ⇒ String
An identifier for the Link session these events occurred in.
-
#link_token ⇒ String
The Link token used to create the Link session these events are from.
-
#webhook_code ⇒ String
‘EVENTS`.
-
#webhook_type ⇒ String
‘LINK`.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(webhook_type:, webhook_code:, events:, link_session_id:, link_token:, additional_properties: nil) ⇒ LinkEventsWebhook
constructor
A new instance of LinkEventsWebhook.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(webhook_type:, webhook_code:, events:, link_session_id:, link_token:, additional_properties: nil) ⇒ LinkEventsWebhook
Returns a new instance of LinkEventsWebhook.
68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/the_plaid_api/models/link_events_webhook.rb', line 68 def initialize(webhook_type:, webhook_code:, events:, link_session_id:, link_token:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @webhook_type = webhook_type @webhook_code = webhook_code @events = events @link_session_id = link_session_id @link_token = link_token @additional_properties = additional_properties end |
Instance Attribute Details
#events ⇒ Array[LinkEvent]
The Link events emitted during the Link session
37 38 39 |
# File 'lib/the_plaid_api/models/link_events_webhook.rb', line 37 def events @events end |
#link_session_id ⇒ String
An identifier for the Link session these events occurred in
41 42 43 |
# File 'lib/the_plaid_api/models/link_events_webhook.rb', line 41 def link_session_id @link_session_id end |
#link_token ⇒ String
The Link token used to create the Link session these events are from
45 46 47 |
# File 'lib/the_plaid_api/models/link_events_webhook.rb', line 45 def link_token @link_token end |
#webhook_code ⇒ String
‘EVENTS`
33 34 35 |
# File 'lib/the_plaid_api/models/link_events_webhook.rb', line 33 def webhook_code @webhook_code end |
#webhook_type ⇒ String
‘LINK`
29 30 31 |
# File 'lib/the_plaid_api/models/link_events_webhook.rb', line 29 def webhook_type @webhook_type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/the_plaid_api/models/link_events_webhook.rb', line 82 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. webhook_type = hash.key?('webhook_type') ? hash['webhook_type'] : nil webhook_code = hash.key?('webhook_code') ? hash['webhook_code'] : nil # 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 = nil unless hash.key?('events') link_session_id = hash.key?('link_session_id') ? hash['link_session_id'] : nil link_token = hash.key?('link_token') ? hash['link_token'] : nil # 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. LinkEventsWebhook.new(webhook_type: webhook_type, webhook_code: webhook_code, events: events, link_session_id: link_session_id, link_token: link_token, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
48 49 50 51 52 53 54 55 56 |
# File 'lib/the_plaid_api/models/link_events_webhook.rb', line 48 def self.names @_hash = {} if @_hash.nil? @_hash['webhook_type'] = 'webhook_type' @_hash['webhook_code'] = 'webhook_code' @_hash['events'] = 'events' @_hash['link_session_id'] = 'link_session_id' @_hash['link_token'] = 'link_token' @_hash end |
.nullables ⇒ Object
An array for nullable fields
64 65 66 |
# File 'lib/the_plaid_api/models/link_events_webhook.rb', line 64 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
59 60 61 |
# File 'lib/the_plaid_api/models/link_events_webhook.rb', line 59 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
127 128 129 130 131 132 133 |
# File 'lib/the_plaid_api/models/link_events_webhook.rb', line 127 def inspect class_name = self.class.name.split('::').last "<#{class_name} webhook_type: #{@webhook_type.inspect}, webhook_code:"\ " #{@webhook_code.inspect}, events: #{@events.inspect}, link_session_id:"\ " #{@link_session_id.inspect}, link_token: #{@link_token.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
119 120 121 122 123 124 |
# File 'lib/the_plaid_api/models/link_events_webhook.rb', line 119 def to_s class_name = self.class.name.split('::').last "<#{class_name} webhook_type: #{@webhook_type}, webhook_code: #{@webhook_code}, events:"\ " #{@events}, link_session_id: #{@link_session_id}, link_token: #{@link_token},"\ " additional_properties: #{@additional_properties}>" end |