Class: Goodwill::CLI
- Inherits:
-
Thor
- Object
- Thor
- Goodwill::CLI
- Defined in:
- lib/goodwill/cli.rb
Instance Method Summary collapse
- #auctions ⇒ Object
- #bid(itemid, maxbid) ⇒ Object
-
#initialize(*args) ⇒ CLI
constructor
A new instance of CLI.
- #search(search) ⇒ Object
Constructor Details
#initialize(*args) ⇒ CLI
Returns a new instance of CLI.
9 10 11 12 13 14 15 16 |
# File 'lib/goodwill/cli.rb', line 9 def initialize(*args) super return if args[2][:current_command].name == 'help' username = [:username] || ask('Username:') password = [:password] || ask('Password:') { |q| q.echo = false } @account = Goodwill::Account.new(username, password) end |
Instance Method Details
#auctions ⇒ Object
19 20 21 22 |
# File 'lib/goodwill/cli.rb', line 19 def auctions say "Your current auctions:\n" tp @account.in_progress end |
#bid(itemid, maxbid) ⇒ Object
31 32 33 |
# File 'lib/goodwill/cli.rb', line 31 def bid(itemid, maxbid) @accounts.bid(itemid, maxbid) end |
#search(search) ⇒ Object
25 26 27 28 |
# File 'lib/goodwill/cli.rb', line 25 def search(search) say 'Your search results:' tp @account.search(search) end |