Skip to content

Instantly share code, notes, and snippets.

Created Jul 5, 2014
What would you like to do?
# @author
# Copyright (C) 2012-2013 takuya. All rights reserved.
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
module BillScraper
def sasion_card_current_month( login_id , passwd)
require 'mechanize'
m =
m.get "" :text => /ログイン/).click
raise unless[0][0][0].field_with( :name => /id/i).value = login_id[0].field_with( :name => /pass/i).value = passwd[0].submit
raise unless :text => /利用明細/) :text => /利用明細/).click
raise unless :text => /web明細ダウンロード/i ) :text => /web明細ダウンロード/i ).click
raise unless["content-disposition"] =~ /filename=([^\.]+\.pdf)/
f_name = Regexp.last_match[1] f_name
return f_name
module_function :sasion_card_current_month
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment