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, #find_property_for_xml_name, #missing_props, #optional_props, #property, #resolv_aliases, #xml_names
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
11 |
# File 'lib/diaspora_federation/entities/retraction.rb', line 11 property :author, :string, xml_name: :diaspora_handle |
#target ⇒ RelatedEntity (readonly)
Target entity
26 |
# File 'lib/diaspora_federation/entities/retraction.rb', line 26 entity :target, Entities::RelatedEntity |
#target_guid ⇒ String (readonly)
Guid of the entity to be deleted
16 |
# File 'lib/diaspora_federation/entities/retraction.rb', line 16 property :target_guid, :string, xml_name: :post_guid |
#target_type ⇒ String (readonly)
A string describing the type of the target
21 |
# File 'lib/diaspora_federation/entities/retraction.rb', line 21 property :target_type, :string, xml_name: :type |
Class Method Details
.from_hash(hash) ⇒ Retraction
Returns instance.
44 45 46 47 |
# File 'lib/diaspora_federation/entities/retraction.rb', line 44 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
28 29 30 31 32 33 34 35 |
# File 'lib/diaspora_federation/entities/retraction.rb', line 28 def sender_valid?(sender) case target_type when "Comment", "Like", "PollParticipation" sender == target. || sender == target.root. else sender == target. end end |
#to_s ⇒ String
Returns string representation of this object.
38 39 40 |
# File 'lib/diaspora_federation/entities/retraction.rb', line 38 def to_s "Retraction:#{target_type}:#{target_guid}" end |