Sha256: 6ea93d6a32a5d77fd7cfa78739f58b4eb7d1ab768715b884285a0bf1efc27783

Contents?: true

Size: 972 Bytes

Versions: 8

Compression:

Stored size: 972 Bytes

Contents

module Tr3llo
  module Command
    module Card
      class MoveCommand
        def initialize(card_id, board_id)
          @card_id = card_id
          @board_id = board_id
        end

        def execute
          interface.print_frame do
            list_id = prompt_for_list_id!(board_id)
            move_card!(list_id)
            interface.puts("Card has been moved.")
          end
        end

        private

        attr_reader :card_id, :board_id

        def prompt_for_list_id!(board_id)
          board_id = $container.resolve(:board)[:id]
          lists = Tr3llo::API::List.find_all_by_board(board_id)

          @list_id =
            Tr3llo::Presenter::Card::MovePresenter
            .new(interface)
            .prompt_for_list_id(lists)
        end

        def move_card!(list_id)
          API::Card.move_to_list(card_id, list_id)
        end

        def interface
          $container.resolve(:interface)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
3llo-0.3.1 lib/3llo/commands/card/move.rb
3llo-0.3.0 lib/3llo/commands/card/move.rb
3llo-0.2.0 lib/3llo/commands/card/move.rb
3llo-0.1.12 lib/3llo/commands/card/move.rb
3llo-0.1.11 lib/3llo/commands/card/move.rb
3llo-0.1.10 lib/3llo/commands/card/move.rb
3llo-0.1.9 lib/3llo/commands/card/move.rb
3llo-0.1.9.beta lib/3llo/commands/card/move.rb