Class: BanksApi::BankAccount

Inherits:
Object
  • Object
show all
Defined in:
lib/banks_api/bank_account.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, description:, currency:, balance:) ⇒ BankAccount



10
11
12
13
14
15
# File 'lib/banks_api/bank_account.rb', line 10

def initialize(id:, description:, currency:, balance:)
  @id = id
  @description = description
  @currency = Money::Currency.find(currency)
  @balance = Money.from_amount(balance, @currency)
end

Instance Attribute Details

#balanceObject (readonly)

Returns the value of attribute balance.



8
9
10
# File 'lib/banks_api/bank_account.rb', line 8

def balance
  @balance
end

#currencyObject (readonly)

Returns the value of attribute currency.



8
9
10
# File 'lib/banks_api/bank_account.rb', line 8

def currency
  @currency
end

#descriptionObject (readonly)

Returns the value of attribute description.



8
9
10
# File 'lib/banks_api/bank_account.rb', line 8

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/banks_api/bank_account.rb', line 8

def id
  @id
end