Sha256: c973a4900d937b6dd964d2d702ffece7636dffee847eff477d22535b88e211e4

Contents?: true

Size: 896 Bytes

Versions: 2

Compression:

Stored size: 896 Bytes

Contents

# -*- coding: utf-8 -*-
#
# amileage.rb: mileage by scraping www.ana.co.jp. for PointsScraper
#
# Copyright (C) 2012 by MATSUI Shinsuke <poppen.jp@gmail.com>
# Distributed under GPL.
#

require 'points-scraper/default'

module Points::Scraper
	class AnaMileage < Default
		URL = 'https://www.ana.co.jp/'

		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
	end
end

# Local Variables:
# mode: ruby
# indent-tabs-mode: t
# tab-width: 3
# ruby-indent-level: 3
# End:
# vim: ts=3

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
points-scraper-0.1.4 lib/points-scraper/anamileage.rb
points-scraper-0.1.3 lib/points-scraper/anamileage.rb