Class: Buda::Balance
- Inherits:
-
Object
- Object
- Buda::Balance
- Defined in:
- lib/buda/resources/balance.rb
Overview
for handling the total balance
Instance Attribute Summary collapse
-
#available ⇒ Object
readonly
Returns the value of attribute available.
-
#current ⇒ Object
readonly
Returns the value of attribute current.
-
#frozen ⇒ Object
readonly
Returns the value of attribute frozen.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#pending ⇒ Object
readonly
Returns the value of attribute pending.
Instance Method Summary collapse
-
#initialize(id:, available_amount:, amount:, frozen_amount:, pending_withdraw_amount:) ⇒ Balance
constructor
A new instance of Balance.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(id:, available_amount:, amount:, frozen_amount:, pending_withdraw_amount:) ⇒ Balance
Returns a new instance of Balance.
8 9 10 11 12 13 14 |
# File 'lib/buda/resources/balance.rb', line 8 def initialize(id:, available_amount:, amount:, frozen_amount:, pending_withdraw_amount:, **) @id = id @available = available_amount[0] @current = amount[0] @frozen = frozen_amount[0] @pending = pending_withdraw_amount[0] end |
Instance Attribute Details
#available ⇒ Object (readonly)
Returns the value of attribute available.
6 7 8 |
# File 'lib/buda/resources/balance.rb', line 6 def available @available end |
#current ⇒ Object (readonly)
Returns the value of attribute current.
6 7 8 |
# File 'lib/buda/resources/balance.rb', line 6 def current @current end |
#frozen ⇒ Object (readonly)
Returns the value of attribute frozen.
6 7 8 |
# File 'lib/buda/resources/balance.rb', line 6 def frozen @frozen end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/buda/resources/balance.rb', line 6 def id @id end |
#pending ⇒ Object (readonly)
Returns the value of attribute pending.
6 7 8 |
# File 'lib/buda/resources/balance.rb', line 6 def pending @pending end |
Instance Method Details
#inspect ⇒ Object
20 21 22 |
# File 'lib/buda/resources/balance.rb', line 20 def inspect "<Balance #{@current} (#{@available})>" end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/buda/resources/balance.rb', line 16 def to_s "#{id}: #{@current} (#{@available})" end |