Sha256: c9150055e76b8d51d6e20e1d3d4159ed196cc28210adb129a2b87b31960b2b14

Contents?: true

Size: 842 Bytes

Versions: 6

Compression:

Stored size: 842 Bytes

Contents

module Tr3llo
  module Command
    module Card
      module Show
        extend self

        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

        def get_card(card_id)
          API::Card.find(card_id)
        end

        def get_checklist(card_id)
          API::Checklist.list_by_card_id(card_id)
        end

        def assert_card_id!(card_id, key)
          raise InvalidArgumentError.new("#{key.inspect} is not a valid card key") unless card_id
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
3llo-1.3.1 lib/3llo/command/card/show.rb
3llo-1.3.1.pre.rc.0 lib/3llo/command/card/show.rb
3llo-1.2.0 lib/3llo/command/card/show.rb
3llo-1.1.0 lib/3llo/command/card/show.rb
3llo-1.0.0 lib/3llo/command/card/show.rb
3llo-1.0.0.pre.rc.0 lib/3llo/command/card/show.rb