class PackageTracker::Request

Public Class Methods

do_request(http_method, uri, path, body, options={}) click to toggle source
# File lib/package_tracker/request.rb, line 11
def self.do_request(http_method, uri, path, body, options={})      
  raw_request = http_method.new(path)
  raw_request.body = body
  
  http = Net::HTTP.new(uri, options[:port])
  http.use_ssl = true if options[:https]
  
  http.request(raw_request)
end
get(uri, path, body, options={}) click to toggle source
# File lib/package_tracker/request.rb, line 3
def self.get(uri, path, body, options={})
  do_request(Net::HTTP::Get, uri, path, body, options)
end
post(uri, path, body, options={}) click to toggle source
# File lib/package_tracker/request.rb, line 7
def self.post(uri, path, body, options={})
  do_request(Net::HTTP::Post, uri, path, body, options)
end