Sha256: 4ec1572222ee25197fe0149f0ca0a600eedb253c0d7829dabb56994cae01523f

Contents?: true

Size: 953 Bytes

Versions: 1

Compression:

Stored size: 953 Bytes

Contents

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

    attribute :name
    attribute :position,         Type::Integer
    attribute :default,          Type::Boolean
    attribute :closed,           Type::Boolean
    attribute :external_board_id
    attribute :external_id
    attribute :short_id

    index :default
    index :external_board_id
    index :external_id
    index :short_id

    alias_method :default?,    :default

    class << self
      def remote
        Remote::List
      end

      def type
        :list
      end
    end

    def board
      Troo::Board.retrieve(external_board_id)
    end

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

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

    def presenter(options = {})
      Presenters::List.new(self, 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.10 lib/troo/models/list.rb