Help us understand the problem. What is going on with this article?

ソフトバンクの請求書を取得

More than 5 years have passed since last update.
softbank.rb
#!/usr/bin/env ruby
#coding: utf-8
require 'rubygems' if RUBY_VERSION.to_f < 1.9
require 'pp'


module BillScraper

    class MySoftbank
        attr_accessor :m
        def initialize( id=nil, password=nil )
            require 'mechanize'
            @m = Mechanize.new
            @@id = id
            @@password = password
        end
        def go_to_top
            m.get "https://my.softbank.jp/msb/d/top"
        end

        def login(id=nil,password=nil)
            id ||= @@id
            password ||= @@password
            m.get 'https://my.softbank.jp/msb/d/top'
            m.submit m.page.forms[0], m.page.forms[0].buttons[0]
            m.page.forms[0].fields[0].value= id
            m.page.forms[0].fields[1].value= password
            m.page.forms[0].submit
        end
        def latest_meisai
            @m.page.links_with( :text=>"ご請求書(内訳)の確認").first.click
            #リダイレクト・クッションページ
            @m.page.forms[0].submit
            #請求内訳
            year_month =  @m.page.search('form p.current span').text.strip #取得可能な請求書

            #一括請求
            button = @m.page.forms[0].buttons_with( :name=> "doPrintSbmAll").first
            form   = @m.page.forms[0]
            @m.submit form, button
            return { "file_name"=>"ソフトバンク請求書-#{year_month}.pdf", "body"=>m.page.body}
        end
        def latest_meisai_for_this_number
            @m.page.links_with( :text=>"ご請求書(内訳)の確認").first.click
            #リダイレクト・クッションページ
            @m.page.forms[0].submit
            #請求内訳
            year_month =  @m.page.search('form p.current span').text.strip #取得可能な請求書

            #一括請求
            #button = @m.page.forms[0].buttons_with( :name=> "doPrintMsn").first   #電話番号
            button = @m.page.forms[0].buttons_with( :name=> "doPrintSbmAll").first
            form   = @m.page.forms[0]
            @m.submit form, button
            return { "file_name"=>"ソフトバンク請求書-#{year_month}.pdf", "body"=>m.page.body}
        end
    end

end

if $0 == __FILE__ then

# my_soft_bank = BillScraper::MySoftbank.new "0809999999","password"
# my_soft_bank.login
# ret = my_soft_bank.latest_meisai_for_this_number
# open(ret["file_name"], "w"){|f| f.print ret["body"] }

エントリはこっち。

http://takuya-1st.hatenablog.jp/entry/2013/11/18/042215

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away