Module: Bitso
- Defined in:
- lib/bitso.rb,
lib/bitso/net.rb,
lib/bitso/model.rb,
lib/bitso/helper.rb,
lib/bitso/orders.rb,
lib/bitso/ticker.rb,
lib/bitso/collection.rb,
lib/bitso/transactions.rb
Defined Under Namespace
Modules: Helper, Net
Classes: Collection, MissingConfigExeception, Model, Order, Orders, Ticker, Transactions, UserTransaction, UserTransactions
Constant Summary
collapse
- @@currency =
:mxn
Class Method Summary
collapse
Class Method Details
.balance ⇒ Object
47
48
49
50
51
|
# File 'lib/bitso.rb', line 47
def self.balance
self.sanity_check!
JSON.parse Bitso::Net.post('/balance').to_str
end
|
.bitcoin_deposit_address ⇒ Object
65
66
67
68
69
|
# File 'lib/bitso.rb', line 65
def self.bitcoin_deposit_address
self.sanity_check!
return Bitso::Net.post('/bitcoin_deposit_address').body_str
end
|
88
89
90
|
# File 'lib/bitso.rb', line 88
def self.configured?
self.key && self.secret && self.client_id
end
|
.order_book ⇒ Object
80
81
82
|
# File 'lib/bitso.rb', line 80
def self.order_book
return JSON.parse Bitso::Net.get('/order_book').to_str
end
|
.orders ⇒ Object
31
32
33
34
35
|
# File 'lib/bitso.rb', line 31
def self.orders
self.sanity_check!
@@orders ||= Bitso::Orders.new
end
|
.sanity_check! ⇒ Object
92
93
94
95
96
|
# File 'lib/bitso.rb', line 92
def self.sanity_check!
unless configured?
raise MissingConfigExeception.new("Bitso Gem not properly configured")
end
end
|
.setup {|_self| ... } ⇒ Object
84
85
86
|
# File 'lib/bitso.rb', line 84
def self.setup
yield self
end
|
.unconfirmed_user_deposits ⇒ Object
71
72
73
74
|
# File 'lib/bitso.rb', line 71
def self.unconfirmed_user_deposits
self.sanity_check!
return JSON.parse Bitso::Net::post("/unconfirmed_btc").body_str
end
|
.user_transactions ⇒ Object
37
38
39
40
41
|
# File 'lib/bitso.rb', line 37
def self.user_transactions
self.sanity_check!
@@transactions ||= Bitso::UserTransactions.new
end
|
.withdraw_bitcoins(options = {}) ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
|
# 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).body_str
if response_body != 'true'
return JSON.parse response_body
else
return response_body
end
end
|