Class: ThePlaidApi::LinkCallbackMetadata

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

Overview

Information related to the callback from the Hosted Link session.

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(callback_type: SKIP, event_name: SKIP, status: SKIP, link_session_id: SKIP, request_id: SKIP, institution: SKIP, accounts: SKIP, additional_properties: nil) ⇒ LinkCallbackMetadata

Returns a new instance of LinkCallbackMetadata.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/the_plaid_api/models/link_callback_metadata.rb', line 76

def initialize(callback_type: SKIP, event_name: SKIP, status: SKIP,
               link_session_id: SKIP, request_id: SKIP, institution: SKIP,
               accounts: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @callback_type = callback_type unless callback_type == SKIP
  @event_name = event_name unless event_name == SKIP
  @status = status unless status == SKIP
  @link_session_id = link_session_id unless link_session_id == SKIP
  @request_id = request_id unless request_id == SKIP
  @institution = institution unless institution == SKIP
  @accounts = accounts unless accounts == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#accountsArray[LinkDeliveryAccount]

A list of accounts attached to the connected Item. If Account Select is enabled via the developer dashboard, accounts will only include selected accounts.

Returns:



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

def accounts
  @accounts
end

#callback_typeLinkDeliveryWebhookCallbackType

The type of Link callback event



14
15
16
# File 'lib/the_plaid_api/models/link_callback_metadata.rb', line 14

def callback_type
  @callback_type
end

#event_nameLinkEventName

A string representing the event that has just occurred in the Link flow.

Returns:



18
19
20
# File 'lib/the_plaid_api/models/link_callback_metadata.rb', line 18

def event_name
  @event_name
end

#institutionLinkDeliveryInstitution

Information related to the financial institution.



37
38
39
# File 'lib/the_plaid_api/models/link_callback_metadata.rb', line 37

def institution
  @institution
end

A unique identifier associated with a user’s actions and events through the Link flow. Include this identifier when opening a support ticket for faster turnaround.

Returns:

  • (String)


28
29
30
# File 'lib/the_plaid_api/models/link_callback_metadata.rb', line 28

def link_session_id
  @link_session_id
end

#request_idString

The request ID for the last request made by Link. This can be shared with Plaid Support to expedite investigation.

Returns:

  • (String)


33
34
35
# File 'lib/the_plaid_api/models/link_callback_metadata.rb', line 33

def request_id
  @request_id
end

#statusString

Indicates where in the flow the Link user exited

Returns:

  • (String)


22
23
24
# File 'lib/the_plaid_api/models/link_callback_metadata.rb', line 22

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
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
# File 'lib/the_plaid_api/models/link_callback_metadata.rb', line 93

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  callback_type = hash.key?('callback_type') ? hash['callback_type'] : SKIP
  event_name = hash.key?('event_name') ? hash['event_name'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  link_session_id =
    hash.key?('link_session_id') ? hash['link_session_id'] : SKIP
  request_id = hash.key?('request_id') ? hash['request_id'] : SKIP
  institution = LinkDeliveryInstitution.from_hash(hash['institution']) if hash['institution']
  # Parameter is an array, so we need to iterate through it
  accounts = nil
  unless hash['accounts'].nil?
    accounts = []
    hash['accounts'].each do |structure|
      accounts << (LinkDeliveryAccount.from_hash(structure) if structure)
    end
  end

  accounts = SKIP unless hash.key?('accounts')

  # 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.
  LinkCallbackMetadata.new(callback_type: callback_type,
                           event_name: event_name,
                           status: status,
                           link_session_id: link_session_id,
                           request_id: request_id,
                           institution: institution,
                           accounts: accounts,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/the_plaid_api/models/link_callback_metadata.rb', line 46

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['callback_type'] = 'callback_type'
  @_hash['event_name'] = 'event_name'
  @_hash['status'] = 'status'
  @_hash['link_session_id'] = 'link_session_id'
  @_hash['request_id'] = 'request_id'
  @_hash['institution'] = 'institution'
  @_hash['accounts'] = 'accounts'
  @_hash
end

.nullablesObject

An array for nullable fields



72
73
74
# File 'lib/the_plaid_api/models/link_callback_metadata.rb', line 72

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    callback_type
    event_name
    status
    link_session_id
    request_id
    institution
    accounts
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} callback_type: #{@callback_type.inspect}, event_name:"\
  " #{@event_name.inspect}, status: #{@status.inspect}, link_session_id:"\
  " #{@link_session_id.inspect}, request_id: #{@request_id.inspect}, institution:"\
  " #{@institution.inspect}, accounts: #{@accounts.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



134
135
136
137
138
139
140
# File 'lib/the_plaid_api/models/link_callback_metadata.rb', line 134

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} callback_type: #{@callback_type}, event_name: #{@event_name}, status:"\
  " #{@status}, link_session_id: #{@link_session_id}, request_id: #{@request_id}, institution:"\
  " #{@institution}, accounts: #{@accounts}, additional_properties:"\
  " #{@additional_properties}>"
end