diaspora/app/serializers/serializer_post_processing.rb
cmrd Senya 7374661e2f
Update the user data export archive format.
This commit introduces changes to the user data export archive format.
This extends data set which is included in the archive. This data can be
then imported to other pods when this feature is implemented.

Also the commit adds the archive format json schema. ATM it is used in
automatic tests only, but in future it will also be used to validate
incoming archives.
2017-08-10 09:36:26 +03:00

20 lines
977 B
Ruby

# This module encapsulates knowledge about the way AMS works with the serializable object.
# The main responsibility of this module is to allow changing resulting object just before the
# JSON serialization happens.
module SerializerPostProcessing
# serializable_object output is used in AMS to produce a hash from input object that is passed to JSON serializer.
# serializable_object of ActiveModel::Serializer is not documented as officialy available API
# NOTE: if we ever move to AMS 0.10, this method was renamed there to serializable_hash
def serializable_object(options={})
modify_serializable_object(super)
end
# Users of this module may override this method in order to change serializable_object after
# the serializable hash generation and before its serialization.
def modify_serializable_object(hash)
hash
end
# except is an array of keys that are excluded from serialized_object before JSON serialization
attr_accessor :except
end