Class: BanksApi::BankAccount
- Inherits:
-
Object
- Object
- BanksApi::BankAccount
- Defined in:
- lib/banks_api/bank_account.rb
Instance Attribute Summary collapse
-
#balance ⇒ Object
readonly
Returns the value of attribute balance.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
-
#initialize(id:, description:, currency:, balance:) ⇒ BankAccount
constructor
A new instance of BankAccount.
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
#balance ⇒ Object (readonly)
Returns the value of attribute balance.
8 9 10 |
# File 'lib/banks_api/bank_account.rb', line 8 def balance @balance end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
8 9 10 |
# File 'lib/banks_api/bank_account.rb', line 8 def currency @currency end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
8 9 10 |
# File 'lib/banks_api/bank_account.rb', line 8 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/banks_api/bank_account.rb', line 8 def id @id end |