Class: Fiddler::ConnectionManager::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/fiddler/connection_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConnection

Returns a new instance of Connection.



10
11
12
13
14
# File 'lib/fiddler/connection_manager.rb', line 10

def initialize
   @client = HTTPClient.new
   @client.set_cookie_store("cookies.dat")
   @logged_in = false
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



8
9
10
# File 'lib/fiddler/connection_manager.rb', line 8

def client
  @client
end

#logged_inObject

Returns the value of attribute logged_in.



8
9
10
# File 'lib/fiddler/connection_manager.rb', line 8

def logged_in
  @logged_in
end

Instance Method Details

#get(path, options) ⇒ Object



16
17
18
19
# File 'lib/fiddler/connection_manager.rb', line 16

def get(path,options)
   login! unless @logged_in
   @client.get(url_for(path),options).content
end

#post(path, options) ⇒ Object



21
22
23
24
# File 'lib/fiddler/connection_manager.rb', line 21

def post(path,options)
   login! unless @logged_in
   @client.post(url_for(path),options).content
end

#post_content(path, options) ⇒ Object



26
27
28
29
# File 'lib/fiddler/connection_manager.rb', line 26

def post_content(path,options)
   login! unless @logged_in
   @client.post_content(url_for(path),options)
end