Sha256: 985d9e02ca80a459ed6bbc7f85682549b1252d373b310fa7b597243044dab58d

Contents?: true

Size: 708 Bytes

Versions: 3

Compression:

Stored size: 708 Bytes

Contents

module Troo
  class CreateList
    class << self
      def for(board, name)
        new(board, name).perform
      end
    end

    def initialize(board, name)
      @board = board
      @name  = name
    end

    def perform
      update_lists
    end

    private
    attr_reader :board, :name

    def update_lists
      return ListPersistence.for(create_list) if create_list
      false
    end

    def create_list
      @list ||= Trello::List.create(attributes)
    rescue Trello::InvalidAccessToken
      raise Troo::InvalidAccessToken
    rescue Trello::Error
      false
    end

    def attributes
      {
        name:     name,
        board_id: board.external_board_id
      }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
troo-0.0.7 lib/troo/actions/create_list.rb
troo-0.0.6 lib/troo/actions/create_list.rb
troo-0.0.5 lib/troo/actions/create_list.rb