Class used to call the SandboxPublicToken sub-product

Sections
Namespace
Methods
C
Public
Instance Public methods
create(institution_id:, initial_products:, transactions_start_date: nil, transactions_end_date: nil, webhook: nil, override_username: nil, override_password: nil, options: nil)

Creates a public token for sandbox testing.

Does a POST /sandbox/public_token/create call which can be used to generate a public_token given an institution and list of products.

institution_id

Specific institution id to generate token for.

initial_products

Products for which generated token is valid for.

webhook

webhook to associate with the item (optional).

override_username

Specific test credential username to use

override_password

Specific test credential password to use

options

Additional options to merge into API request.

Returns

Returns a SandboxCreateResponse object with a public token and item id.

# File lib/plaid/products/sandbox.rb, line 83
def create(institution_id:,
           initial_products:,
           transactions_start_date: nil,
           transactions_end_date: nil,
           webhook: nil,
           override_username: nil,
           override_password: nil,
           options: nil)

  options_payload = {}
  options_payload[:webhook] = webhook unless webhook.nil?
  txn_options = transaction_options transactions_start_date,
                                    transactions_end_date
  options_payload[:transactions] = txn_options if txn_options != {}
  unless override_username.nil?
    options_payload[:override_username] = override_username
  end
  unless override_password.nil?
    options_payload[:override_password] = override_password
  end
  options_payload = options_payload.merge(options) unless options.nil?

  post_with_auth 'sandbox/public_token/create',
                 SandboxCreateResponse,
                 institution_id: institution_id,
                 initial_products: initial_products,
                 options: options_payload
end