Module: Tr3llo::Command::Card::AddItem

Extended by:
AddItem
Included in:
AddItem
Defined in:
lib/3llo/command/card/add_item.rb

Instance Method Summary collapse

Instance Method Details

#execute(checklist_key) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/3llo/command/card/add_item.rb', line 7

def execute(checklist_key)
  checklist_id = Entities.parse_id(:checklist, checklist_key)
  interface = Application.fetch_interface!()

  interface.print_frame do
    name = interface.input.ask("Item name:", required: true)

    API::Checklist.create_item(checklist_id, name)

    interface.puts("Item #{name.inspect} has been added")
  end
end