Class: ThePlaidApi::LinkSessionExit

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

Overview

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.

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(error:, metadata:, additional_properties: nil) ⇒ LinkSessionExit

Returns a new instance of LinkSessionExit.



52
53
54
55
56
57
58
59
# File 'lib/the_plaid_api/models/link_session_exit.rb', line 52

def initialize(error:, metadata:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @error = error
  @metadata = 
  @additional_properties = additional_properties
end

Instance Attribute Details

#errorError

Errors are identified by ‘error_code` and categorized by `error_type`. Use these in preference to HTTP status codes to identify and handle specific errors. HTTP status codes are set and provide the broadest categorization of errors: 4xx codes are for developer- or user-related errors, and 5xx codes are for Plaid-related errors, and the status will be 2xx in non-error cases. An Item with a non-`null` error object will only be part of an API response when calling `/item/get` to view Item status. Otherwise, error fields will be `null` if no error has occurred; if an error has occurred, an error code will be returned instead.

Returns:



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

def error
  @error
end

#metadataLinkSessionExitMetadata

Displayed if a user exits Link without successfully linking an Item.



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

def 
  @metadata
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/the_plaid_api/models/link_session_exit.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  error = Error.from_hash(hash['error']) if hash['error']
   = LinkSessionExitMetadata.from_hash(hash['metadata']) if hash['metadata']

  # 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.
  LinkSessionExit.new(error: error,
                      metadata: ,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['error'] = 'error'
  @_hash['metadata'] = 'metadata'
  @_hash
end

.nullablesObject

An array for nullable fields



45
46
47
48
49
50
# File 'lib/the_plaid_api/models/link_session_exit.rb', line 45

def self.nullables
  %w[
    error
    metadata
  ]
end

.optionalsObject

An array for optional fields



40
41
42
# File 'lib/the_plaid_api/models/link_session_exit.rb', line 40

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



90
91
92
93
94
# File 'lib/the_plaid_api/models/link_session_exit.rb', line 90

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

#to_sObject

Provides a human-readable string representation of the object.



83
84
85
86
87
# File 'lib/the_plaid_api/models/link_session_exit.rb', line 83

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