From cdc871a01cea9522647f72b1c6cec684e64f06fa Mon Sep 17 00:00:00 2001 From: Leandro Nunes dos Santos Date: Tue, 8 Apr 2014 17:40:55 -0300 Subject: [PATCH] addding the possibility to add new comments by api --- lib/api/v1/articles.rb | 2 +- lib/api/v1/comments.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/api/v1/articles.rb b/lib/api/v1/articles.rb index 9543b28..450bfdc 100644 --- a/lib/api/v1/articles.rb +++ b/lib/api/v1/articles.rb @@ -14,7 +14,7 @@ module API # limit - amount of comments returned. The default value is 20 # # Example Request: - # GET /articles?from=2013-04-04-14:41:43&until=2014-04-04-14:41:43&limit=10&type=Blog + # GET /articles?from=2013-04-04-14:41:43&until=2014-04-04-14:41:43&limit=10&content_type=Hub # desc 'Articles.', { # :params => API::Entities::Article.documentation # } diff --git a/lib/api/v1/comments.rb b/lib/api/v1/comments.rb index df6000f..f9d7956 100644 --- a/lib/api/v1/comments.rb +++ b/lib/api/v1/comments.rb @@ -25,6 +25,11 @@ module API present environment.articles.find(params[:id]).comments.find(params[:comment_id]), :with => Entities::Comment end + # Example Request: + # POST api/v1/articles/12/comments?private_toke=234298743290432&body=new comment + post ":id/comments" do + present environment.articles.find(params[:id]).comments.create(:author => current_user, :body => params[:body]), :with => Entities::Comment + end end end -- libgit2 0.21.2