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.



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

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

Instance Method Details

#get(uri) ⇒ Object



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

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

#post(uri, fields) ⇒ Object



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

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



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

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