From 830e902c18217fb0ad03feab2feb12655610ba1a Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Fri, 17 Apr 2015 12:33:25 -0300 Subject: [PATCH] api: refactor article listing --- lib/noosfero/api/entities.rb | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/noosfero/api/entities.rb b/lib/noosfero/api/entities.rb index 00af816..ae003e2 100644 --- a/lib/noosfero/api/entities.rb +++ b/lib/noosfero/api/entities.rb @@ -53,7 +53,7 @@ module Noosfero expose :image, :using => Image end - class ArticleChild < Entity + class ArticleBase < Entity root 'articles', 'article' expose :id, :body, :abstract expose :created_at, :format_with => :timestamp @@ -64,18 +64,10 @@ module Noosfero expose :image, :using => Image end - class Article < Entity + class Article < ArticleBase root 'articles', 'article' - expose :id, :body, :abstract - 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 - # FIXME: create a method that overrides expose and include conditions for return attributes - expose :parent, :using => Article - expose :children, :using => ArticleChild - expose :image, :using => Image + expose :parent, :using => ArticleBase + expose :children, :using => ArticleBase end class Comment < Entity -- libgit2 0.21.2