Sha256: e2a47f94b88b7a22d00b13e3a71efc87beb7450fea759565d19c0c0b7ded80f3
Contents?: true
Size: 536 Bytes
Versions: 7
Compression:
Stored size: 536 Bytes
Contents
module RubyHackernews class SignupService include MechanizeContext def signup(username, password) raise "You are logged in already - logout first." if authenticated? page = agent.get(ConfigurationService.base_url) login_url = page.search(".pagetop/a").last['href'].sub("/","") login_page = agent.get(ConfigurationService.base_url + login_url) form = login_page.forms[1] form.u = username form.p = password page = form.submit return page.title != nil end end end
Version data entries
7 entries across 7 versions & 1 rubygems