Class: IdonethisCli::Entry
- Defined in:
- lib/idonethis_cli/entry.rb
Instance Method Summary collapse
Instance Method Details
#list ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/idonethis_cli/entry.rb', line 31 def list return nil unless authenticated? return nil unless team_set? # {"body"=>"Here it is", "created_at"=>"2016-07-22T07:17:12.688Z", "updated_at"=>"2016-07-22T07:17:12.688Z", "occurred_on"=>"2016-07-22", "status"=>"done", "hash_id"=>"b074cb2ff", "completed_on"=>nil, "archived_at"=>nil, "team"=>{"name"=>"Team Name", "hash_id"=>"6fbb"}, "user"=>{"email_address"=>"[email protected]", "full_name"=>"Jonathan Siegel", "hash_id"=>"3e35"}} entries.each.with_index(1) do |entry, idx| cli.say "#{entry['created_at']} : #{entry['status']} : #{entry['body']}" end end |
#new(body) ⇒ Object
7 8 9 10 11 |
# File 'lib/idonethis_cli/entry.rb', line 7 def new(body) return nil unless authenticated? return nil unless team_set? post_entry body end |
#prompt ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/idonethis_cli/entry.rb', line 15 def prompt return nil unless authenticated? return nil unless team_set? cli.say "Enter your entries. Hit <enter> when done." body = cli.ask "What did you get done?" while body.length > 1 post_entry body body = cli.ask "What did you get done?" end end |