class Plaid::Client::Base
Attributes
access_token[RW]
email[RW]
endpoint[RW]
institution[RW]
is_mfa_initialized[RW]
mfa_message[RW]
mfa_response[RW]
mfa_type[RW]
password[RW]
secret[RW]
username[RW]
Public Class Methods
new(user, e_mail, pass_word, institution, access_token=nil)
click to toggle source
# File lib/plaid/client/client.rb, line 25 def initialize(user, e_mail, pass_word, institution, access_token=nil) self.username = user self.email = e_mail self.password = pass_word self.institution = institution self.access_token = access_token unless access_token.blank? self.mfa_response ||= [] puts "Plaid-kilt being raised" end
Public Instance Methods
handle(response) { |response| ... }
click to toggle source
generic method for handling the structure of the response. Only creates an error object if there is an error (business error) from Plaid.com. Yields to the block with calling function
# File lib/plaid/client/client.rb, line 48 def handle(response) if response.code.eql? 200 self.mfa_type = nil self.mfa_message = nil self.is_mfa_initialized = false yield(response) if block_given? elsif response.code.eql? 201 #mfa mfa_201 = PlaidResponse.new(response, "MFA") self.access_token = mfa_201.access_token self.mfa_type = mfa_201.raw_response.type self.mfa_response << mfa_201 self.mfa_message = mfa_201.message self.is_mfa_initialized = mfa_201.is_mfa? mfa_201 else PlaidError.new(response, "Error") end end
is_mfa?()
click to toggle source
# File lib/plaid/client/client.rb, line 74 def is_mfa? @is_mfa_initialized end
plaid_response_codes()
click to toggle source
# File lib/plaid/client/client.rb, line 78 def plaid_response_codes { 200 => "Success", 201 => "MFA Required", 400 => "Bad Request", 401 => "Unauthorized", 402 => "Request Failed", 404 => "Cannot be Found", 500 => "Server Error" } end
secrets(client_id, secret)
click to toggle source
for testing through IRB
# File lib/plaid/client/client.rb, line 68 def secrets(client_id, secret) self.client_id = client_id self.secret = secret "Set" end
settings()
click to toggle source
# File lib/plaid/client/client.rb, line 37 def settings puts "Base URI: " + endpoint.to_s puts "Cert: " + certpath.to_s puts "User: " + self.username.to_s puts "Email: " + self.email.to_s puts "Plaid Client_id: " + self.client_id.to_s puts "Webhook address: " + webhook_address puts "Save full response: " + save_full_response.to_s end