Class: Bitcoin::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/bitcoin/client/account.rb

Class Method Summary collapse

Class Method Details

.show_balancesObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/bitcoin/client/account.rb', line 3

def self.show_balances
  request = JSON.parse RestClient::Request.new(
    :method => :get,
    :url => "#{Bitcoin::BASE}/account/balance",
    :user => ENV['API_KEY'],
    :password => ENV['SECRET'],
    :verify_ssl => false
  ).execute

  puts "Currency | Available:"
  puts "---------|-----------"
  request.each{ |e|
    puts "#{e['currency'].rjust(8)} | #{e['available']}"
    #puts "Reserved: #{e['reserved']}"
  }
end

.show_deposit_address(currency_symbol = nil) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/bitcoin/client/account.rb', line 20

def self.show_deposit_address(currency_symbol = nil)
  puts "Enter currency symbol:" if !currency_symbol
  currency_symbol = gets.strip if !currency_symbol

  request = JSON.parse RestClient::Request.new(
    :method => :get,
    :url => "#{Bitcoin::BASE}/account/crypto/address/#{currency_symbol}",
    :user => ENV['API_KEY'],
    :password => ENV['SECRET'],
    :verify_ssl => false
  ).execute
  puts ''
  puts '************************************************'
  puts "*    Address: #{request['address']}"
  puts "* Payment ID: #{request['paymentId']}"
  puts '************************************************'
end