Sha256: 53f5072387daa641bb6b0171adf52e3b9140b2f17b25da9c9bac7659591ee07f

Contents?: true

Size: 925 Bytes

Versions: 4

Compression:

Stored size: 925 Bytes

Contents

require 'plaid/util'
module Plaid
  class Account
    include Plaid::Util
    # Define vars for user accounts
    attr_accessor(:available_balance, :current_balance, :institution_type, :meta, :transactions, :numbers, :name, :id, :type)

    # Instantiate a new account with the results of the successful API call
    # Build an array of nested transactions, and return self if successful
    def new(res)
      begin
        self.name = res['name'], self.available_balance = res['balance']['available'], self.current_balance = res['balance']['current'], self.institution_type = res['institution_type'], self.id = res['_id'], self.type = res['type']
        self.meta = res['meta'] if res['meta']
        res['numbers'] ? self.numbers = res['numbers'] : self.numbers = 'Upgrade user to access routing information for this account'
      rescue => e
        error_handler(e)
      else
        self
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
plaid-1.1.2 lib/plaid/user/account/account.rb
plaid-1.2.1 lib/plaid/user/account/account.rb
plaid-1.2.0 lib/plaid/user/account/account.rb
plaid-1.1.1 lib/plaid/user/account/account.rb