Sha256: d0d754f3ee16d198c8b34e7c92707ba483013a3595b7d6f8bf5c7efc2eea4494

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

module Bitstamp
  module Net
    def self.to_uri(path)
      #return "http#{Kojn.ssl ? "s" : ""}://#{Kojn.host}:#{Kojn.port}#{path}"
      return "https://www.bitstamp.net/api#{path}/"
    end

    def self.curl(verb, path, options={})
      verb = verb.upcase.to_sym

      c = Curl::Easy.new(self.to_uri(path))

      options[:user] = Bitstamp.key
      options[:password] = Bitstamp.secret

      c.post_body = options.to_query

      c.http(verb)

      return c
    end

    def self.get(path, options={})
      request = self.curl(:GET, path, options)

      request.perform

      return request
    end

    def self.post(path, options={})
      request = self.curl(:POST, path, options)

      request.perform

      return request
    end

    def self.patch(path, options={})
      request = self.curl(:PATCH, path, options)

      request.perform

      return request
    end

    def self.delete(path, options={})
      request = self.curl(:DELETE, path, options)

      request.perform

      return request
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bitstamp-0.2.2 lib/bitstamp/net.rb
bitstamp-0.2.1 lib/bitstamp/net.rb
bitstamp-0.2.0 lib/bitstamp/net.rb
bitstamp-0.1.0 lib/bitstamp/net.rb