Module: Plaid

Defined in:
lib/plaid.rb,
lib/plaid/info.rb,
lib/plaid/risk.rb,
lib/plaid/user.rb,
lib/plaid/client.rb,
lib/plaid/errors.rb,
lib/plaid/income.rb,
lib/plaid/account.rb,
lib/plaid/version.rb,
lib/plaid/webhook.rb,
lib/plaid/category.rb,
lib/plaid/connector.rb,
lib/plaid/institution.rb,
lib/plaid/transaction.rb

Overview

Public: The Plaid namespace.

Defined Under Namespace

Classes: Account, BadRequestError, Category, Client, Connector, Income, Info, Institution, NotConfiguredError, NotFoundError, Page, PlaidError, RequestFailedError, Risk, SearchResultInstitution, ServerError, Transaction, UnauthorizedError, User, Webhook

Constant Summary collapse

PRODUCTS =

Public: Available Plaid products.

%i(connect auth info income risk).freeze
VERSION =
'3.0.0'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.clientObject

Public: The default Client.



22
23
24
# File 'lib/plaid.rb', line 22

def client
  @client
end

.read_timeoutObject

Public: The Integer read timeout for requests to Plaid HTTP API. Should be specified in seconds. Default value is 120 (2 minutes).



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

def read_timeout
  @read_timeout
end

Class Method Details

.config {|client| ... } ⇒ Object

Public: A helper function to ease configuration.

Yields self.

Examples

Plaid.configure do |p|
  p.client_id = 'Plaid provided client ID here'
  p.secret = 'Plaid provided secret key here'
  p.env = :tartan
  p.read_timeout = 300   # it's 5 minutes, yay!
end

Returns nothing.

Yields:



42
43
44
45
46
# File 'lib/plaid.rb', line 42

def config
  client = Client.new
  yield client
  self.client = client
end

.symbolize_hash(hash, values: false) ⇒ Object

Internal: Symbolize keys (and values) for a hash.

hash - The Hash with string keys (or nil). values - The Boolean flag telling the function to symbolize values

as well.

Returns a Hash with keys.to_sym (or nil if hash is nil).



55
56
57
58
59
60
61
62
# File 'lib/plaid.rb', line 55

def symbolize_hash(hash, values: false)
  return unless hash
  return hash.map { |h| symbolize_hash(h) } if hash.is_a?(Array)

  hash.each_with_object({}) do |(k, v), memo|
    memo[k.to_sym] = values ? v.to_sym : v
  end
end