class DiasporaFederation::Entities::RelatedEntity

Entity meta informations for a related entity (parent or target of another entity).

Public Class Methods

fetch(author, type, guid) click to toggle source

Get related entity from the backend or fetch it from remote if not available locally @return [RelatedEntity] fetched related entity

# File lib/diaspora_federation/entities/related_entity.rb, line 39
def self.fetch(author, type, guid)
  # Try to fetch locally
  entity = DiasporaFederation.callbacks.trigger(:fetch_related_entity, type, guid)
  return entity if entity

  # Fetch and receive entity from remote if not available locally
  Federation::Fetcher.fetch_public(author, type, guid)
  DiasporaFederation.callbacks.trigger(:fetch_related_entity, type, guid)
end

Public Instance Methods

root() click to toggle source

The root entity, this entity is responsible for relaying relayables @return [RelatedEntity] absolute parent entity

# File lib/diaspora_federation/entities/related_entity.rb, line 31
def root
  root = self
  root = root.parent until root.parent.nil?
  root
end
to_json(*_args) click to toggle source

never add {RelatedEntity} to json

# File lib/diaspora_federation/entities/related_entity.rb, line 55
def to_json(*_args)
  nil
end
to_xml() click to toggle source

never add {RelatedEntity} to xml

# File lib/diaspora_federation/entities/related_entity.rb, line 50
def to_xml
  nil
end