about summary refs log tree commit diff
path: root/app/lib/activitypub/adapter.rb
diff options
context:
space:
mode:
authorkibigo! <marrus-sh@users.noreply.github.com>2017-07-15 14:33:15 -0700
committerkibigo! <marrus-sh@users.noreply.github.com>2017-07-15 14:33:15 -0700
commit09cfc079b0958c42fe619e2d88c3f9fd1d7c7900 (patch)
tree156de790a5bec0fdf050e392bee8a64b220d3a9d /app/lib/activitypub/adapter.rb
parent08d021916db9e350259b925d7e562aa13ba37422 (diff)
parent695439775eacea081c7257aabab39d0ec6b492dc (diff)
Merge upstream (#81)
Diffstat (limited to 'app/lib/activitypub/adapter.rb')
-rw-r--r--app/lib/activitypub/adapter.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/lib/activitypub/adapter.rb b/app/lib/activitypub/adapter.rb
new file mode 100644
index 000000000..0a70207bc
--- /dev/null
+++ b/app/lib/activitypub/adapter.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class ActivityPub::Adapter < ActiveModelSerializers::Adapter::Base
+  def self.default_key_transform
+    :camel_lower
+  end
+
+  def serializable_hash(options = nil)
+    options = serialization_options(options)
+    serialized_hash = { '@context': 'https://www.w3.org/ns/activitystreams' }.merge(ActiveModelSerializers::Adapter::Attributes.new(serializer, instance_options).serializable_hash(options))
+    self.class.transform_key_casing!(serialized_hash, instance_options)
+  end
+end