class SlackTrello::Commands::CopyCards

Attributes

slack_post_response[R]
webhook_url[R]

Public Class Methods

new(slack_post_args, webhook_url) click to toggle source
# File lib/slack_trello/commands/copy_cards.rb, line 8
def initialize(slack_post_args, webhook_url)
  @slack_post_response = OpenStruct.new(slack_post_args)
  @webhook_url = webhook_url
end

Public Instance Methods

run() click to toggle source
# File lib/slack_trello/commands/copy_cards.rb, line 13
def run
  return help_message unless valid_text_format?
  return help_message unless num_args == 4

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

Private Instance Methods

card_copier() click to toggle source
# File lib/slack_trello/commands/copy_cards.rb, line 28
def card_copier
  args = {
    source_board: source_board_name,
    source_list: source_list_name,
    destination_board: destination_board_name,
    destination_list: destination_list_name
  }
  @card_copier ||= SlackTrello::TrelloHelpers::CopyCards.new(args)
end
destination_board_name() click to toggle source
# File lib/slack_trello/commands/copy_cards.rb, line 46
def destination_board_name
  args[2]
end
destination_list_name() click to toggle source
# File lib/slack_trello/commands/copy_cards.rb, line 50
def destination_list_name
  args[3]
end
example_command() click to toggle source
# File lib/slack_trello/commands/copy_cards.rb, line 24
def example_command
  "/copy_cards (source_board, source_list, destination_board, destination_list)"
end
source_board_name() click to toggle source
# File lib/slack_trello/commands/copy_cards.rb, line 38
def source_board_name
  args[0]
end
source_list_name() click to toggle source
# File lib/slack_trello/commands/copy_cards.rb, line 42
def source_list_name
  args[1]
end
success_message() click to toggle source
# File lib/slack_trello/commands/copy_cards.rb, line 54
def success_message
  ":mega: [#{slack_post_response.user_name}] has copied all the cards from the #{source_list_name} list of the #{source_board_name} board to the #{destination_list_name} list of the #{destination_board_name} board"
end