This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2017-07-14 18:01:39 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ActivityPub::Adapter < ActiveModelSerializers::Adapter::Base
|
|
|
|
def self.default_key_transform
|
|
|
|
:camel_lower
|
|
|
|
end
|
|
|
|
|
2017-08-12 08:41:03 -07:00
|
|
|
def self.transform_key_casing!(value, _options)
|
|
|
|
ActivityPub::CaseTransform.camel_lower(value)
|
|
|
|
end
|
|
|
|
|
2017-07-14 18:01:39 -07:00
|
|
|
def serializable_hash(options = nil)
|
|
|
|
options = serialization_options(options)
|
2017-08-26 04:47:38 -07:00
|
|
|
serialized_hash = { '@context': [ActivityPub::TagManager::CONTEXT, 'https://w3id.org/security/v1'] }.merge(ActiveModelSerializers::Adapter::Attributes.new(serializer, instance_options).serializable_hash(options))
|
2017-07-14 18:01:39 -07:00
|
|
|
self.class.transform_key_casing!(serialized_hash, instance_options)
|
|
|
|
end
|
|
|
|
end
|