Class: Slackdo::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/slackdo.rb

Instance Method Summary collapse

Instance Method Details

#add_taskObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/slackdo.rb', line 17

def add_task
     notifier = Slack::Notifier.new `cat ~/.slackdo/webhook`.strip
     cli = HighLine.new
  category = cli.ask 'What is the category of this new task? eg. DEV or GENERAL'
     message = cli.ask 'Type your new task:'
     want_note = cli.ask 'Do you want to add a note to this new task? y/n'
     note_content = ''
     while want_note == 'y'
       note_text = cli.ask 'Type your note:'
       note_content << "\n`- #{note_text}`"
       want_note = cli.ask 'Do you want to add another note to the task? y/n'
     end
     note = {
         fallback: "This should've been a new note but looks like something went wrong...",
         text: note_content,
         color: "gray",
         mrkdwn_in: ["text"]
     }
     notifier.post text: "• [#{category}] #{message}", attachments: [note]
end