Module: Bitstamp::Net
- Defined in:
- lib/bitstamp/net.rb
Class Method Summary collapse
- .curl(verb, path, options = {}) ⇒ Object
- .delete(path, options = {}) ⇒ Object
- .get(path, options = {}) ⇒ Object
- .patch(path, options = {}) ⇒ Object
- .post(path, options = {}) ⇒ Object
- .to_uri(path) ⇒ Object
Class Method Details
.curl(verb, path, options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/bitstamp/net.rb', line 7 def self.curl(verb, path, ={}) verb = verb.upcase.to_sym c = Curl::Easy.new(self.to_uri(path)) 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 c.post_body = .to_query c.http(verb) return c end |
.delete(path, options = {}) ⇒ Object
43 44 45 46 47 |
# File 'lib/bitstamp/net.rb', line 43 def self.delete(path, ={}) request = self.curl(:DELETE, path, ) return request end |
.get(path, options = {}) ⇒ Object
25 26 27 28 29 |
# File 'lib/bitstamp/net.rb', line 25 def self.get(path, ={}) request = self.curl(:GET, path, ) return request end |
.patch(path, options = {}) ⇒ Object
37 38 39 40 41 |
# File 'lib/bitstamp/net.rb', line 37 def self.patch(path, ={}) request = self.curl(:PATCH, path, ) return request end |
.post(path, options = {}) ⇒ Object
31 32 33 34 35 |
# File 'lib/bitstamp/net.rb', line 31 def self.post(path, ={}) request = self.curl(:POST, path, ) return request end |
.to_uri(path) ⇒ Object
3 4 5 |
# File 'lib/bitstamp/net.rb', line 3 def self.to_uri(path) return "https://www.bitstamp.net/api#{path}/" end |