Class: Plaid::Client::ThinClient

Inherits:
Object
  • Object
show all
Includes:
HTTParty, Balances, Bodies, Configurations, Entities, Followups
Defined in:
lib/plaid/client/thin_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Followups

#followup

Methods included from Balances

#get_balance

Methods included from Entities

#get_entity

Methods included from Bodies

#body, #body_delete_user, #body_entity, #body_init_user, #body_mfa, #body_mfa_mode, #body_mfa_webhook, #body_original, #body_retrieve, #body_test, #body_update_credentials, #credentials, #options

Constructor Details

#initialize(e_mail, institution, access_token) ⇒ ThinClient

Returns a new instance of ThinClient.



29
30
31
32
33
# File 'lib/plaid/client/thin_client.rb', line 29

def initialize(e_mail, institution, access_token)
  self.email = e_mail
  self.institution = institution
  self.access_token = access_token
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



5
6
7
# File 'lib/plaid/client/thin_client.rb', line 5

def access_token
  @access_token
end

#client_idObject

Returns the value of attribute client_id.



5
6
7
# File 'lib/plaid/client/thin_client.rb', line 5

def client_id
  @client_id
end

#emailObject

Returns the value of attribute email.



5
6
7
# File 'lib/plaid/client/thin_client.rb', line 5

def email
  @email
end

#endpointObject

Returns the value of attribute endpoint.



5
6
7
# File 'lib/plaid/client/thin_client.rb', line 5

def endpoint
  @endpoint
end

#institutionObject

Returns the value of attribute institution.



5
6
7
# File 'lib/plaid/client/thin_client.rb', line 5

def institution
  @institution
end

#secretObject

Returns the value of attribute secret.



5
6
7
# File 'lib/plaid/client/thin_client.rb', line 5

def secret
  @secret
end

Instance Method Details

#handle(response) ⇒ Object

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



52
53
54
55
56
57
58
# File 'lib/plaid/client/thin_client.rb', line 52

def handle(response)
  if response.code.eql? 200
    yield(response) if block_given?
  else
    PlaidError.new(response, "Error")
  end
end

#secrets(client_id, secret) ⇒ Object

for testing through IRB



36
37
38
39
40
# File 'lib/plaid/client/thin_client.rb', line 36

def secrets(client_id, secret)
  self.client_id = client_id
  self.secret = secret
  "Set"
end

#settingsObject



42
43
44
45
46
47
48
49
# File 'lib/plaid/client/thin_client.rb', line 42

def settings
  puts "Base URI: " + endpoint.to_s
  puts "Cert: " + certpath.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