From 3e5d1d55e79de671e45497617a542d1aa008fb0c Mon Sep 17 00:00:00 2001 From: Leandro Nunes dos Santos Date: Mon, 13 Apr 2015 23:48:31 -0300 Subject: [PATCH] adding child for articles --- lib/noosfero/api/entities.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/noosfero/api/entities.rb b/lib/noosfero/api/entities.rb index 36586ed..2254565 100644 --- a/lib/noosfero/api/entities.rb +++ b/lib/noosfero/api/entities.rb @@ -49,6 +49,15 @@ module Noosfero expose :image, :using => Image end + class ArticleChild < Grape::Entity + root 'articles', 'article' + expose :id, :body + expose :created_at, :format_with => :timestamp + expose :title, :documentation => {:type => "String", :desc => "Title of the article"} + expose :created_by, :as => :author, :using => Profile + expose :profile, :using => Profile + expose :categories, :using => Category + end class Article < Grape::Entity root 'articles', 'article' @@ -59,8 +68,9 @@ module Noosfero expose :profile, :using => Profile expose :categories, :using => Category expose :parent, :using => Article + expose :children, :using => ArticleChild end - + class Comment < Grape::Entity root 'comments', 'comment' expose :body, :title, :id -- libgit2 0.21.2