Class: Buda::Balance

Inherits:
Object
  • Object
show all
Defined in:
lib/buda/resources/balance.rb

Overview

for handling the total balance

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#availableObject (readonly)

Returns the value of attribute available.



6
7
8
# File 'lib/buda/resources/balance.rb', line 6

def available
  @available
end

#currentObject (readonly)

Returns the value of attribute current.



6
7
8
# File 'lib/buda/resources/balance.rb', line 6

def current
  @current
end

#frozenObject (readonly)

Returns the value of attribute frozen.



6
7
8
# File 'lib/buda/resources/balance.rb', line 6

def frozen
  @frozen
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/buda/resources/balance.rb', line 6

def id
  @id
end

#pendingObject (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

#inspectObject



20
21
22
# File 'lib/buda/resources/balance.rb', line 20

def inspect
  "<Balance #{@current} (#{@available})>"
end

#to_sObject



16
17
18
# File 'lib/buda/resources/balance.rb', line 16

def to_s
  "#{id}: #{@current} (#{@available})"
end