Module: Trumpet::Request

Defined in:
lib/trumpet/request.rb

Constant Summary collapse

@@http =
Net::HTTP.new('api.trumpet.io')

Class Method Summary collapse

Class Method Details

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



17
18
19
# File 'lib/trumpet/request.rb', line 17

def self.delete(path, options={})
  do_request(Net::HTTP::Delete, path, options)
end

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



5
6
7
# File 'lib/trumpet/request.rb', line 5

def self.get(path, options={})
  do_request(Net::HTTP::Get, path, options)
end

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



9
10
11
# File 'lib/trumpet/request.rb', line 9

def self.post(path, options={})
  do_request(Net::HTTP::Post, path, options)
end

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



13
14
15
# File 'lib/trumpet/request.rb', line 13

def self.put(path, options={})
  do_request(Net::HTTP::Put, path, options)
end

.set_server(host, port = nil) ⇒ Object



21
22
23
# File 'lib/trumpet/request.rb', line 21

def self.set_server(host, port=nil)
  @@http = Net::HTTP.new(host.gsub('http://', ''), port) #no http:// in hosts
end