Sha256: 9495b72de3c89a7acd918879f5464192635bb09bcc5fc6d6bd5bfb39e7dad5e6

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

LINK_TOKEN_FIELD_NAMES = %i[
  user
  client_name
  products
  country_codes
  language
  webhook
  access_token
  link_customization_name
  redirect_uri
  android_package_name
  account_filters
  cross_app_item_add
  payment_initiation
  institution_id
].freeze

module Plaid
  # Public: Class used to call the LinkToken sub-product.
  class LinkToken < BaseProduct
    def create(configs)
      body = {}

      LINK_TOKEN_FIELD_NAMES.each do |field|
        body[field] = configs[field]
      end

      post_with_auth 'link/token/create',
                     CreateResponse,
                     body
    end

    def get(link_token)
      post_with_auth 'link/token/get',
                     GetResponse,
                     link_token: link_token
    end
  end

  # Public: Response for /link/token/create.
  class CreateResponse < Models::BaseResponse
    ##
    # :attr_reader:
    # Public: The String token.
    property :link_token

    ##
    # :attr_reader:
    # Public: The String token expiration time.
    property :expiration
  end

  # Public: Response for /link/token/get.
  class GetResponse < Models::BaseResponse
    ##
    # :attr_reader:
    # Public: The String token.
    property :link_token

    ##
    # :attr_reader:
    # Public: The link token expiration time.
    property :expiration

    ##
    # :attr_reader:
    # Public: The link token created time.
    property :created_at

    ##
    # :attr_reader:
    # Public: The metadata associated with the link token.
    property :metadata, coerce: Models::LinkTokenMetadata
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
plaid-11.1.1 lib/plaid/products/link_token.rb