Class: URL::NetHandler

Inherits:
RequestHandler show all
Defined in:
lib/url/handlers/net_handler.rb

Overview

Net::HTTP Handler

Instance Attribute Summary

Attributes inherited from RequestHandler

#url

Instance Method Summary collapse

Methods inherited from RequestHandler

#initialize

Constructor Details

This class inherits a constructor from URL::RequestHandler

Instance Method Details

#delete(args = {}) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/url/handlers/net_handler.rb', line 21

def delete(args={})
  http = http_obj
  request = Net::HTTP::Delete.new(make_path + url.params.to_s)
  t = Time.now
  resp = http.request(request)
  make_str(resp,Time.now-t)
end

#get(args = {}) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/url/handlers/net_handler.rb', line 4

def get(args={})
  http = http_obj
  request = Net::HTTP::Get.new(make_path + url.params.to_s)
  t = Time.now
  resp = http.request(request)
  make_str(resp,Time.now-t)
end

#post(args = {}) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/url/handlers/net_handler.rb', line 12

def post(args={})
  http = http_obj
  request = Net::HTTP::Post.new(make_path)
  request.set_form_data(url.params)
  t = Time.now
  resp = http.request(request)
  make_str(resp,Time.now-t)
end