Class: ThePlaidApi::SessionTokenCreateRequest

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

Overview

SessionTokenCreateRequest defines the request schema for ‘/session/token/create`

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(template_id:, client_id: SKIP, secret: SKIP, user: SKIP, redirect_uri: SKIP, android_package_name: SKIP, webhook: SKIP, user_id: SKIP, additional_properties: nil) ⇒ SessionTokenCreateRequest

Returns a new instance of SessionTokenCreateRequest.



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

def initialize(template_id:, client_id: SKIP, secret: SKIP, user: SKIP,
               redirect_uri: SKIP, android_package_name: SKIP,
               webhook: SKIP, user_id: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @client_id = client_id unless client_id == SKIP
  @secret = secret unless secret == SKIP
  @template_id = template_id
  @user = user unless user == SKIP
  @redirect_uri = redirect_uri unless redirect_uri == SKIP
  @android_package_name = android_package_name unless android_package_name == SKIP
  @webhook = webhook unless webhook == SKIP
  @user_id = user_id unless user_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#android_package_nameString

The name of your app’s Android package. Required if using the session token to initialize Layer on Android. Any package name specified here must also be added to the Allowed Android package names setting on the [developer dashboard](dashboard.plaid.com/team/api). When creating a session token for initializing Layer on other platforms, ‘android_package_name` must be left blank and `redirect_uri` should be used instead.

Returns:

  • (String)


53
54
55
# File 'lib/the_plaid_api/models/session_token_create_request.rb', line 53

def android_package_name
  @android_package_name
end

#client_idString

Your Plaid API ‘client_id`. The `client_id` is required and may be provided either in the `PLAID-CLIENT-ID` header or as part of a request body.

Returns:

  • (String)


17
18
19
# File 'lib/the_plaid_api/models/session_token_create_request.rb', line 17

def client_id
  @client_id
end

#redirect_uriString

A URI indicating the destination where a user should be forwarded after completing the Link flow; used to support OAuth authentication flows when launching Link in the browser or another app. The ‘redirect_uri` should not contain any query parameters. When used in Production, must be an https URI. Note that any redirect URI must also be added to the Allowed redirect URIs list in the [developer dashboard](dashboard.plaid.com/team/api). If initializing on Android, `android_package_name` must be specified instead and `redirect_uri` should be left blank.

Returns:

  • (String)


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

def redirect_uri
  @redirect_uri
end

#secretString

Your Plaid API ‘secret`. The `secret` is required and may be provided either in the `PLAID-SECRET` header or as part of a request body.

Returns:

  • (String)


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

def secret
  @secret
end

#template_idString

The id of a template defined in Plaid Dashboard

Returns:

  • (String)


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

def template_id
  @template_id
end

#userSessionTokenCreateRequestUser

Details about the end user. Required if a root-level ‘user_id` is not provided.



31
32
33
# File 'lib/the_plaid_api/models/session_token_create_request.rb', line 31

def user
  @user
end

#user_idString

A unique user identifier, created by ‘/user/create`. Integrations that began using `/user/create` after December 10, 2025 use this field to identify a user instead of the `user_token`. For more details, see [new user APIs](plaid.com/docs/api/users/user-apis).

Returns:

  • (String)


69
70
71
# File 'lib/the_plaid_api/models/session_token_create_request.rb', line 69

def user_id
  @user_id
end

#webhookString

The destination URL to which any webhooks should be sent. If you use the same webhook listener for all Sandbox or all Production activity, set this value in the Layer template editor in the Dashboard instead. Only provide a value in this field if you need to use multiple webhook URLs per environment (an uncommon use case). If provided, a value in this field will take priority over webhook values set in the Layer template editor.

Returns:

  • (String)


62
63
64
# File 'lib/the_plaid_api/models/session_token_create_request.rb', line 62

def webhook
  @webhook
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
# File 'lib/the_plaid_api/models/session_token_create_request.rb', line 121

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  template_id = hash.key?('template_id') ? hash['template_id'] : nil
  client_id = hash.key?('client_id') ? hash['client_id'] : SKIP
  secret = hash.key?('secret') ? hash['secret'] : SKIP
  user = SessionTokenCreateRequestUser.from_hash(hash['user']) if hash['user']
  redirect_uri = hash.key?('redirect_uri') ? hash['redirect_uri'] : SKIP
  android_package_name =
    hash.key?('android_package_name') ? hash['android_package_name'] : SKIP
  webhook = hash.key?('webhook') ? hash['webhook'] : 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.
  SessionTokenCreateRequest.new(template_id: template_id,
                                client_id: client_id,
                                secret: secret,
                                user: user,
                                redirect_uri: redirect_uri,
                                android_package_name: android_package_name,
                                webhook: webhook,
                                user_id: user_id,
                                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/the_plaid_api/models/session_token_create_request.rb', line 72

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['client_id'] = 'client_id'
  @_hash['secret'] = 'secret'
  @_hash['template_id'] = 'template_id'
  @_hash['user'] = 'user'
  @_hash['redirect_uri'] = 'redirect_uri'
  @_hash['android_package_name'] = 'android_package_name'
  @_hash['webhook'] = 'webhook'
  @_hash['user_id'] = 'user_id'
  @_hash
end

.nullablesObject

An array for nullable fields



99
100
101
# File 'lib/the_plaid_api/models/session_token_create_request.rb', line 99

def self.nullables
  []
end

.optionalsObject

An array for optional fields



86
87
88
89
90
91
92
93
94
95
96
# File 'lib/the_plaid_api/models/session_token_create_request.rb', line 86

def self.optionals
  %w[
    client_id
    secret
    user
    redirect_uri
    android_package_name
    webhook
    user_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



164
165
166
167
168
169
170
# File 'lib/the_plaid_api/models/session_token_create_request.rb', line 164

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} client_id: #{@client_id.inspect}, secret: #{@secret.inspect}, template_id:"\
  " #{@template_id.inspect}, user: #{@user.inspect}, redirect_uri: #{@redirect_uri.inspect},"\
  " android_package_name: #{@android_package_name.inspect}, webhook: #{@webhook.inspect},"\
  " user_id: #{@user_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



155
156
157
158
159
160
161
# File 'lib/the_plaid_api/models/session_token_create_request.rb', line 155

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} client_id: #{@client_id}, secret: #{@secret}, template_id: #{@template_id},"\
  " user: #{@user}, redirect_uri: #{@redirect_uri}, android_package_name:"\
  " #{@android_package_name}, webhook: #{@webhook}, user_id: #{@user_id},"\
  " additional_properties: #{@additional_properties}>"
end