Sha256: be9313eedd9cf17c4b87867d374d4b7be89e894cc2ef327cd77478806290f89a

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

module Troo
  class Board < Ohm::Model
    include Ohm::DataTypes
    include ModelHelpers

    attribute :name
    attribute :description
    attribute :default,     Type::Boolean
    attribute :closed,      Type::Boolean
    attribute :external_id
    attribute :short_id

    index :default
    index :external_id
    index :short_id

    alias_method :default?,    :default

    class << self
      # @return [Remote::Board]
      def remote
        Remote::Board
      end

      # @return [Symbol]
      def type
        :board
      end
    end

    # @return [Ohm::Set]
    def lists
      Troo::List.find(external_board_id: external_id)
    end

    # @return [Ohm::Set]
    def cards
      Troo::Card.find(external_board_id: external_id)
    end

    # @param  [Hash]
    # @return []
    def decorator(options = {})
      Decorators::Resource.new(self, options)
    end

    # @param  [Hash]
    # @return [Troo::Presenters::Board]
    def presenter(options = {})
      Presenters::Board.new(self, options)
    end

    # @return [Symbol]
    def type
      self.class.type
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
troo-0.0.15 lib/troo/models/board.rb
troo-0.0.14 lib/troo/models/board.rb
troo-0.0.13 lib/troo/models/board.rb
troo-0.0.12 lib/troo/models/board.rb