A class encapsulating #client_id, secret, and Plaid API URL.
[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. |
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.
Source: show
# 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
Source: show
# File lib/plaid/client.rb, line 58 def client_id_configured? @client_id.is_a?(String) && !@client_id.empty? end
Set Plaid environment to use.
- env
-
The Symbol (:tartan, :production), or a full String URL like 'tartan.plaid.com'.
Source: show
# 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