Sha256: 1050ace9275409d440f01ed9ce9a8ea62de7f61b1b6205f1ad1e7981109778a0
Contents?: true
Size: 906 Bytes
Versions: 2
Compression:
Stored size: 906 Bytes
Contents
require 'mechanize' require 'pry' 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
goodwill-0.1.2 | lib/goodwill/mechanize.rb |
goodwill-0.1.0 | lib/goodwill/mechanize.rb |