Commit 3e5d1d55e79de671e45497617a542d1aa008fb0c
Committed by
Rodrigo Souto
1 parent
fa0a9ba7
Exists in
master
and in
21 other branches
adding child for articles
Showing
1 changed file
with
11 additions
and
1 deletions
Show diff stats
lib/noosfero/api/entities.rb
@@ -49,6 +49,15 @@ module Noosfero | @@ -49,6 +49,15 @@ module Noosfero | ||
49 | expose :image, :using => Image | 49 | expose :image, :using => Image |
50 | end | 50 | end |
51 | 51 | ||
52 | + class ArticleChild < Grape::Entity | ||
53 | + root 'articles', 'article' | ||
54 | + expose :id, :body | ||
55 | + expose :created_at, :format_with => :timestamp | ||
56 | + expose :title, :documentation => {:type => "String", :desc => "Title of the article"} | ||
57 | + expose :created_by, :as => :author, :using => Profile | ||
58 | + expose :profile, :using => Profile | ||
59 | + expose :categories, :using => Category | ||
60 | + end | ||
52 | 61 | ||
53 | class Article < Grape::Entity | 62 | class Article < Grape::Entity |
54 | root 'articles', 'article' | 63 | root 'articles', 'article' |
@@ -59,8 +68,9 @@ module Noosfero | @@ -59,8 +68,9 @@ module Noosfero | ||
59 | expose :profile, :using => Profile | 68 | expose :profile, :using => Profile |
60 | expose :categories, :using => Category | 69 | expose :categories, :using => Category |
61 | expose :parent, :using => Article | 70 | expose :parent, :using => Article |
71 | + expose :children, :using => ArticleChild | ||
62 | end | 72 | end |
63 | - | 73 | + |
64 | class Comment < Grape::Entity | 74 | class Comment < Grape::Entity |
65 | root 'comments', 'comment' | 75 | root 'comments', 'comment' |
66 | expose :body, :title, :id | 76 | expose :body, :title, :id |