about summary refs log tree commit diff
path: root/app/controllers/api/v1/trends_controller.rb
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-05-29 13:52:26 +0200
committerThibaut Girka <thib@sitedethib.com>2018-05-29 13:52:26 +0200
commitc087738270e7fb16b1d284e8dd72cf99b4238bb8 (patch)
tree23327fe190fd90589c9dc8d64e96fcf0b7d28ddd /app/controllers/api/v1/trends_controller.rb
parent8b98afa781018bc7cfdb325f6b1fca0b1edcd8cb (diff)
parent90908fc24ba57c877de75fe117b8cc234e29d4f0 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'app/controllers/api/v1/trends_controller.rb')
-rw-r--r--app/controllers/api/v1/trends_controller.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/api/v1/trends_controller.rb b/app/controllers/api/v1/trends_controller.rb
new file mode 100644
index 000000000..bcea9857e
--- /dev/null
+++ b/app/controllers/api/v1/trends_controller.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class Api::V1::TrendsController < Api::BaseController
+  before_action :set_tags
+
+  respond_to :json
+
+  def index
+    render json: @tags, each_serializer: REST::TagSerializer
+  end
+
+  private
+
+  def set_tags
+    @tags = TrendingTags.get(limit_param(10))
+  end
+end