Method: OldPlaid::Account#initialize

Defined in:
lib/old_plaid/models/account.rb

#initialize(hash) ⇒ Account

Returns a new instance of Account.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/old_plaid/models/account.rb', line 7

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