class Japonica::CLI

Public Instance Methods

batch(file) click to toggle source
# File lib/japonica/cli.rb, line 21
def batch(file)
        File.readlines(file).each do |l|
                url, max, type = l.split(' ')
                order(url, max, type)
        end
end
order(url, max='xxxx', type=:instant) click to toggle source
# File lib/japonica/cli.rb, line 11
def order(url, max='xxxx', type=:instant)
        @auction = Japonica::Auction.load_url url
        @max_bid = max
        @bid_type = type_name type.to_sym
        
        # doesn't use thor's template() since i don't want to output to a file
        puts ERB.new(File.read(File.join(template_path, 'orderform.tt'))).result(binding)
end

Private Instance Methods

template_path() click to toggle source
# File lib/japonica/cli.rb, line 30
def template_path
        File.join(File.dirname(__FILE__), '..', 'templates')
end
type_name(type) click to toggle source
# File lib/japonica/cli.rb, line 34
def type_name (type)
        case type
        when :instant, :bid
                'Instant Bid'
        when :bin, :now
                'Buy It Now'
        when :snipe
                'Snipe Bid'
        end
end