module Plaid::Client::Bodies

Public Instance Methods

body() click to toggle source

Used before the organization is obtained and chosen by the user

# File lib/plaid/client/body.rb, line 7
def body
  {
      :client_id => self.client_id,
      :secret => self.secret
  }
end
body_delete_user() click to toggle source
# File lib/plaid/client/body.rb, line 44
def body_delete_user
  ret = Hash.new
  ret[:access_token] = self.access_token
  ret.merge(body)
end
body_entity(entity_id) click to toggle source

simple hash providing the entity_id to plaid.

# File lib/plaid/client/body.rb, line 73
def body_entity(entity_id)
  {
    :entity_id => entity_id,
    :options => {"pretty"=>"true"}
  }
end
body_init_user() click to toggle source
# File lib/plaid/client/body.rb, line 105
def body_init_user
  ret = body_original
  z = {"login" => true, "webhook" => webhook_address}
  ret[:options] = body_original[:options].merge(z)
  ret
end
body_mfa(answer) click to toggle source

adds an mfa answer to the body. based on {#body}

# File lib/plaid/client/body.rb, line 82
def body_mfa(answer)
  ret = Hash.new
  ret[:mfa] = answer.to_s
  ret[:access_token] = self.access_token
  ret[:type] = self.institution
  ret.merge(body)
end
body_mfa_mode(mode) click to toggle source
# File lib/plaid/client/body.rb, line 97
def body_mfa_mode(mode)
  ret = Hash.new
  ret[:options] = options(nil, "send_method", mode)
  ret[:access_token] = self.access_token
  ret[:type] = self.institution
  ret.merge(body)
end
body_mfa_webhook(answer) click to toggle source

adds a webhook address to {#body_mfa}

# File lib/plaid/client/body.rb, line 91
def body_mfa_webhook(answer)
  ret = Hash.new
  ret[:options] = options(nil,"webhook", webhook_address )
  ret.merge(body_mfa(answer))
end
body_original() click to toggle source

the fundamental body object used in most calls to Plaid.

  • client_id

  • secret

  • institution_type

  • credentials

  • email

  • options {“list”:true}

# File lib/plaid/client/body.rb, line 57
def body_original
  ret = Hash.new
  ret[:type] = self.institution
  ret[:credentials] = credentials
  ret[:email] = self.email
  ret[:options] = {"list" => true}
  ret.merge(body)
end
body_retrieve() click to toggle source

For accessing balances associated with an access_token via a GET

  • client_id

  • secret

  • access_token

  • institution type

  • email of the user

# File lib/plaid/client/body.rb, line 20
def body_retrieve
  ret = Hash.new
  ret[:access_token] = self.access_token
  ret[:type] = self.institution
  ret[:email] = self.email
  ret.merge(body)
end
body_test() click to toggle source
# File lib/plaid/client/body.rb, line 66
def body_test
  ret = hash.new
  ret[:options] = options(nil,"pretty","true")
  ret.merge(body_original)
end
body_update_credentials() click to toggle source
# File lib/plaid/client/body.rb, line 36
def body_update_credentials
  ret = Hash.new
  ret[:access_token] = self.access_token
  ret[:credentials] = credentials
  ret[:type] = self.institution
  ret.merge(body)
end
credentials() click to toggle source

Structure to proxy credentials to Plaid for access to the financial institution

# File lib/plaid/client/body.rb, line 29
def credentials
  {
      "username" => self.username,
      "password" => self.password
  }
end
options(original_hash=nil, key, value) click to toggle source

helper method to add options to an option hash

# File lib/plaid/client/body.rb, line 113
def options(original_hash=nil, key, value)
  j = Hash.new
  j[key] = value
  j.merge(original_hash) unless original_hash.nil?
  j
end