Class: RuBittrex::Balance

Inherits:
Object
  • Object
show all
Extended by:
ClientHelper
Includes:
Helpers
Defined in:
lib/ru_bittrex/balance.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#extract_timestamp

Constructor Details

#initialize(attrs = {}) ⇒ Balance

Returns a new instance of Balance.



8
9
10
11
12
13
14
# File 'lib/ru_bittrex/balance.rb', line 8

def initialize(attrs = {})
  @currency   = attrs["currencySymbol"]
  @total      = attrs["total"]
  @available  = attrs["available"]
  @updated_at = extract_timestamp(attrs["updatedAt"])
  @raw        = attrs
end

Instance Attribute Details

#availableObject (readonly)

Returns the value of attribute available.



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

def available
  @available
end

#currencyObject (readonly)

Returns the value of attribute currency.



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

def currency
  @currency
end

#rawObject (readonly)

Returns the value of attribute raw.



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

def raw
  @raw
end

#totalObject (readonly)

Returns the value of attribute total.



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

def total
  @total
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

Class Method Details

.all(params = {}) ⇒ Object



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

def self.all(params = {})
  collection _get('balances', params)
end

.get(currency, params = {}) ⇒ Object

TODO: check that currency exists



21
22
23
# File 'lib/ru_bittrex/balance.rb', line 21

def self.get(currency, params = {})
  new _get("balances/#{currency}", params)
end