Module: Bitso::Net
- Defined in:
- lib/bitso/net.rb
Class Method Summary collapse
- .bitso_options(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
.bitso_options(options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/bitso/net.rb', line 23 def self.(={}) if Bitso.configured? [:key] = Bitso.key [:nonce] = (Time.now.to_f*10000).to_i.to_s joint_string = ([:nonce] + Bitso.client_id.to_s + [:key]) [:signature] = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), Bitso.secret, joint_string).upcase end end |
.delete(path, options = {}) ⇒ Object
19 20 21 |
# File 'lib/bitso/net.rb', line 19 def self.delete(path, ={}) RestClient.delete(self.to_uri(path), self.()) end |
.get(path, options = {}) ⇒ Object
7 8 9 |
# File 'lib/bitso/net.rb', line 7 def self.get(path, ={}) RestClient.get(self.to_uri(path)) end |
.patch(path, options = {}) ⇒ Object
15 16 17 |
# File 'lib/bitso/net.rb', line 15 def self.patch(path, ={}) RestClient.put(self.to_uri(path), self.()) end |
.post(path, options = {}) ⇒ Object
11 12 13 |
# File 'lib/bitso/net.rb', line 11 def self.post(path, ={}) RestClient.post(self.to_uri(path), self.()) end |
.to_uri(path) ⇒ Object
3 4 5 |
# File 'lib/bitso/net.rb', line 3 def self.to_uri(path) return "https://api.bitso.com/v2#{path}/" end |