Class: ThePlaidApi::LinkSessionFinishedWebhook

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

Overview

Contains the state of a completed Link session, along with the public token(s) if available. By default, this webhook is sent only for sessions enabled for the Hosted Link flow (including Link Recovery flows), a Multi-Item Link flow, or a Layer flow. If you would like to receive this webhook for other sessions, contact your Account Manager or Support. This enablement will also enable the ‘EVENTS` webhook for all Link sessions and the ability to use `/link/token/get` to retrieve events for non-Hosted-Link sessions.

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(webhook_type:, webhook_code:, status:, link_session_id:, link_token:, environment:, public_token: SKIP, public_tokens: SKIP, user_id: SKIP, additional_properties: nil) ⇒ LinkSessionFinishedWebhook

Returns a new instance of LinkSessionFinishedWebhook.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/the_plaid_api/models/link_session_finished_webhook.rb', line 87

def initialize(webhook_type:, webhook_code:, status:, link_session_id:,
               link_token:, environment:, public_token: SKIP,
               public_tokens: SKIP, user_id: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @webhook_type = webhook_type
  @webhook_code = webhook_code
  @status = status
  @link_session_id = link_session_id
  @link_token = link_token
  @public_token = public_token unless public_token == SKIP
  @public_tokens = public_tokens unless public_tokens == SKIP
  @user_id = user_id unless user_id == SKIP
  @environment = environment
  @additional_properties = additional_properties
end

Instance Attribute Details

#environmentWebhookEnvironmentValues

The Plaid environment the webhook was sent from



56
57
58
# File 'lib/the_plaid_api/models/link_session_finished_webhook.rb', line 56

def environment
  @environment
end

The identifier for the Link session.

Returns:

  • (String)


34
35
36
# File 'lib/the_plaid_api/models/link_session_finished_webhook.rb', line 34

def link_session_id
  @link_session_id
end

The link token used to create the Link session.

Returns:

  • (String)


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

def link_token
  @link_token
end

#public_tokenString

The public token generated by the Link session. This field has been deprecated; please use ‘public_tokens` instead.

Returns:

  • (String)


43
44
45
# File 'lib/the_plaid_api/models/link_session_finished_webhook.rb', line 43

def public_token
  @public_token
end

#public_tokensArray[String]

The public tokens generated by the Link session.

Returns:

  • (Array[String])


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

def public_tokens
  @public_tokens
end

#statusString

The final status of the Link session. Will always be “SUCCESS” or “EXITED”.

Returns:

  • (String)


30
31
32
# File 'lib/the_plaid_api/models/link_session_finished_webhook.rb', line 30

def status
  @status
end

#user_idString

The Plaid ‘user_id` of the User associated with this webhook, warning, or error.

Returns:

  • (String)


52
53
54
# File 'lib/the_plaid_api/models/link_session_finished_webhook.rb', line 52

def user_id
  @user_id
end

#webhook_codeString

‘SESSION_FINISHED`

Returns:

  • (String)


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

def webhook_code
  @webhook_code
end

#webhook_typeString

‘LINK`

Returns:

  • (String)


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

def webhook_type
  @webhook_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/the_plaid_api/models/link_session_finished_webhook.rb', line 107

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
  status = hash.key?('status') ? hash['status'] : nil
  link_session_id =
    hash.key?('link_session_id') ? hash['link_session_id'] : nil
  link_token = hash.key?('link_token') ? hash['link_token'] : nil
  environment = hash.key?('environment') ? hash['environment'] : nil
  public_token = hash.key?('public_token') ? hash['public_token'] : SKIP
  public_tokens = hash.key?('public_tokens') ? hash['public_tokens'] : SKIP
  user_id = hash.key?('user_id') ? hash['user_id'] : 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.
  LinkSessionFinishedWebhook.new(webhook_type: webhook_type,
                                 webhook_code: webhook_code,
                                 status: status,
                                 link_session_id: link_session_id,
                                 link_token: link_token,
                                 environment: environment,
                                 public_token: public_token,
                                 public_tokens: public_tokens,
                                 user_id: user_id,
                                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/the_plaid_api/models/link_session_finished_webhook.rb', line 59

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['webhook_type'] = 'webhook_type'
  @_hash['webhook_code'] = 'webhook_code'
  @_hash['status'] = 'status'
  @_hash['link_session_id'] = 'link_session_id'
  @_hash['link_token'] = 'link_token'
  @_hash['public_token'] = 'public_token'
  @_hash['public_tokens'] = 'public_tokens'
  @_hash['user_id'] = 'user_id'
  @_hash['environment'] = 'environment'
  @_hash
end

.nullablesObject

An array for nullable fields



83
84
85
# File 'lib/the_plaid_api/models/link_session_finished_webhook.rb', line 83

def self.nullables
  []
end

.optionalsObject

An array for optional fields



74
75
76
77
78
79
80
# File 'lib/the_plaid_api/models/link_session_finished_webhook.rb', line 74

def self.optionals
  %w[
    public_token
    public_tokens
    user_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



152
153
154
155
156
157
158
159
160
# File 'lib/the_plaid_api/models/link_session_finished_webhook.rb', line 152

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} webhook_type: #{@webhook_type.inspect}, webhook_code:"\
  " #{@webhook_code.inspect}, status: #{@status.inspect}, link_session_id:"\
  " #{@link_session_id.inspect}, link_token: #{@link_token.inspect}, public_token:"\
  " #{@public_token.inspect}, public_tokens: #{@public_tokens.inspect}, user_id:"\
  " #{@user_id.inspect}, environment: #{@environment.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



143
144
145
146
147
148
149
# File 'lib/the_plaid_api/models/link_session_finished_webhook.rb', line 143

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} webhook_type: #{@webhook_type}, webhook_code: #{@webhook_code}, status:"\
  " #{@status}, link_session_id: #{@link_session_id}, link_token: #{@link_token},"\
  " public_token: #{@public_token}, public_tokens: #{@public_tokens}, user_id: #{@user_id},"\
  " environment: #{@environment}, additional_properties: #{@additional_properties}>"
end