Class: HTTPal::Browser

Inherits:
Object
  • Object
show all
Defined in:
lib/httpal/browser.rb

Instance Method Summary collapse

Constructor Details

#initializeBrowser

Returns a new instance of Browser.



13
14
15
16
# File 'lib/httpal/browser.rb', line 13

def initialize
	@cookies = []
	@referer = nil
end

Instance Method Details

#get(uri) ⇒ Object



22
23
24
25
26
# File 'lib/httpal/browser.rb', line 22

def get(uri)
	uri,path = parseuri(uri)
	req = Net::HTTP::Get.new(path)
	send_request(req, uri)
end

#post(uri, fields) ⇒ Object



28
29
30
31
32
33
# File 'lib/httpal/browser.rb', line 28

def post(uri, fields)
	uri,path = parseuri(uri)
	req = Net::HTTP::Post.new(path)
	req.set_form_data fields
	send_request(req, uri)
end

#use(&block) ⇒ Object



18
19
20
# File 'lib/httpal/browser.rb', line 18

def use(&block)
	instance_eval(&block)
end