module Bitso
Public Class Methods
balance()
click to toggle source
# File lib/bitso.rb, line 48 def self.balance self.sanity_check! return Bitso::Balance.from_api end
bitcoin_deposit_address()
click to toggle source
# File lib/bitso.rb, line 66 def self.bitcoin_deposit_address # returns the deposit address self.sanity_check! address = Bitso::Net.post('/bitcoin_deposit_address') return address[1..address.length-2] end
configured?()
click to toggle source
# File lib/bitso.rb, line 85 def self.configured? self.key && self.secret && self.client_id end
order_book()
click to toggle source
# File lib/bitso.rb, line 77 def self.order_book return JSON.parse Bitso::Net.get('/order_book').to_str end
orders()
click to toggle source
# File lib/bitso.rb, line 32 def self.orders self.sanity_check! @@orders ||= Bitso::Orders.new end
sanity_check!()
click to toggle source
# File lib/bitso.rb, line 89 def self.sanity_check! unless configured? raise MissingConfigExeception.new("Bitso Gem not properly configured") end end
setup() { |self| ... }
click to toggle source
# File lib/bitso.rb, line 81 def self.setup yield self end
ticker()
click to toggle source
# File lib/bitso.rb, line 73 def self.ticker return Bitso::Ticker.from_api end
transactions()
click to toggle source
# File lib/bitso.rb, line 44 def self.transactions return Bitso::Transactions.from_api end
user_transactions()
click to toggle source
# File lib/bitso.rb, line 38 def self.user_transactions self.sanity_check! @@transactions ||= Bitso::UserTransactions.new end
withdraw_bitcoins(options = {})
click to toggle source
# File lib/bitso.rb, line 53 def self.withdraw_bitcoins(options = {}) self.sanity_check! if options[:amount].nil? || options[:address].nil? raise MissingConfigExeception.new("Required parameters not supplied, :amount, :address") end response_body = Bitso::Net.post('/bitcoin_withdrawal',options) if response_body != '"ok"' $stderr.puts "Withdraw Bitcoins Error: " + response_body return false end return true end