lib/graybook/importer/gmail.rb in graybook-1.1.0 vs lib/graybook/importer/gmail.rb in graybook-1.1.1
- old
+ new
@@ -31,15 +31,16 @@
form = page.forms.first
form.Email = options[:username]
form.Passwd = options[:password]
page = agent.submit(form,form.buttons.first)
- return Problem.new("Username and password were not accepted. Please check them and try again.") if page.body =~ /Username and password do not match/
+ return Graybook::Problem.new("Username and password were not accepted. Please check them and try again.") if page.body =~ /Username and password do not match/
if page.search('//meta').first.attributes['content'] =~ /url='?(http.+?)'?$/i
page = agent.get $1
end
+ true
end
##
# prepare this importer
@@ -52,10 +53,10 @@
def scrape_contacts
unless agent.cookies.find { |c|
c.name == 'GAUSR' && c.value.match(/mail(.*?):#{options[:username]}/)
}
- return Problem.new("Username and password were not accepted. Please check them and try again.")
+ return Graybook::Problem.new("Username and password were not accepted. Please check them and try again.")
end
page = agent.get('http://mail.google.com/mail/h/?v=cl&pnl=a')
title = page.search("//title").inner_text
if title == 'Redirecting'