Skip to content

abezzub/plaid-ruby

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

plaid-ruby

Ruby gem wrapper for the Plaid API. For more details, please see the full API documentation.

Installation

Plaid is available through Rubygems and can be installed via:

$ gem install plaid

or add it to your Gemfile like this:

gem 'plaid'

Usage

require 'plaid'

Global Configuration

Pop this into your enviornment file.

Plaid.config do |config|
  config.customer_id = keys[CUSTOMER_ID]
  config.secret = keys[SECRET]
end

Now create a YML file that has your CUSTOMER_ID and your SECRET provided by Plaid.

There are two different requests one can make using the gem: Call and Customer.

Call Methods

Call is anything that does not require an access_token.

  1. add_account( type , username , password , email )
    Returns a hash with keys: code, access_token, accounts, transactions all with embedded json from Plaid.
# if(code == 200) {returns {[:code => 'x'],[:access_token => 'y'],[:accounts => 'z'],[:transactions => 'a']}
# Note: 'x','y','z','a' are all formatted as json. 

Ex)
  new_account = Plaid.call.add_account("amex","plaid_test","plaid_good","test@gmail.com") 
  puts new_account[:code]
  "200"
  1. get_place( id )
    Returns a hash with keys: entity and location all with embedded json from Plaid.
# if(code == 200) {returns {[:entity => 'x'],[:location => 'y']}
# Note: 'x','y' are formatted as json. 

Ex)
  location_deets = Plaid.call.get_place("52a77fea4a2eab775f004109") 
  puts new_account[:location]["address"]
  "125 Main St"

Customer Methods

Customer defines anything that requires an access_token.

  1. mfa_step( access_token , code )
    Returns a hash with keys: code, access_token, accounts, transactions all with embedded json from Plaid.
# if(code == 200) {returns {[:code => 'x'],[:access_token => 'y'],[:accounts => 'z'],[:transactions => 'a']}
# Note: 'x','y','z','a' are all formatted as json. 

Ex)
  new_account = Plaid.customer.mfa_step("test","tomato") 
  puts new_account[:code]
  "200"
  1. get_transactions( access_token )
    Returns a hash with key transaction
# if(code == 200) {returns {[:transaction => 'x']}
# Note: 'x' is formatted as json. 

Ex)
  transactions = Plaid.customer.get_transactions("test") 
  puts transactions[:transactions][1]["amount"]
  1334.99
  1. delete_account( access_token )
    Returns a hash with key code
Ex)
  message = Plaid.customer.delete_account("test") 
  puts message[:code]
  "200"

Requirements

  • Ruby 2.0.0 or higher

About

Ruby bindings for Plaid

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%