From 8898935c1b2438a939525942de0c31338f36a13e Mon Sep 17 00:00:00 2001 From: Caio SBA Date: Mon, 16 May 2016 09:59:22 -0300 Subject: [PATCH] Ticket #45: Adding APi endpoint to get environment tags --- app/api/v1/tags.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/api/v1/tags.rb b/app/api/v1/tags.rb index cdfa380..37a4db8 100644 --- a/app/api/v1/tags.rb +++ b/app/api/v1/tags.rb @@ -1,12 +1,8 @@ module Api module V1 class Tags < Grape::API - before { authenticate! } - resource :articles do - resource ':id/tags' do - get do article = find_article(environment.articles, params[:id]) present article.tag_list @@ -14,6 +10,7 @@ module Api desc "Add a tag to an article" post do + authenticate! article = find_article(environment.articles, params[:id]) article.tag_list=params[:tags] article.save @@ -21,6 +18,13 @@ module Api end end end + + resource :environment do + desc 'Return the tag counts for this environment' + get '/tags' do + present environment.tag_counts + end + end end end end -- libgit2 0.21.2