Class: Vertpig::Wallet

Inherits:
Object
  • Object
show all
Defined in:
lib/vertpig/wallet.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Wallet

Returns a new instance of Wallet.



5
6
7
8
9
10
11
12
13
14
# File 'lib/vertpig/wallet.rb', line 5

def initialize(attrs = {})
  @id = attrs['Uuid'].to_s
  @address = attrs['CryptoAddress']
  @currency = attrs['Currency']
  @balance = attrs['Balance']
  @available = attrs['Available']
  @pending = attrs['Pending']
  @raw = attrs
  @requested = attrs['Requested']
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



3
4
5
# File 'lib/vertpig/wallet.rb', line 3

def address
  @address
end

#availableObject (readonly)

Returns the value of attribute available.



3
4
5
# File 'lib/vertpig/wallet.rb', line 3

def available
  @available
end

#balanceObject (readonly)

Returns the value of attribute balance.



3
4
5
# File 'lib/vertpig/wallet.rb', line 3

def balance
  @balance
end

#currencyObject (readonly)

Returns the value of attribute currency.



3
4
5
# File 'lib/vertpig/wallet.rb', line 3

def currency
  @currency
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/vertpig/wallet.rb', line 3

def id
  @id
end

#pendingObject (readonly)

Returns the value of attribute pending.



3
4
5
# File 'lib/vertpig/wallet.rb', line 3

def pending
  @pending
end

#rawObject (readonly)

Returns the value of attribute raw.



3
4
5
# File 'lib/vertpig/wallet.rb', line 3

def raw
  @raw
end

#requestedObject (readonly)

Returns the value of attribute requested.



3
4
5
# File 'lib/vertpig/wallet.rb', line 3

def requested
  @requested
end

Class Method Details

.allObject



16
17
18
# File 'lib/vertpig/wallet.rb', line 16

def self.all
  client.get('account/getbalances').map{|data| new(data) }
end

.balance(currency) ⇒ Object



20
21
22
23
24
# File 'lib/vertpig/wallet.rb', line 20

def self.balance(currency)
  client.get('account/getbalance', {
    currency: currency
  })
end