Sha256: 73a118f675d1e557537918872b72c50f243bf18772d9e30d6fbc8b58cdf4ac4a

Contents?: true

Size: 870 Bytes

Versions: 1

Compression:

Stored size: 870 Bytes

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
      def remote
        Remote::Board
      end

      def type
        :board
      end
    end

    def lists
      Troo::List.find(external_board_id: external_id)
    end

    def cards
      Troo::Card.find(external_board_id: external_id)
    end

    def decorator(options = {})
      Decorators::Resource.new(self, options)
    end

    def presenter(options = {})
      Presenters::Board.new(decorator, options)
    end

    def type
      self.class.type
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.9 lib/troo/models/board.rb