class Troo::Card

Public Class Methods

remote() click to toggle source

@return [Remote::Card]

# File lib/troo/models/card.rb, line 30
def remote
  Remote::Card
end
type() click to toggle source

@return [Symbol]

# File lib/troo/models/card.rb, line 35
def type
  :card
end

Public Instance Methods

board() click to toggle source

@return []

# File lib/troo/models/card.rb, line 52
def board
  @board ||= Troo::Board.retrieve(external_board_id)
end
comment_presenter(options = {}) click to toggle source

@param [Hash] @return []

# File lib/troo/models/card.rb, line 93
def comment_presenter(options = {})
  Presenters::Comment.new(self, options)
end
comments() click to toggle source

@return [Ohm::Set]

# File lib/troo/models/card.rb, line 62
def comments
  Troo::Comment.find(external_card_id: external_id)
end
decorator(options = {}) click to toggle source

@param [Hash] @return []

# File lib/troo/models/card.rb, line 81
def decorator(options = {})
  Decorators::Resource.new(self, options)
end
external_member_ids() click to toggle source

@return [Array, Array, String]

# File lib/troo/models/card.rb, line 41
def external_member_ids
  if @attributes[:external_member_ids].nil?
    []
  elsif @attributes[:external_member_ids].is_a?(Array)
    @attributes[:external_member_ids]
  else
    JSON(@attributes[:external_member_ids])
  end
end
list() click to toggle source

@return []

# File lib/troo/models/card.rb, line 57
def list
  @list ||= Troo::List.retrieve(external_list_id)
end
members() click to toggle source

@return [Array]

# File lib/troo/models/card.rb, line 72
def members
  return [] if external_member_ids.empty?
  @members ||= external_member_ids.map do |member_id|
    Troo::Member.retrieve(member_id)
  end.compact
end
presenter(options = {}) click to toggle source

@param [Hash] @return [Troo::Presenters::Card]

# File lib/troo/models/card.rb, line 87
def presenter(options = {})
  Presenters::Card.new(self, options)
end
recent_comments() click to toggle source

@return []

# File lib/troo/models/card.rb, line 67
def recent_comments
  comments.sort(by: :date, limit: [0, 3])
end
type() click to toggle source

@return [Symbol]

# File lib/troo/models/card.rb, line 98
def type
  self.class.type
end