Class: Instapaper::LoginPage

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

Instance Method Summary collapse

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

Returns:

  • (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 ()
  puts "Logging in as #{.email}"
  page = @agent.get(@url)
   = page.forms.first
  .field_with(:name => "username").value = .email
  .field_with(:name => "password").value = .password
  page = @agent.submit()
  @logged_in = true  if page.title == "Logging in..."
  @agent
end