class DiasporaFederation::Entities::Retraction
This entity represents a claim of deletion of a previously federated entity.
Public Class Methods
from_hash(hash)
click to toggle source
@see Entity.from_hash
@return [Retraction] instance
# 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
Private Class Methods
fetch_target(target_type, target_guid)
click to toggle source
# File lib/diaspora_federation/entities/retraction.rb, line 51 def self.fetch_target(target_type, target_guid) DiasporaFederation.callbacks.trigger(:fetch_related_entity, target_type, target_guid).tap do |target| raise TargetNotFound, "not found: #{target_type}:#{target_guid}" unless target end end
Public Instance Methods
sender_valid?(sender)
click to toggle source
# File lib/diaspora_federation/entities/retraction.rb, line 30 def sender_valid?(sender) case target_type when "Comment", "Like", "PollParticipation" [target.root.author, target.author].include?(sender) else sender == target.author end end
to_s()
click to toggle source
@return [String] string representation of this object
# File lib/diaspora_federation/entities/retraction.rb, line 40 def to_s "Retraction:#{target_type}:#{target_guid}" end