Sha256: df59fa8efc0303a0c792f992f7bd45f0a63a974c8b56e5cad5669ce01db08157

Contents?: true

Size: 679 Bytes

Versions: 1

Compression:

Stored size: 679 Bytes

Contents

module Troo
  class MoveCard
    class << self
      def with(card, list)
        new(card, list).perform
      end
    end

    def initialize(card, list)
      @card = card
      @list = list
    end

    def perform
      return update_cards if move_card
      false
    end

    private

    attr_reader :card, :list

    def update_cards
      Troo::External::Card.fetch(card.external_board_id)
    end

    def move_card
      Trello::Card.new
        .update_fields('id' => card.external_card_id)
        .move_to_list(list.external_list_id)
    rescue Trello::InvalidAccessToken
      raise Troo::InvalidAccessToken
    rescue Trello::Error
      false
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.8 lib/troo/actions/move_card.rb