Module: Tr3llo::Command::Card::Edit

Extended by:
Edit
Included in:
Edit
Defined in:
lib/3llo/command/card/edit.rb

Instance Method Summary collapse

Instance Method Details

#execute(card_key) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/3llo/command/card/edit.rb', line 7

def execute(card_key)
  card_id = Entities.parse_id(:card, card_key)
  assert_card_id!(card_id, card_key)

  card = API::Card.find(card_id)

  interface = Application.fetch_interface!()

  interface.print_frame do
    name = interface.input.ask("Name:", required: true, value: card.name)
    description = interface.input.ask("Description:", value: card.description)

    API::Card.update(card_id, {"name" => name, "desc" => description})

    interface.puts("Card has been updated.")
  end
end