Class: Plaid::LinkTokenCreateRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/models/link_token_create_request.rb

Overview

LinkTokenCreateRequest defines the request schema for ‘/link/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(client_name:, language:, country_codes:, user:, client_id: SKIP, secret: SKIP, products: SKIP, webhook: SKIP, access_token: SKIP, link_customization_name: SKIP, redirect_uri: SKIP, android_package_name: SKIP, account_filters: SKIP, eu_config: SKIP, institution_id: SKIP, payment_initiation: SKIP, deposit_switch: SKIP, income_verification: SKIP, auth: SKIP, update: SKIP, additional_properties: nil) ⇒ LinkTokenCreateRequest

Returns a new instance of LinkTokenCreateRequest.



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/plaid/models/link_token_create_request.rb', line 248

def initialize(client_name:, language:, country_codes:, user:,
               client_id: SKIP, secret: SKIP, products: SKIP, webhook: SKIP,
               access_token: SKIP, link_customization_name: SKIP,
               redirect_uri: SKIP, android_package_name: SKIP,
               account_filters: SKIP, eu_config: SKIP, institution_id: SKIP,
               payment_initiation: SKIP, deposit_switch: SKIP,
               income_verification: SKIP, auth: SKIP, update: 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
  @client_name = client_name
  @language = language
  @country_codes = country_codes
  @user = user
  @products = products unless products == SKIP
  @webhook = webhook unless webhook == SKIP
  @access_token = access_token unless access_token == SKIP
  @link_customization_name = link_customization_name unless link_customization_name == SKIP
  @redirect_uri = redirect_uri unless redirect_uri == SKIP
  @android_package_name = android_package_name unless android_package_name == SKIP
  @account_filters =  unless  == SKIP
  @eu_config = eu_config unless eu_config == SKIP
  @institution_id = institution_id unless institution_id == SKIP
  @payment_initiation = payment_initiation unless payment_initiation == SKIP
  @deposit_switch = deposit_switch unless deposit_switch == SKIP
  @income_verification = income_verification unless income_verification == SKIP
  @auth = auth unless auth == SKIP
  @update = update unless update == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#access_tokenString

The ‘access_token` associated with the Item to update, used when updating or modifying an existing `access_token`. Used when launching Link in update mode, when completing the Same-day (manual) Micro-deposit flow, or (optionally) when initializing Link as part of the Payment Initiation (UK and Europe) flow.

Returns:

  • (String)


105
106
107
# File 'lib/plaid/models/link_token_create_request.rb', line 105

def access_token
  @access_token
end

#account_filtersLinkTokenAccountFilters

By default, Link will provide limited account filtering: it will only display Institutions that are compatible with all products supplied in the ‘products` parameter of `/link/token/create`, and, if `auth` is specified in the `products` array, will also filter out accounts other than `checking` and `savings` accounts on the Account Select pane. You can further limit the accounts shown in Link by using `account_filters` to specify the account subtypes to be shown in Link. Only the specified subtypes will be shown. This filtering applies to both the Account Select view (if enabled) and the Institution Select view. Institutions that do not support the selected subtypes will be omitted from Link. To indicate that all subtypes should be shown, use the value `“all”`. If the `account_filters` filter is used, any account type for which a filter is not specified will be entirely omitted from Link. For a full list of valid types and subtypes, see the [Account schema](plaid.com/docs/api/accounts#accounts-schema). For institutions using OAuth, the filter will not affect the list of accounts shown by the bank in the OAuth window.



155
156
157
# File 'lib/plaid/models/link_token_create_request.rb', line 155

def 
  @account_filters
end

#android_package_nameString

The name of your app’s Android package. Required if using the ‘link_token` to initialize Link on Android. When creating a `link_token` for initializing Link on other platforms, this field must be left blank. 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).

Returns:

  • (String)


135
136
137
# File 'lib/plaid/models/link_token_create_request.rb', line 135

def android_package_name
  @android_package_name
end

#authLinkTokenCreateRequestAuth

Specifies options for initializing Link for use with the Auth product. This field is currently only required if using the Flexible Auth product (currently in closed beta).



188
189
190
# File 'lib/plaid/models/link_token_create_request.rb', line 188

def auth
  @auth
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)


16
17
18
# File 'lib/plaid/models/link_token_create_request.rb', line 16

def client_id
  @client_id
end

#client_nameString

The name of your application, as it should be displayed in Link. Maximum length of 30 characters.

Returns:

  • (String)


26
27
28
# File 'lib/plaid/models/link_token_create_request.rb', line 26

def client_name
  @client_name
end

#country_codesArray[CountryCode]

Specify an array of Plaid-supported country codes using the ISO-3166-1 alpha-2 country code standard. Institutions from all listed countries will be shown. Supported country codes are: ‘US`, `CA`, `ES`, `FR`, `GB`, `IE`, `NL`. If Link is launched with multiple country codes, only products that you are enabled for in all countries will be used by Link. Note that while all countries are enabled by default in Sandbox and Development, in Production only US and Canada are enabled by default. To gain access to European institutions in the Production environment, [file a product access Support ticket](dashboard.plaid.com/support/new/product-and-development/pr oduct-troubleshooting/request-product-access) via the Plaid dashboard. If you initialize with a European country code, your users will see the European consent panel during the Link flow. If using a Link customization, make sure the country codes in the customization match those specified in `country_codes`. If both `country_codes` and a Link customization are used, the value in `country_codes` may override the value in the customization. If using the Auth features Instant Match, Same-day Micro-deposits, or Automated Micro-deposits, `country_codes` must be set to `[’US’]‘.

Returns:



60
61
62
# File 'lib/plaid/models/link_token_create_request.rb', line 60

def country_codes
  @country_codes
end

#deposit_switchLinkTokenCreateRequestDepositSwitch

Specifies options for initializing Link for use with the Deposit Switch (beta) product. This field is required if ‘deposit_switch` is included in the `products` array.



176
177
178
# File 'lib/plaid/models/link_token_create_request.rb', line 176

def deposit_switch
  @deposit_switch
end

#eu_configLinkTokenEuConfig

Configuration parameters for EU flows

Returns:



159
160
161
# File 'lib/plaid/models/link_token_create_request.rb', line 159

def eu_config
  @eu_config
end

#income_verificationLinkTokenCreateRequestIncomeVerification

Specifies options for initializing Link for use with the Income (beta) product. This field is required if ‘income_verification` is included in the `products` array.



182
183
184
# File 'lib/plaid/models/link_token_create_request.rb', line 182

def income_verification
  @income_verification
end

#institution_idString

Used for certain Europe-only configurations, as well as certain legacy use cases in other regions.

Returns:

  • (String)


164
165
166
# File 'lib/plaid/models/link_token_create_request.rb', line 164

def institution_id
  @institution_id
end

#languageString

The language that Link should be displayed in. Supported languages are:

  • English (‘’en’‘)

  • French (‘’fr’‘)

  • Spanish (‘’es’‘)

  • Dutch (‘’nl’‘)

When using a Link customization, the language configured here must match the setting in the customization, or the customization will not be applied.

Returns:

  • (String)


38
39
40
# File 'lib/plaid/models/link_token_create_request.rb', line 38

def language
  @language
end

The name of the Link customization from the Plaid Dashboard to be applied to Link. If not specified, the ‘default` customization will be used. When using a Link customization, the language in the customization must match the language selected via the `language` parameter, and the countries in the customization should match the country codes selected via `country_codes`.

Returns:

  • (String)


114
115
116
# File 'lib/plaid/models/link_token_create_request.rb', line 114

def link_customization_name
  @link_customization_name
end

#payment_initiationLinkTokenCreateRequestPaymentInitiation

Specifies options for initializing Link for use with the Payment Initiation (Europe) product. This field is required if ‘payment_initiation` is included in the `products` array.



170
171
172
# File 'lib/plaid/models/link_token_create_request.rb', line 170

def payment_initiation
  @payment_initiation
end

#productsArray[Products]

List of Plaid product(s) you wish to use. If launching Link in update mode, should be omitted; required otherwise. Valid products are: ‘transactions`, `auth`, `identity`, `assets`, `investments`, `liabilities`, `payment_initiation`, `deposit_switch`, `income_verification`, `transfer` `balance` is not a valid value, the Balance product does not require explicit initalization and will automatically be initialized when any other product is initialized. Only institutions that support all requested products will be shown in Link; to maximize the number of institutions listed, it is recommended to initialize Link with the minimal product set required for your use case. Additional products can be added after Link initialization by calling the relevant endpoints. For details and exceptions, see [Choosing when to initialize products](plaid.com/docs/link/best-practices/#choosing-when-to-ini tialize-products). Note that, unless you have opted to disable Instant Match support, institutions that support Instant Match will also be shown in Link if `auth` is specified as a product, even though these institutions do not contain `auth` in their product array. In Production, you will be billed for each product that you specify when initializing Link. Note that a product cannot be removed from an Item once the Item has been initialized with that product. To stop billing on an Item for subscription-based products, such as Liabilities, Investments, and Transactions, remove the Item via `/item/remove`.

Returns:



93
94
95
# File 'lib/plaid/models/link_token_create_request.rb', line 93

def products
  @products
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 via a webview. The ‘redirect_uri` should not contain any query parameters. When used in Production or Development, must be an https URI. To specify any subdomain, use `*` as a wildcard character, e.g. `*.example.com/oauth.html`. If `android_package_name` is specified, this field should be left blank. Note that any redirect URI must also be added to the Allowed redirect URIs list in the [developer dashboard](dashboard.plaid.com/team/api).

Returns:

  • (String)


126
127
128
# File 'lib/plaid/models/link_token_create_request.rb', line 126

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)


21
22
23
# File 'lib/plaid/models/link_token_create_request.rb', line 21

def secret
  @secret
end

#updateLinkTokenCreateRequestUpdate

Specifies options for initializing Link for [update mode](plaid.com/docs/link/update-mode).



193
194
195
# File 'lib/plaid/models/link_token_create_request.rb', line 193

def update
  @update
end

#userLinkTokenCreateRequestUser

An object specifying information about the end user who will be linking their account.



65
66
67
# File 'lib/plaid/models/link_token_create_request.rb', line 65

def user
  @user
end

#webhookString

The destination URL to which any webhooks should be sent.

Returns:

  • (String)


97
98
99
# File 'lib/plaid/models/link_token_create_request.rb', line 97

def webhook
  @webhook
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/plaid/models/link_token_create_request.rb', line 283

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  client_name = hash.key?('client_name') ? hash['client_name'] : nil
  language = hash.key?('language') ? hash['language'] : nil
  country_codes = hash.key?('country_codes') ? hash['country_codes'] : nil
  user = LinkTokenCreateRequestUser.from_hash(hash['user']) if hash['user']
  client_id = hash.key?('client_id') ? hash['client_id'] : SKIP
  secret = hash.key?('secret') ? hash['secret'] : SKIP
  products = hash.key?('products') ? hash['products'] : SKIP
  webhook = hash.key?('webhook') ? hash['webhook'] : SKIP
  access_token = hash.key?('access_token') ? hash['access_token'] : SKIP
  link_customization_name =
    hash.key?('link_customization_name') ? hash['link_customization_name'] : SKIP
  redirect_uri = hash.key?('redirect_uri') ? hash['redirect_uri'] : SKIP
  android_package_name =
    hash.key?('android_package_name') ? hash['android_package_name'] : SKIP
   = LinkTokenAccountFilters.from_hash(hash['account_filters']) if
    hash['account_filters']
  eu_config = LinkTokenEuConfig.from_hash(hash['eu_config']) if hash['eu_config']
  institution_id =
    hash.key?('institution_id') ? hash['institution_id'] : SKIP
  if hash['payment_initiation']
    payment_initiation = LinkTokenCreateRequestPaymentInitiation.from_hash(hash['payment_initiation'])
  end
  deposit_switch = LinkTokenCreateRequestDepositSwitch.from_hash(hash['deposit_switch']) if
    hash['deposit_switch']
  if hash['income_verification']
    income_verification = LinkTokenCreateRequestIncomeVerification.from_hash(hash['income_verification'])
  end
  auth = LinkTokenCreateRequestAuth.from_hash(hash['auth']) if hash['auth']
  update = LinkTokenCreateRequestUpdate.from_hash(hash['update']) if hash['update']

  # 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.
  LinkTokenCreateRequest.new(client_name: client_name,
                             language: language,
                             country_codes: country_codes,
                             user: user,
                             client_id: client_id,
                             secret: secret,
                             products: products,
                             webhook: webhook,
                             access_token: access_token,
                             link_customization_name: link_customization_name,
                             redirect_uri: redirect_uri,
                             android_package_name: android_package_name,
                             account_filters: ,
                             eu_config: eu_config,
                             institution_id: institution_id,
                             payment_initiation: payment_initiation,
                             deposit_switch: deposit_switch,
                             income_verification: income_verification,
                             auth: auth,
                             update: update,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/plaid/models/link_token_create_request.rb', line 196

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['client_id'] = 'client_id'
  @_hash['secret'] = 'secret'
  @_hash['client_name'] = 'client_name'
  @_hash['language'] = 'language'
  @_hash['country_codes'] = 'country_codes'
  @_hash['user'] = 'user'
  @_hash['products'] = 'products'
  @_hash['webhook'] = 'webhook'
  @_hash['access_token'] = 'access_token'
  @_hash['link_customization_name'] = 'link_customization_name'
  @_hash['redirect_uri'] = 'redirect_uri'
  @_hash['android_package_name'] = 'android_package_name'
  @_hash['account_filters'] = 'account_filters'
  @_hash['eu_config'] = 'eu_config'
  @_hash['institution_id'] = 'institution_id'
  @_hash['payment_initiation'] = 'payment_initiation'
  @_hash['deposit_switch'] = 'deposit_switch'
  @_hash['income_verification'] = 'income_verification'
  @_hash['auth'] = 'auth'
  @_hash['update'] = 'update'
  @_hash
end

.nullablesObject

An array for nullable fields



244
245
246
# File 'lib/plaid/models/link_token_create_request.rb', line 244

def self.nullables
  []
end

.optionalsObject

An array for optional fields



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/plaid/models/link_token_create_request.rb', line 222

def self.optionals
  %w[
    client_id
    secret
    products
    webhook
    access_token
    link_customization_name
    redirect_uri
    android_package_name
    account_filters
    eu_config
    institution_id
    payment_initiation
    deposit_switch
    income_verification
    auth
    update
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/plaid/models/link_token_create_request.rb', line 363

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} client_id: #{@client_id.inspect}, secret: #{@secret.inspect}, client_name:"\
  " #{@client_name.inspect}, language: #{@language.inspect}, country_codes:"\
  " #{@country_codes.inspect}, user: #{@user.inspect}, products: #{@products.inspect},"\
  " webhook: #{@webhook.inspect}, access_token: #{@access_token.inspect},"\
  " link_customization_name: #{@link_customization_name.inspect}, redirect_uri:"\
  " #{@redirect_uri.inspect}, android_package_name: #{@android_package_name.inspect},"\
  " account_filters: #{@account_filters.inspect}, eu_config: #{@eu_config.inspect},"\
  " institution_id: #{@institution_id.inspect}, payment_initiation:"\
  " #{@payment_initiation.inspect}, deposit_switch: #{@deposit_switch.inspect},"\
  " income_verification: #{@income_verification.inspect}, auth: #{@auth.inspect}, update:"\
  " #{@update.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/plaid/models/link_token_create_request.rb', line 349

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} client_id: #{@client_id}, secret: #{@secret}, client_name: #{@client_name},"\
  " language: #{@language}, country_codes: #{@country_codes}, user: #{@user}, products:"\
  " #{@products}, webhook: #{@webhook}, access_token: #{@access_token},"\
  " link_customization_name: #{@link_customization_name}, redirect_uri: #{@redirect_uri},"\
  " android_package_name: #{@android_package_name}, account_filters: #{@account_filters},"\
  " eu_config: #{@eu_config}, institution_id: #{@institution_id}, payment_initiation:"\
  " #{@payment_initiation}, deposit_switch: #{@deposit_switch}, income_verification:"\
  " #{@income_verification}, auth: #{@auth}, update: #{@update}, additional_properties:"\
  " #{@additional_properties}>"
end