Sha256: 5f3fd79f7a006e7e5c557b3c9c2820acfe64dacf1f263833e21e0f86f27c05ef

Contents?: true

Size: 911 Bytes

Versions: 1

Compression:

Stored size: 911 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_list_id

    index :default
    index :external_board_id
    index :external_list_id

    alias_method :default?, :default

    def self.remote(id, options = { mode: :list })
      External::List.fetch(id, options).first
    end

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

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

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

    def presenter(options = {})
      Presenters::List.new(self, options)
    end

    def set_default!
      Behaviours::SetDefault.for(self)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.8 lib/troo/models/list.rb