Class: OldPlaid::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/old_plaid/models/account.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#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

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



5
6
7
# File 'lib/old_plaid/models/account.rb', line 5

def 
  @account_id
end

#available_balanceObject

Returns the value of attribute available_balance.



5
6
7
# File 'lib/old_plaid/models/account.rb', line 5

def available_balance
  @available_balance
end

#balancesObject

Returns the value of attribute balances.



5
6
7
# File 'lib/old_plaid/models/account.rb', line 5

def balances
  @balances
end

#current_balanceObject

Returns the value of attribute current_balance.



5
6
7
# File 'lib/old_plaid/models/account.rb', line 5

def current_balance
  @current_balance
end

#institution_typeObject

Returns the value of attribute institution_type.



5
6
7
# File 'lib/old_plaid/models/account.rb', line 5

def institution_type
  @institution_type
end

#maskObject

Returns the value of attribute mask.



5
6
7
# File 'lib/old_plaid/models/account.rb', line 5

def mask
  @mask
end

#metaObject

Returns the value of attribute meta.



5
6
7
# File 'lib/old_plaid/models/account.rb', line 5

def meta
  @meta
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/old_plaid/models/account.rb', line 5

def name
  @name
end

#numbersObject

Returns the value of attribute numbers.



5
6
7
# File 'lib/old_plaid/models/account.rb', line 5

def numbers
  @numbers
end

#subtypeObject

Returns the value of attribute subtype.



5
6
7
# File 'lib/old_plaid/models/account.rb', line 5

def subtype
  @subtype
end

#transactionsObject

Returns the value of attribute transactions.



5
6
7
# File 'lib/old_plaid/models/account.rb', line 5

def transactions
  @transactions
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/old_plaid/models/account.rb', line 5

def type
  @type
end