A class encapsulating #client_id, secret, and Plaid API URL.

Sections
Methods
C
E
N
S
Public
Attributes
[RW] client_id

The String Plaid account client ID to authenticate requests.

[R] env

Plaid environment, i.e. String base URL of the API site.

E.g. 'tartan.plaid.com'.

[RW] secret

The String Plaid account secret to authenticate requests.

Class Public methods
new(env: nil, client_id: nil, secret: nil)

Construct a Client instance.

env

The Symbol (:tartan, :production), or a full String URL like 'tartan.plaid.com'.

#client_id

The String Plaid account client ID to authenticate requests.

secret

The String Plaid account secret to authenticate requests.

# File lib/plaid/client.rb, line 49
def initialize(env: nil, client_id: nil, secret: nil)
  env && self.env = env
  self.client_id = client_id
  self.secret = secret
end
Instance Public methods
client_id_configured?()

Check if #client_id is configured.

Returns

Returns true if it is.

# File lib/plaid/client.rb, line 58
def client_id_configured?
  @client_id.is_a?(String) && !@client_id.empty?
end
env=(env)

Set Plaid environment to use.

env

The Symbol (:tartan, :production), or a full String URL like 'tartan.plaid.com'.

# File lib/plaid/client.rb, line 19
def env=(env)
  case env
  when :tartan
    @env = 'https://tartan.plaid.com/'
  when :production
    @env = 'https://api.plaid.com/'
  when String
    begin
      URI.parse(env)
      @env = env
    rescue
      raise ArgumentError, 'Invalid URL in Plaid::Client.env'                                 " (#{env.inspect}). "                                 'Specify either Symbol (:tartan, :production),'                                 " or a full URL, like 'https://tartan.plaid.com'"
    end
  else
    raise ArgumentError, 'Invalid value for Plaid::Client.env'                               " (#{env.inspect}): "                               'must be :tartan, :production, or a full URL, '                               "e.g. 'https://tartan.plaid.com'"
  end
end
secret_configured?()

Check if #client_id is configured.

Returns

Returns true if it is.

# File lib/plaid/client.rb, line 65
def secret_configured?
  @secret.is_a?(String) && !@secret.empty?
end