Commit 830e902c18217fb0ad03feab2feb12655610ba1a
Committed by
Rodrigo Souto
1 parent
ccbb6e12
Exists in
master
and in
21 other branches
api: refactor article listing
Showing
1 changed file
with
4 additions
and
12 deletions
Show diff stats
lib/noosfero/api/entities.rb
@@ -53,7 +53,7 @@ module Noosfero | @@ -53,7 +53,7 @@ module Noosfero | ||
53 | expose :image, :using => Image | 53 | expose :image, :using => Image |
54 | end | 54 | end |
55 | 55 | ||
56 | - class ArticleChild < Entity | 56 | + class ArticleBase < Entity |
57 | root 'articles', 'article' | 57 | root 'articles', 'article' |
58 | expose :id, :body, :abstract | 58 | expose :id, :body, :abstract |
59 | expose :created_at, :format_with => :timestamp | 59 | expose :created_at, :format_with => :timestamp |
@@ -64,18 +64,10 @@ module Noosfero | @@ -64,18 +64,10 @@ module Noosfero | ||
64 | expose :image, :using => Image | 64 | expose :image, :using => Image |
65 | end | 65 | end |
66 | 66 | ||
67 | - class Article < Entity | 67 | + class Article < ArticleBase |
68 | root 'articles', 'article' | 68 | root 'articles', 'article' |
69 | - expose :id, :body, :abstract | ||
70 | - expose :created_at, :format_with => :timestamp | ||
71 | - expose :title, :documentation => {:type => "String", :desc => "Title of the article"} | ||
72 | - expose :created_by, :as => :author, :using => Profile | ||
73 | - expose :profile, :using => Profile | ||
74 | - expose :categories, :using => Category | ||
75 | - # FIXME: create a method that overrides expose and include conditions for return attributes | ||
76 | - expose :parent, :using => Article | ||
77 | - expose :children, :using => ArticleChild | ||
78 | - expose :image, :using => Image | 69 | + expose :parent, :using => ArticleBase |
70 | + expose :children, :using => ArticleBase | ||
79 | end | 71 | end |
80 | 72 | ||
81 | class Comment < Entity | 73 | class Comment < Entity |