Class: DiasporaFederation::Entities::RelatedEntity
- Inherits:
-
DiasporaFederation::Entity
- Object
- DiasporaFederation::Entity
- DiasporaFederation::Entities::RelatedEntity
- Defined in:
- lib/diaspora_federation/entities/related_entity.rb
Overview
Entity meta informations for a related entity (parent or target of another entity).
Constant Summary
Constants inherited from DiasporaFederation::Entity
DiasporaFederation::Entity::ENTITY_NAME_REGEX, DiasporaFederation::Entity::INVALID_XML_REGEX
Instance Attribute Summary collapse
-
#author ⇒ String
readonly
The diaspora* ID of the author.
-
#local ⇒ Boolean
readonly
true
if the owner of the entity is local on the pod. -
#parent ⇒ RelatedEntity
readonly
Parent if the entity also has a parent (Comment or Like) or
nil
if it has no parent. -
#public ⇒ Boolean
readonly
Shows whether the entity is visible to everyone or only to some aspects.
Class Method Summary collapse
-
.fetch(author, type, guid) ⇒ RelatedEntity
Get related entity from the backend or fetch it from remote if not available locally.
Instance Method Summary collapse
-
#root ⇒ RelatedEntity
The root entity, this entity is responsible for relaying relayables.
-
#to_json(*_args) ⇒ Object
never add RelatedEntity to json.
-
#to_xml ⇒ Object
never add RelatedEntity to xml.
Methods inherited from DiasporaFederation::Entity
class_name, entity_class, entity_name, from_hash, from_json, from_xml, #initialize, #to_h, #to_s
Methods included from PropertiesDSL
#class_props, #default_values, #entity, #missing_props, #optional_props, #property, #resolv_aliases
Methods included from Logging
Constructor Details
This class inherits a constructor from DiasporaFederation::Entity
Instance Attribute Details
#author ⇒ String (readonly)
The diaspora* ID of the author
12 |
# File 'lib/diaspora_federation/entities/related_entity.rb', line 12 property :author, :string |
#local ⇒ Boolean (readonly)
true
if the owner of the entity is local on the pod
17 |
# File 'lib/diaspora_federation/entities/related_entity.rb', line 17 property :local, :boolean |
#parent ⇒ RelatedEntity (readonly)
Parent if the entity also has a parent (Comment or Like) or nil
if it has no parent
27 |
# File 'lib/diaspora_federation/entities/related_entity.rb', line 27 entity :parent, Entities::RelatedEntity, default: nil |
#public ⇒ Boolean (readonly)
Shows whether the entity is visible to everyone or only to some aspects
22 |
# File 'lib/diaspora_federation/entities/related_entity.rb', line 22 property :public, :boolean, default: false |
Class Method Details
.fetch(author, type, guid) ⇒ RelatedEntity
Get related entity from the backend or fetch it from remote if not available locally
39 40 41 42 43 44 45 46 47 |
# File 'lib/diaspora_federation/entities/related_entity.rb', line 39 def self.fetch(, 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(, type, guid) DiasporaFederation.callbacks.trigger(:fetch_related_entity, type, guid) end |
Instance Method Details
#root ⇒ RelatedEntity
The root entity, this entity is responsible for relaying relayables
31 32 33 34 35 |
# 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) ⇒ Object
never add DiasporaFederation::Entities::RelatedEntity to json
55 56 57 |
# File 'lib/diaspora_federation/entities/related_entity.rb', line 55 def to_json(*_args) nil end |
#to_xml ⇒ Object
never add DiasporaFederation::Entities::RelatedEntity to xml
50 51 52 |
# File 'lib/diaspora_federation/entities/related_entity.rb', line 50 def to_xml nil end |