Sha256: beec28ae386ca7988a71e377a986bc8f3593b86d77caca488ae50f0d9b09c967
Contents?: true
Size: 892 Bytes
Versions: 5
Compression:
Stored size: 892 Bytes
Contents
require 'mechanize' require 'goodwill/urlpaths' module Goodwill module Mechanize def mechanize Mechanize.mechanize end class << self include URLPaths def username @username ||= nil end attr_writer :username def password @password ||= nil end attr_writer :password def logged_in? @logged_in ||= false end def mechanize @mechanize ||= ::Mechanize.new login @mechanize end def login return true if logged_in? @mechanize.get(LOGIN_URL) do |page| my_page = page.form_with(action: 'dologin.asp') do |f| f.buyerid = @username f.buyerpasswd = @password end.click_button @logged_in = my_page.links.map(&:to_s).include? 'My shopgoodwill' end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems