Module: Bitstamp::Net

Defined in:
lib/bitstamp/net.rb

Class Method Summary collapse

Class Method Details

.curl(verb, path, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/bitstamp/net.rb', line 8

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

.delete(path, options = {}) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/bitstamp/net.rb', line 47

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

  request.perform

  return request
end

.get(path, options = {}) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/bitstamp/net.rb', line 23

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

  request.perform

  return request
end

.patch(path, options = {}) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/bitstamp/net.rb', line 39

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

  request.perform

  return request
end

.post(path, options = {}) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/bitstamp/net.rb', line 31

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

  request.perform

  return request
end

.to_uri(path) ⇒ Object



3
4
5
6
# File 'lib/bitstamp/net.rb', line 3

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