lib/adsense-info.rb in adsense-info-1.0.1 vs lib/adsense-info.rb in adsense-info-1.0.2

- old
+ new

@@ -5,18 +5,21 @@ class Info def initialize( username, password ) @username = username @password = password + @agent = Mechanize::Mechanize.new end def login! - @agent = Mechanize::Mechanize.new page = @agent.get 'http://www.gmail.com' form = page.forms.first - form.Email = @username - form.Passwd = @password - @agent.submit form + if form + form.Email = @username + form.Passwd = @password + @agent.submit form + end + nil end def today_so_far login! ( get('https://www.google.com/adsense/v3/m/home') / 'span[@class~=value]' ).first.inner_html