Sha256: 5548d8bbdd76b9191ea99c84f47ee534b37fbb48c6063c6067dcfcad6bd112ba
Contents?: true
Size: 1.35 KB
Versions: 3
Compression:
Stored size: 1.35 KB
Contents
module Troo class Card < Ohm::Model include Ohm::DataTypes include ModelHelpers attribute :short_id attribute :name attribute :desc attribute :url attribute :external_member_ids, Type::Array attribute :position attribute :last_activity_date attribute :default, Type::Boolean attribute :closed, Type::Boolean attribute :external_board_id attribute :external_list_id attribute :external_card_id index :short_id index :default index :external_board_id index :external_list_id index :external_card_id alias_method :default?, :default def board BoardRetrieval.retrieve(self.external_board_id) end def list ListRetrieval.retrieve(self.external_list_id) end def comments Troo::Comment.find(external_card_id: self.external_card_id) end def recent_comments comments.sort(by: :date, limit: [0, 3]) end def members if external_member_ids.any? m = external_member_ids.map do |external_member_id| Troo::Member.first(external_member_id: external_member_id) end.compact else [] end end def decorator(options = {}) CardDecorator.new(self, options) end def presenter CardPresenter.new(self) end def set_default! SetDefault.for(self) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
troo-0.0.7 | lib/troo/models/card.rb |
troo-0.0.6 | lib/troo/models/card.rb |
troo-0.0.5 | lib/troo/models/card.rb |