module Tr3llo::Command::Card::Show

Public Instance Methods

execute(key) click to toggle source
# File lib/3llo/command/card/show.rb, line 7
def execute(key)
  card_id = Entities.parse_id(:card, key)
  assert_card_id!(card_id, key)

  card = get_card(card_id)
  checklists = get_checklist(card_id)

  interface = Application.fetch_interface!()

  interface.print_frame do
    interface.puts(View::Card::Show.render(card, checklists))
  end
end

Private Instance Methods

assert_card_id!(card_id, key) click to toggle source
# File lib/3llo/command/card/show.rb, line 31
def assert_card_id!(card_id, key)
  raise InvalidArgumentError.new("#{key.inspect} is not a valid card key") unless card_id
end
get_card(card_id) click to toggle source
# File lib/3llo/command/card/show.rb, line 23
def get_card(card_id)
  API::Card.find(card_id)
end
get_checklist(card_id) click to toggle source
# File lib/3llo/command/card/show.rb, line 27
def get_checklist(card_id)
  API::Checklist.list_by_card_id(card_id)
end