Class: PackageTracker::Request
- Inherits:
-
Object
- Object
- PackageTracker::Request
- Defined in:
- lib/package_tracker/request.rb
Class Method Summary collapse
- .do_request(http_method, uri, path, body, options = {}) ⇒ Object
- .get(uri, path, body, options = {}) ⇒ Object
- .post(uri, path, body, options = {}) ⇒ Object
Class Method Details
.do_request(http_method, uri, path, body, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/package_tracker/request.rb', line 11 def self.do_request(http_method, uri, path, body, ={}) raw_request = http_method.new(path) raw_request.body = body http = Net::HTTP.new(uri, [:port]) http.use_ssl = true if [:https] http.request(raw_request) end |
.get(uri, path, body, options = {}) ⇒ Object
3 4 5 |
# File 'lib/package_tracker/request.rb', line 3 def self.get(uri, path, body, ={}) do_request(Net::HTTP::Get, uri, path, body, ) end |
.post(uri, path, body, options = {}) ⇒ Object
7 8 9 |
# File 'lib/package_tracker/request.rb', line 7 def self.post(uri, path, body, ={}) do_request(Net::HTTP::Post, uri, path, body, ) end |