Module: Bitstamp::Net
- Defined in:
- lib/bitstamp/net.rb
Class Method Summary collapse
- .bitstamp_options(options = {}) ⇒ Object
- .delete(path, options = {}) ⇒ Object
- .get(path, options = {}) ⇒ Object
- .patch(path, options = {}) ⇒ Object
- .post(path, options = {}) ⇒ Object
- .rest(path, method = :get, options = {}) ⇒ Object
- .to_uri(path) ⇒ Object
Class Method Details
.bitstamp_options(options = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/bitstamp/net.rb', line 24 def self.(={}) if Bitstamp.configured? [:key] = Bitstamp.key [:nonce] = (Time.now.to_f*10000).to_i.to_s [:signature] = HMAC::SHA256.hexdigest(Bitstamp.secret, [:nonce]+Bitstamp.client_id.to_s+[:key]).upcase end end |
.delete(path, options = {}) ⇒ Object
20 21 22 |
# File 'lib/bitstamp/net.rb', line 20 def self.delete(path, ={}) rest path, :delete, () end |
.get(path, options = {}) ⇒ Object
8 9 10 |
# File 'lib/bitstamp/net.rb', line 8 def self.get(path, ={}) rest path end |
.patch(path, options = {}) ⇒ Object
16 17 18 |
# File 'lib/bitstamp/net.rb', line 16 def self.patch(path, ={}) rest path, :put, () end |
.post(path, options = {}) ⇒ Object
12 13 14 |
# File 'lib/bitstamp/net.rb', line 12 def self.post(path, ={}) rest path, :post, () end |
.rest(path, method = :get, options = {}) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/bitstamp/net.rb', line 34 def self.rest(path, method=:get, ={}) RestClient::Request.execute( method: method, url: to_uri(path), payload: , ssl_version: 'SSLv23' ) end |
.to_uri(path) ⇒ Object
4 5 6 |
# File 'lib/bitstamp/net.rb', line 4 def self.to_uri(path) "https://www.bitstamp.net/api#{path}/" end |