class Points::Scraper::AnaMileage

Constants

URL

Public Instance Methods

start() click to toggle source
# File lib/points-scraper/anamileage.rb, line 14
def start
        start_scrape do |agent|
                agent = Mechanize::new
                agent.set_proxy( *ENV['HTTP_PROXY'].split( /:/ ) ) if ENV['HTTP_PROXY']

                agent.get(URL)

                agent.page.form_with(:name => 'loginForm') do|form|
                        form.custno = @user
                        form.password = @pass
                        form.click_button
                end

                agent.page.forms[0].tap do|form|
                        form.encoding = 'CP932'
                        form.click_button
                end

                agent.page.at('ul.point-list a').text.gsub(/,/, '')
        end
end