Commit ee063b2c6b506286dd459474780745f45dbb7e02
Committed by
Rodrigo Souto
1 parent
6788cc21
Exists in
master
and in
29 other branches
api: passing fields parameter
Showing
1 changed file
with
9 additions
and
9 deletions
Show diff stats
lib/noosfero/api/v1/articles.rb
... | ... | @@ -20,13 +20,13 @@ module Noosfero |
20 | 20 | get do |
21 | 21 | articles = select_filtered_collection_of(environment, 'articles', params) |
22 | 22 | articles = articles.display_filter(current_person, nil) |
23 | - present articles, :with => Entities::Article | |
23 | + present articles, :with => Entities::Article, :fields => params[:fields] | |
24 | 24 | end |
25 | 25 | |
26 | 26 | desc "Return the article id" |
27 | 27 | get ':id' do |
28 | 28 | article = find_article(environment.articles, params[:id]) |
29 | - present article, :with => Entities::Article | |
29 | + present article, :with => Entities::Article, :fields => params[:fields] | |
30 | 30 | end |
31 | 31 | |
32 | 32 | get ':id/children' do |
... | ... | @@ -38,7 +38,7 @@ module Noosfero |
38 | 38 | |
39 | 39 | get ':id/children/:child_id' do |
40 | 40 | article = find_article(environment.articles, params[:id]) |
41 | - present find_article(article.children, params[:child_id]), :with => Entities::Article | |
41 | + present find_article(article.children, params[:child_id]), :with => Entities::Article, :fields => params[:fields] | |
42 | 42 | end |
43 | 43 | |
44 | 44 | # Example Request: |
... | ... | @@ -75,13 +75,13 @@ module Noosfero |
75 | 75 | community = environment.communities.find(params[:community_id]) |
76 | 76 | articles = select_filtered_collection_of(community, 'articles', params) |
77 | 77 | articles = articles.display_filter(current_person, community) |
78 | - present articles, :with => Entities::Article | |
78 | + present articles, :with => Entities::Article, :fields => params[:fields] | |
79 | 79 | end |
80 | 80 | |
81 | 81 | get ':id' do |
82 | 82 | community = environment.communities.find(params[:community_id]) |
83 | 83 | article = find_article(community.articles, params[:id]) |
84 | - present article, :with => Entities::Article | |
84 | + present article, :with => Entities::Article, :fields => params[:fields] | |
85 | 85 | end |
86 | 86 | |
87 | 87 | # Example Request: |
... | ... | @@ -116,13 +116,13 @@ module Noosfero |
116 | 116 | person = environment.people.find(params[:person_id]) |
117 | 117 | articles = select_filtered_collection_of(person, 'articles', params) |
118 | 118 | articles = articles.display_filter(current_person, person) |
119 | - present articles, :with => Entities::Article | |
119 | + present articles, :with => Entities::Article, :fields => params[:fields] | |
120 | 120 | end |
121 | 121 | |
122 | 122 | get ':id' do |
123 | 123 | person = environment.people.find(params[:person_id]) |
124 | 124 | article = find_article(person.articles, params[:id]) |
125 | - present article, :with => Entities::Article | |
125 | + present article, :with => Entities::Article, :fields => params[:fields] | |
126 | 126 | end |
127 | 127 | |
128 | 128 | post do |
... | ... | @@ -155,13 +155,13 @@ module Noosfero |
155 | 155 | enterprise = environment.enterprises.find(params[:enterprise_id]) |
156 | 156 | articles = select_filtered_collection_of(enterprise, 'articles', params) |
157 | 157 | articles = articles.display_filter(current_person, enterprise) |
158 | - present articles, :with => Entities::Article | |
158 | + present articles, :with => Entities::Article, :fields => params[:fields] | |
159 | 159 | end |
160 | 160 | |
161 | 161 | get ':id' do |
162 | 162 | enterprise = environment.enterprises.find(params[:enterprise_id]) |
163 | 163 | article = find_article(enterprise.articles, params[:id]) |
164 | - present article, :with => Entities::Article | |
164 | + present article, :with => Entities::Article, :fields => params[:fields] | |
165 | 165 | end |
166 | 166 | |
167 | 167 | post do | ... | ... |