Module: Coinfloor::Net

Defined in:
lib/coinfloor/net.rb

Class Method Summary collapse

Class Method Details

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



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

def self.delete(path, options={})
  RestClient::Request.execute method: :delete,
                              payload: options,
                              url: self.to_uri(path),
                              user: "#{Coinfloor.client_id}/#{Coinfloor.key}",
                              password: Coinfloor.secret
end

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



7
8
9
10
11
12
# File 'lib/coinfloor/net.rb', line 7

def self.get(path, options={})
  RestClient::Request.execute method: :get,
                              url: self.to_uri(path),
                              user: "#{Coinfloor.client_id}/#{Coinfloor.key}",
                              password: Coinfloor.secret
end

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



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

def self.patch(path, options={})
  RestClient::Request.execute method: :put,
                              payload: options,
                              url: self.to_uri(path),
                              user: "#{Coinfloor.client_id}/#{Coinfloor.key}",
                              password: Coinfloor.secret
end

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



14
15
16
17
18
19
20
# File 'lib/coinfloor/net.rb', line 14

def self.post(path, options={})
  RestClient::Request.execute method: :post,
                              payload: options,
                              url: self.to_uri(path),
                              user: "#{Coinfloor.client_id}/#{Coinfloor.key}",
                              password: Coinfloor.secret
end

.to_uri(path) ⇒ Object



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

def self.to_uri(path)
  return "https://webapi.coinfloor.co.uk:8090/bist/XBT/GBP#{path}/"
end