Module: Plaid::Client::Logins

Includes:
Configurations
Included in:
Base
Defined in:
lib/plaid/client/connect.rb

Instance Method Summary collapse

Instance Method Details

#connectPlaidResponse

connects to the plaid api. this can be used to retrieve information, get the access token, and initialize a user. sets the access token on the Base

Returns:



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/plaid/client/connect.rb', line 10

def connect
  body = body_original

  response = self.class.post('/connect', :query => body)

  handle(response) do |r|
    plaid = PlaidResponse.new(r, "Successful retrieved information from bank")
    self.access_token = plaid.access_token
    plaid
  end
end

#connect_delete_userObject



72
73
74
75
76
77
78
79
80
# File 'lib/plaid/client/connect.rb', line 72

def connect_delete_user
  if self.access_token.present?
    body = body_delete_user
    response = self.class.delete('/connect', :query => body)
    handle(response) { PlaidResponse.new(response, "Deleted user")}
  else
    PlaidError.new(nil, "Need to initialize the client with an access token so user can be deleted")
  end
end

#connect_filter_responseObject



51
52
53
# File 'lib/plaid/client/connect.rb', line 51

def connect_filter_response

end

#connect_init_userObject

Plaid’s preferred way to initialize a user to their bank via the Plaid Proxy.



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

def connect_init_user
  body = body_init_user
  response = self.class.post('/connect', :query => body)

  handle(response) { PlaidResponse.new(response, "Successfully added user; Wait on Webhook Response") }
end

#connect_step(mfa_response) ⇒ PlaidResponse

The basic way to submit MFA information to Plaid. Simply appends the answer into the parameters for submission.

Returns:



25
26
27
28
29
30
# File 'lib/plaid/client/connect.rb', line 25

def connect_step(mfa_response)
  body = body_mfa(mfa_response)
  response = self.class.post('/connect/step', :query => body)

  handle(response) { PlaidResponse.new(response, "Successful MFA submission - retrieved information from bank") }
end

#connect_step_specify_mode(mode) ⇒ Object



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

def connect_step_specify_mode(mode)
  body = body_mfa_mode(mode)
  response = self.class.post('/connect/step', :query => body)
  handle(response) { PlaidResponse.new(response, "Successful MFA mode submission - You will now be asked to
input your code.") }
end

#connect_step_webhook(mfa_response) ⇒ PlaidResponse

Submits an MFA answer to Plaid. Adds a webhook return address as a parameter.

Returns:



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

def connect_step_webhook(mfa_response)
  body = body_mfa_webhook(mfa_response)
  response = self.class.post('/connect/step', :query => body)

  handle(response) { PlaidResponse.new(response, "Successful MFA submission - Webhook will notify when retrieved information from bank") }
end

#connect_update_credentialsObject



62
63
64
65
66
67
68
69
70
# File 'lib/plaid/client/connect.rb', line 62

def connect_update_credentials
  if self.access_token.present?
    body = body_update_credentials
    response = self.class.patch('/connect', :query => body)
    handle(response) { PlaidResponse.new(response, "Successfully updated credentials")}
  else
    PlaidError.new(nil, "Need to initialize the client with an access token")
  end
end