Class: Instapaper::LoginPage
- Inherits:
-
Object
- Object
- Instapaper::LoginPage
- Defined in:
- lib/instapaper_download.rb
Instance Method Summary collapse
-
#initialize(agent) ⇒ LoginPage
constructor
A new instance of LoginPage.
- #logged_in? ⇒ Boolean
- #login(account) ⇒ Object
Constructor Details
#initialize(agent) ⇒ LoginPage
Returns a new instance of LoginPage.
78 79 80 81 82 |
# File 'lib/instapaper_download.rb', line 78 def initialize(agent) @agent = agent @url = "http://www.instapaper.com/user/login" @logged_in = false end |
Instance Method Details
#logged_in? ⇒ Boolean
93 94 95 |
# File 'lib/instapaper_download.rb', line 93 def logged_in? @logged_in end |
#login(account) ⇒ Object
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/instapaper_download.rb', line 83 def login(account) puts "Logging in as #{account.email}" page = @agent.get(@url) login_form = page.forms.first login_form.field_with(:name => "username").value = account.email login_form.field_with(:name => "password").value = account.password page = @agent.submit(login_form) @logged_in = true if page.title == "Logging in..." @agent end |