about summary refs log tree commit diff
path: root/app/serializers/rest/domain_block_serializer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers/rest/domain_block_serializer.rb')
-rw-r--r--app/serializers/rest/domain_block_serializer.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/serializers/rest/domain_block_serializer.rb b/app/serializers/rest/domain_block_serializer.rb
new file mode 100644
index 000000000..678463e13
--- /dev/null
+++ b/app/serializers/rest/domain_block_serializer.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class REST::DomainBlockSerializer < ActiveModel::Serializer
+  attributes :domain, :digest, :severity, :comment
+
+  def domain
+    object.public_domain
+  end
+
+  def digest
+    object.domain_digest
+  end
+
+  def comment
+    object.public_comment if instance_options[:with_comment]
+  end
+end