Sha256: 8f31b82c75fd2990f5411658bafebc98ed8168b8200cc2e85612fe80efcc869b

Contents?: true

Size: 789 Bytes

Versions: 3

Compression:

Stored size: 789 Bytes

Contents

module Troo
  class CreateBoard
    class << self
      def with(name, description = nil)
        new(name, description).perform
      end
    end

    attr_reader :name

    def initialize(name, description = nil)
      @name        = name
      @description = description
    end

    def perform
      update_boards
    end

    private
    attr_reader :name, :description

    def update_boards
      return BoardPersistence.for(create_board) if create_board
      false
    end

    def create_board
      @board ||= Trello::Board.create(attributes)
    rescue Trello::InvalidAccessToken
      raise Troo::InvalidAccessToken
    rescue Trello::Error
      false
    end

    def attributes
      {
        name:        name,
        description: description
      }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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