Class: Gracenote::HTTP
- Inherits:
-
Object
- Object
- Gracenote::HTTP
- Defined in:
- lib/gracenote/HTTP.rb
Class Method Summary collapse
Class Method Details
.get(path, cookie = '') ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/gracenote/HTTP.rb', line 14 def self.get(path, ='') uri = URI(path) req = Net::HTTP.new(uri.host, uri.port) req.read_timeout = 60 req.use_ssl = (uri.scheme == "https") ? true : false headers = {'Cookie' => } resp = req.get( uri.path, headers) return resp end |
.post(path, data = '', cookie = '') ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/gracenote/HTTP.rb', line 25 def self.post(path, data='', ='') uri = URI(path) req = Net::HTTP.new(uri.host, uri.port) req.read_timeout = 60 req.use_ssl = (uri.scheme == "https") ? true : false headers = {'Cookie' => , "Content-Type" => "application/xml"} if data.class.to_s == 'String' reqdata = data; else reqdata = Rack::Utils.build_nested_query(data) end resp = req.request_post( uri.path, reqdata, headers) return resp end |