Module: Trumpet::Request
- Defined in:
- lib/trumpet/request.rb
Constant Summary collapse
- @@http =
Net::HTTP.new('api.trumpet.io')
Class Method Summary collapse
- .delete(path, options = {}) ⇒ Object
- .get(path, options = {}) ⇒ Object
- .post(path, options = {}) ⇒ Object
- .put(path, options = {}) ⇒ Object
- .set_server(host, port = nil) ⇒ Object
Class Method Details
.delete(path, options = {}) ⇒ Object
17 18 19 |
# File 'lib/trumpet/request.rb', line 17 def self.delete(path, ={}) do_request(Net::HTTP::Delete, path, ) end |
.get(path, options = {}) ⇒ Object
5 6 7 |
# File 'lib/trumpet/request.rb', line 5 def self.get(path, ={}) do_request(Net::HTTP::Get, path, ) end |
.post(path, options = {}) ⇒ Object
9 10 11 |
# File 'lib/trumpet/request.rb', line 9 def self.post(path, ={}) do_request(Net::HTTP::Post, path, ) end |
.put(path, options = {}) ⇒ Object
13 14 15 |
# File 'lib/trumpet/request.rb', line 13 def self.put(path, ={}) do_request(Net::HTTP::Put, path, ) 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 |