Sha256: fe82445835b83685c201692cb334ad9db7cfc7e01c1f60b8f0fc4c96418df3dc

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

class Bitcoin::Account

  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

  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



end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bitcoin-api-0.1.1 lib/bitcoin/client/account.rb