Sha256: 6357ddf06c2911ee799fae2b9aceca71f119652525b2b4886a810005fbdc2aa2

Contents?: true

Size: 936 Bytes

Versions: 2

Compression:

Stored size: 936 Bytes

Contents

require_relative 'balances'

module OldPlaid
  class Account
    attr_accessor :available_balance, :current_balance, :institution_type, :mask, :meta, :transactions, :numbers, :name, :id, :type, :subtype, :balances

    def initialize(hash)
      @id   = hash['_id']
      @name = hash['meta']['name'] if hash['meta']
      @type = hash['type']
      @meta = hash['meta']
      @mask = hash['meta']['number'] if hash['meta']
      @institution_type  = hash['institution_type']

      if hash['balance']
        @balances = Balances.new(
          available: hash['balance']['available'],
          current: hash['balance']['current']
        )
      end

      # Depository account only, "checkings" or "savings"
      # Available on live data, but not on the test data
      @subtype = hash['subtype']

      @numbers = hash['numbers'] ? hash['numbers'] : 'Upgrade user to access routing information for this account'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
old_plaid-2.7.2 lib/old_plaid/models/account.rb
old_plaid-2.7.1 lib/old_plaid/models/account.rb