module Bitso::Net

Public Class Methods

bitso_options(options={}) click to toggle source
# File lib/bitso/net.rb, line 23
def self.bitso_options(options={})
  if Bitso.configured?
    options[:key] = Bitso.key
    options[:nonce] = (Time.now.to_f*10000).to_i.to_s
    joint_string = (options[:nonce] + Bitso.client_id.to_s + options[:key])
    options[:signature] = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), Bitso.secret, joint_string).upcase
  end

  options
end
delete(path, options={}) click to toggle source
# File lib/bitso/net.rb, line 19
def self.delete(path, options={})
  RestClient.delete(self.to_uri(path), self.bitso_options(options))
end
get(path, options={}) click to toggle source
# File lib/bitso/net.rb, line 7
def self.get(path, options={})
  RestClient.get(self.to_uri(path))
end
patch(path, options={}) click to toggle source
# File lib/bitso/net.rb, line 15
def self.patch(path, options={})
  RestClient.put(self.to_uri(path), self.bitso_options(options))
end
post(path, options={}) click to toggle source
# File lib/bitso/net.rb, line 11
def self.post(path, options={})
  RestClient.post(self.to_uri(path), self.bitso_options(options))
end
to_uri(path) click to toggle source
# File lib/bitso/net.rb, line 3
def self.to_uri(path)
  return "https://api.bitso.com/v2#{path}/"
end