Class: Watchman::Client
- Inherits:
-
Object
- Object
- Watchman::Client
- Defined in:
- lib/watchman/client.rb
Class Attribute Summary collapse
-
.host ⇒ Object
Returns the value of attribute host.
-
.password ⇒ Object
Returns the value of attribute password.
-
.username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
Class Attribute Details
.host ⇒ Object
Returns the value of attribute host.
4 5 6 |
# File 'lib/watchman/client.rb', line 4 def host @host end |
.password ⇒ Object
Returns the value of attribute password.
4 5 6 |
# File 'lib/watchman/client.rb', line 4 def password @password end |
.username ⇒ Object
Returns the value of attribute username.
4 5 6 |
# File 'lib/watchman/client.rb', line 4 def username @username end |
Instance Method Details
#add_cookie(cookie, key) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/watchman/client.rb', line 23 def (,key) .secure = false .domain = Client.host if agent..jar[Client.host].nil? agent..jar[Client.host] = {"/"=>{key=>}} else agent..jar[Client.host]["/"][key] = end end |
#agent ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/watchman/client.rb', line 11 def agent if @_agent.nil? @_agent = Mechanize.new page = @_agent.get("http://#{Client.host}/") form = page.form("UserForm") form.UserName = Client.username form.Password = Client.password @_agent.submit(form, form..first) end @_agent end |