Class: Ubiquitously::Reddit::User
- Inherits:
-
Base::User
- Object
- Base::User
- Ubiquitously::Reddit::User
- Defined in:
- lib/ubiquitously/reddit.rb
Instance Attribute Summary
Attributes inherited from Base::User
Instance Method Summary collapse
Methods inherited from Base::User
Methods included from Ubiquitously::Resourceful
Constructor Details
This class inherits a constructor from Ubiquitously::Base::User
Instance Method Details
#login ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ubiquitously/reddit.rb', line 4 def login return true if logged_in? page = agent.get("http://www.reddit.com/") form = page.form_with(:action => "http://www.reddit.com/post/login") form["user"] = username form["passwd"] = password page = form.submit @logged_in = (page.title =~ /login or register/i).nil? unless @logged_in raise AuthenticationError.new("Invalid username or password for #{service_name.titleize}") end @logged_in end |