Class: SlackTrello::RetroCommand

Inherits:
Object
  • Object
show all
Includes:
TextParser
Defined in:
lib/slack_trello/retro_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TextParser

#args, #num_args, #text_message, #valid_text_format?

Constructor Details

#initialize(args, webhook_url) ⇒ RetroCommand

Returns a new instance of RetroCommand.



7
8
9
10
# File 'lib/slack_trello/retro_command.rb', line 7

def initialize(args, webhook_url)
  @parser = ResponseParser.new(args)
  @webhook_url = webhook_url
end

Instance Attribute Details

#parserObject (readonly)

Returns the value of attribute parser.



5
6
7
# File 'lib/slack_trello/retro_command.rb', line 5

def parser
  @parser
end

#webhook_urlObject (readonly)

Returns the value of attribute webhook_url.



5
6
7
# File 'lib/slack_trello/retro_command.rb', line 5

def webhook_url
  @webhook_url
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/slack_trello/retro_command.rb', line 12

def run
  return help_message unless valid_text_format?
  return help_message unless num_args == 1
  return board_not_found_message unless trello_card_creator.trello_board
  return list_not_found_message unless trello_card_creator.trello_list

  trello_card
  speaker.speak success_message
  "You should see a notification with a link. If not, the card might not have been created."
end