Commit de1fe2d57853efd12a9f34f17d4f31f9078b1e75
1 parent
a8f6350a
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
addding the possibility to add new comments by api
Showing
2 changed files
with
6 additions
and
1 deletions
Show diff stats
lib/api/v1/articles.rb
| @@ -14,7 +14,7 @@ module API | @@ -14,7 +14,7 @@ module API | ||
| 14 | # limit - amount of comments returned. The default value is 20 | 14 | # limit - amount of comments returned. The default value is 20 |
| 15 | # | 15 | # |
| 16 | # Example Request: | 16 | # Example Request: |
| 17 | - # GET /articles?from=2013-04-04-14:41:43&until=2014-04-04-14:41:43&limit=10&type=Blog | 17 | + # GET /articles?from=2013-04-04-14:41:43&until=2014-04-04-14:41:43&limit=10&content_type=Hub |
| 18 | # desc 'Articles.', { | 18 | # desc 'Articles.', { |
| 19 | # :params => API::Entities::Article.documentation | 19 | # :params => API::Entities::Article.documentation |
| 20 | # } | 20 | # } |
lib/api/v1/comments.rb
| @@ -25,6 +25,11 @@ module API | @@ -25,6 +25,11 @@ module API | ||
| 25 | present environment.articles.find(params[:id]).comments.find(params[:comment_id]), :with => Entities::Comment | 25 | present environment.articles.find(params[:id]).comments.find(params[:comment_id]), :with => Entities::Comment |
| 26 | end | 26 | end |
| 27 | 27 | ||
| 28 | + # Example Request: | ||
| 29 | + # POST api/v1/articles/12/comments?private_toke=234298743290432&body=new comment | ||
| 30 | + post ":id/comments" do | ||
| 31 | + present environment.articles.find(params[:id]).comments.create(:author => current_user, :body => params[:body]), :with => Entities::Comment | ||
| 32 | + end | ||
| 28 | end | 33 | end |
| 29 | 34 | ||
| 30 | end | 35 | end |