Sha256: 88bddfaa5e66c8b34e72403547f3fe64451931eaacb5fd22dba071eb7beb3d6a

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

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
      # @return [Remote::List]
      def remote
        Remote::List
      end

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

    # @return []
    def board
      Troo::Board.retrieve(external_board_id)
    end

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

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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

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