Sha256: e957a0c56f6f7641fc4ebfefa0bcfa2e688a7a78f93c54daa208190c745502d5

Contents?: true

Size: 906 Bytes

Versions: 6

Compression:

Stored size: 906 Bytes

Contents

require 'thor'

module Goodwill
  class CLI < Thor
    class_option :verbose, type: :boolean
    class_option :username
    class_option :password

    def initialize(*args)
      super
      return if args[2][:current_command].name == 'help'

      username = options[:username] || ask('Username:')
      password = options[:password] || ask('Password:') { |q| q.echo = false }
      @account = Goodwill::Account.new(username, password)
    end

    desc 'auctions', "List all auctions you're currently bidding on"
    def auctions
      say "Your current auctions:\n"
      tp @account.in_progress
    end

    desc 'search SEARCH', 'Search for auctions matching SEARCH'
    def search(search)
      say 'Your search results:'
      tp @account.search(search)
    end

    desc 'bid ITEMID MAXBID', 'Bid MAXBID on ITEMID'
    def bid(itemid, maxbid)
      @accounts.bid(itemid, maxbid)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
goodwill-0.3.0 lib/goodwill/cli.rb
goodwill-0.2.1 lib/goodwill/cli.rb
goodwill-0.2.0 lib/goodwill/cli.rb
goodwill-0.1.4 lib/goodwill/cli.rb
goodwill-0.1.3 lib/goodwill/cli.rb
goodwill-0.1.2 lib/goodwill/cli.rb