Class: HTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/gracenote/HTTP.rb

Class Method Summary collapse

Class Method Details

.get(path, data = '', cookie = '') ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/gracenote/HTTP.rb', line 10

def self.get(path, data='', cookie='')
  uri = URI(path)
  req = Net::HTTP.new(uri.host, uri.port)
  req.use_ssl = (uri.scheme == "https") ? true : false
  
  reqdata = Rack::Utils.build_nested_query(data)
  resp = req.get( uri.path, reqdata, headers)
  return resp
end

.post(path, data = '', cookie = '') ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/gracenote/HTTP.rb', line 20

def self.post(path, data='', cookie='')
  uri = URI(path)
  req = Net::HTTP.new(uri.host, uri.port)
  req.use_ssl = (uri.scheme == "https") ? true : false
  
  reqdata = Rack::Utils.build_nested_query(data)
  resp = req.request_post( uri.path, reqdata, headers)     
  return resp
end