Commit 3e5d1d55e79de671e45497617a542d1aa008fb0c
Committed by
Rodrigo Souto
1 parent
fa0a9ba7
Exists in
master
and in
29 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 | 49 | expose :image, :using => Image |
| 50 | 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 | 62 | class Article < Grape::Entity |
| 54 | 63 | root 'articles', 'article' |
| ... | ... | @@ -59,8 +68,9 @@ module Noosfero |
| 59 | 68 | expose :profile, :using => Profile |
| 60 | 69 | expose :categories, :using => Category |
| 61 | 70 | expose :parent, :using => Article |
| 71 | + expose :children, :using => ArticleChild | |
| 62 | 72 | end |
| 63 | - | |
| 73 | + | |
| 64 | 74 | class Comment < Grape::Entity |
| 65 | 75 | root 'comments', 'comment' |
| 66 | 76 | expose :body, :title, :id | ... | ... |