#! /usr/bin/env ruby # -*- coding: utf-8 -*- # # points.rb: getting mileages/points from shopping web sites. # # Copyright (C) 2012 by TADA Tadashi # Distributed under GPL. # require 'rubygems' require 'points-scraper' require 'thor' require 'pit' module Points::Scraper class App < Thor desc 'tpoint', 'getting current T-POINT from T-SITE.' def tpoint require 'points-scraper/tpoint' puts TPoint.new( *auth( 'yahoo-japan' ) ).start end desc 'ana', 'getting current ANA Mileage.' def ana require 'points-scraper/anamileage' puts AnaMileage.new( *auth( 'ana' ) ).start end desc 'rakuten', 'getting current Rakuten Points.' def rakuten require 'points-scraper/rakuten' puts Rakuten.new( *auth( 'rakuten' ) ).start end desc 'help', 'show command help.' def help super end private def auth( key ) login = Pit::get( key, :require => { 'user' => "your ID of #{key}.", 'pass' => "your Password of #{key}." } ) [login['user'], login['pass']] end end end Points::Scraper::App.start # Local Variables: # mode: ruby # indent-tabs-mode: t # tab-width: 3 # ruby-indent-level: 3 # End: # vim: ts=3