Sha256: c5750a733e5e2291b5d7f9b0010fff940099d2edc8087d3c36b769f9b63e31af

Contents?: true

Size: 952 Bytes

Versions: 1

Compression:

Stored size: 952 Bytes

Contents

require_relative 'balances'

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

    def initialize(hash)
      @account_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

1 entries across 1 versions & 1 rubygems

Version Path
old_plaid-2.8.2 lib/old_plaid/models/account.rb