module Goodwill::Mechanize

Constants

Password
Username

Attributes

password[W]
username[W]

Public Class Methods

logged_in?() click to toggle source
# File lib/goodwill/mechanize.rb, line 26
def logged_in?
  @logged_in ||= false
end
login() click to toggle source
# File lib/goodwill/mechanize.rb, line 36
def login
  return true if logged_in?

  @mechanize.get(LOGIN_URL) do |page|
    my_page = page.form_with(action: '/SignIn') do |f|
      f.Username = @username
      f.Password = @password
    end.click_button
    @logged_in = my_page.links.map(&:to_s).include? 'My Shopgoodwill '
  end
end
mechanize() click to toggle source
# File lib/goodwill/mechanize.rb, line 30
def mechanize
  @mechanize ||= ::Mechanize.new
  login
  @mechanize
end
password() click to toggle source
# File lib/goodwill/mechanize.rb, line 22
def password
  @password ||= nil
end
username() click to toggle source
# File lib/goodwill/mechanize.rb, line 16
def username
  @username ||= nil
end

Public Instance Methods

mechanize() click to toggle source
# File lib/goodwill/mechanize.rb, line 9
def mechanize
  Mechanize.mechanize
end