diaspora/lib/diaspora/federated/base.rb
Benjamin Neff 7184d4334e remove after_dispatch hook
handle photos in StatusMessageCreationService
2016-06-26 06:21:00 +02:00

48 lines
1.2 KiB
Ruby

# Copyright (c) 2010-2012, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
#the base level federation contract, which right now means that the object
#can be serialized and deserialized from xml, and respond to methods
#in the federation flow
#including this module lets you federate an object at the most basic of level
module Diaspora
module Federated
module Base
include Diaspora::Logging
def self.included(model)
model.instance_eval do
include ROXML
include Diaspora::Federated::Base::InstanceMethods
end
end
module InstanceMethods
def to_diaspora_xml
xml = to_xml
::Logging::Logger["XMLLogger"].debug "to_xml: #{xml}"
<<-XML
<XML>
<post>#{xml}</post>
</XML>
XML
end
def x(input)
input.to_s.to_xs
end
# @abstract
# @note this must return [Array<Person>]
# @return [Array<Person>]
def subscribers
raise 'You must override subscribers in order to enable federation on this model'
end
end
end
end
end