about summary refs log tree commit diff
path: root/app/serializers
diff options
context:
space:
mode:
authorTakeshi Umeda <noel.yoshiba@gmail.com>2020-09-02 09:13:10 +0900
committerGitHub <noreply@github.com>2020-09-02 02:13:10 +0200
commit33ad850c982bbe03214e2e2870751920721c23af (patch)
tree99d4cf909c77a3310a6e029d9751a897c5e7146f /app/serializers
parent17340365bbf057314d3cb19ec20c5d74b52c6395 (diff)
Added account featured tags API (#11817)
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/rest/account_featured_tag_serializer.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/serializers/rest/account_featured_tag_serializer.rb b/app/serializers/rest/account_featured_tag_serializer.rb
new file mode 100644
index 000000000..d8d5fd68c
--- /dev/null
+++ b/app/serializers/rest/account_featured_tag_serializer.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class REST::AccountFeaturedTagSerializer < ActiveModel::Serializer
+  include RoutingHelper
+
+  attributes :id, :name, :url
+
+  def id
+    object.tag.id.to_s
+  end
+
+  def name
+    "##{object.name}"
+  end
+
+  def url
+    short_account_tag_url(object.account, object.tag)
+  end
+end