class Startling::Commands::TrelloStart

Public Instance Methods

execute() click to toggle source
# File lib/startling_trello/commands/trello_start.rb, line 9
def execute
  Startling::Configuration.load_configuration

  logger.info "Starting story..."
  doing_list_id = get_doing_list_id

  api = StartlingTrello.api

  card = api.find_card(get_card_id)
  list = api.find_list(doing_list_id)
  api.move_card_to_list(card: card, list: list)
  api.add_member_to_card(card)

  StartlingTrello::Story.new(card)
end
get_card_id() click to toggle source
# File lib/startling_trello/commands/trello_start.rb, line 25
def get_card_id
  %r{trello.com/c/(\w*)}.match(get_card_url)[1]
end
get_card_url() click to toggle source
# File lib/startling_trello/commands/trello_start.rb, line 29
def get_card_url
  if story_id
    story_id
  elsif args.length > 0
    args[0]
  else
    prompt_for_card_url
  end
end

Private Instance Methods

get_doing_list_id() click to toggle source
# File lib/startling_trello/commands/trello_start.rb, line 47
def get_doing_list_id
  doing_list_id = StartlingTrello.doing_list_id
  abort 'Doing list id must be specified in configuration.' if doing_list_id.nil?
  doing_list_id
end
prompt_for_card_url() click to toggle source
# File lib/startling_trello/commands/trello_start.rb, line 41
def prompt_for_card_url
  result = ask('Enter card URL to start: ')
  abort 'Card URL must be specified.' if result.empty?
  result
end