uc_card

A Ruby library that fetches your unpaid credit card transaction history (usage statements) from the UC Card (www.uccard.co.jp) member site. It logs in to the member site with Mechanize, opens the statement page, parses the HTML with Nokogiri, and returns the results as Ruby objects.

Published as a gem, with a command-line tool of the same name bundled in.

gem install uc_card
uc_card   # list the unpaid transactions (there are no options at all)

Sample output from the README (merchant names are masked). It is kept as printed at the time: 回払い 1回 is the card statement's wording for "paid in full, one installment".

2012/01/28: ****** 500 回払い 1回
2012/01/26: ****** 5940 回払い 1回
2012/01/22: ****** 3357 回払い 1回
Total: 11722

Used as a library, it looks like this. Instead of hard-coding the ID and password, it reads them from pit, a credential-management library.

require 'uc_card'
UCCard.start_with_pit("uccard.co.jp") do |card|
  puts card
end

Internals

UCCard.start takes care of the whole lifecycle from login through statement retrieval to logout, and the block receives a fully parsed instance.

Sequence diagram of the uc_card processing flow

The README includes a note that if you get SSL certificate errors, you should locate the certificate path with ruby -ropenssl -e "p OpenSSL::X509::DEFAULT_CERT_FILE" and install an appropriate certificate.

ðŸĪ– This English version is machine-translated by AI.