Class: DiasporaFederation::Entities::Retraction
- Inherits:
-
DiasporaFederation::Entity
- Object
- DiasporaFederation::Entity
- DiasporaFederation::Entities::Retraction
- Defined in:
- lib/diaspora_federation/entities/retraction.rb
Overview
This entity represents a claim of deletion of a previously federated entity.
Defined Under Namespace
Classes: TargetNotFound
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 person who deletes the entity.
-
#target ⇒ RelatedEntity
readonly
Target entity.
-
#target_guid ⇒ String
readonly
Guid of the entity to be deleted.
-
#target_type ⇒ String
readonly
A string describing the type of the target.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Retraction
Instance.
Instance Method Summary collapse
- #sender_valid?(sender) ⇒ Boolean
-
#to_s ⇒ String
String representation of this object.
Methods inherited from DiasporaFederation::Entity
class_name, entity_class, entity_name, from_json, from_xml, #initialize, #to_h, #to_json, #to_xml
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 person who deletes the entity
13 |
# File 'lib/diaspora_federation/entities/retraction.rb', line 13 property :author, :string |
#target ⇒ RelatedEntity (readonly)
Target entity
28 |
# File 'lib/diaspora_federation/entities/retraction.rb', line 28 entity :target, Entities::RelatedEntity |
#target_guid ⇒ String (readonly)
Guid of the entity to be deleted
18 |
# File 'lib/diaspora_federation/entities/retraction.rb', line 18 property :target_guid, :string |
#target_type ⇒ String (readonly)
A string describing the type of the target
23 |
# File 'lib/diaspora_federation/entities/retraction.rb', line 23 property :target_type, :string |
Class Method Details
.from_hash(hash) ⇒ Retraction
Returns instance.
46 47 48 49 |
# File 'lib/diaspora_federation/entities/retraction.rb', line 46 def self.from_hash(hash) hash[:target] = fetch_target(hash[:target_type], hash[:target_guid]) new(hash) end |
Instance Method Details
#sender_valid?(sender) ⇒ Boolean
30 31 32 33 34 35 36 37 |
# File 'lib/diaspora_federation/entities/retraction.rb', line 30 def sender_valid?(sender) case target_type when "Comment", "Like", "PollParticipation" [target.root., target.].include?(sender) else sender == target. end end |
#to_s ⇒ String
Returns string representation of this object.
40 41 42 |
# File 'lib/diaspora_federation/entities/retraction.rb', line 40 def to_s "Retraction:#{target_type}:#{target_guid}" end |