Sha256: cdd1428f58b7ff435888ba709df41ec27390ad93fd428a2071b99d5ab797f3bc

Contents?: true

Size: 895 Bytes

Versions: 5

Compression:

Stored size: 895 Bytes

Contents

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

require 'points-scraper/default'

module Points::Scraper
	class Rakuten < Default
		URL = 'https://point.rakuten.co.jp'

		def start
			start_scrape do |agent|
				agent = Mechanize::new
				agent.set_proxy( *ENV['HTTP_PROXY'].split( /:/ ) ) if ENV['HTTP_PROXY']

				page = agent.get(URL)

				login_page = agent.click( page.link_with(:href => /login/i) )
				point_page = login_page.form_with(:name => 'LoginForm') do|form|
					form.u = @user
					form.p = @pass
				end.click_button

				point_page.at('//div[@id="pointAccount"]//dl[@class="total"]/dd').text
			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

5 entries across 5 versions & 1 rubygems

Version Path
points-scraper-0.1.4 lib/points-scraper/rakuten.rb
points-scraper-0.1.3 lib/points-scraper/rakuten.rb
points-scraper-0.1.2 lib/points-scraper/rakuten.rb
points-scraper-0.1.1 lib/points-scraper/rakuten.rb
points-scraper-0.1.0 lib/points-scraper/rakuten.rb