Commit 8c18e76d9d28ffad8ad326c1e98546620c1f5a14
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'api' into stable
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 | post ':id/vote' do |
| ... | ... | @@ -47,7 +47,7 @@ module Noosfero |
| 47 | 47 | |
| 48 | 48 | get ':id/children/:child_id' do |
| 49 | 49 | article = find_article(environment.articles, params[:id]) |
| 50 | - present find_article(article.children, params[:child_id]), :with => Entities::Article | |
| 50 | + present find_article(article.children, params[:child_id]), :with => Entities::Article, :fields => params[:fields] | |
| 51 | 51 | end |
| 52 | 52 | |
| 53 | 53 | # Example Request: |
| ... | ... | @@ -84,13 +84,13 @@ module Noosfero |
| 84 | 84 | community = environment.communities.find(params[:community_id]) |
| 85 | 85 | articles = select_filtered_collection_of(community, 'articles', params) |
| 86 | 86 | articles = articles.display_filter(current_person, community) |
| 87 | - present articles, :with => Entities::Article | |
| 87 | + present articles, :with => Entities::Article, :fields => params[:fields] | |
| 88 | 88 | end |
| 89 | 89 | |
| 90 | 90 | get ':id' do |
| 91 | 91 | community = environment.communities.find(params[:community_id]) |
| 92 | 92 | article = find_article(community.articles, params[:id]) |
| 93 | - present article, :with => Entities::Article | |
| 93 | + present article, :with => Entities::Article, :fields => params[:fields] | |
| 94 | 94 | end |
| 95 | 95 | |
| 96 | 96 | # Example Request: |
| ... | ... | @@ -125,13 +125,13 @@ module Noosfero |
| 125 | 125 | person = environment.people.find(params[:person_id]) |
| 126 | 126 | articles = select_filtered_collection_of(person, 'articles', params) |
| 127 | 127 | articles = articles.display_filter(current_person, person) |
| 128 | - present articles, :with => Entities::Article | |
| 128 | + present articles, :with => Entities::Article, :fields => params[:fields] | |
| 129 | 129 | end |
| 130 | 130 | |
| 131 | 131 | get ':id' do |
| 132 | 132 | person = environment.people.find(params[:person_id]) |
| 133 | 133 | article = find_article(person.articles, params[:id]) |
| 134 | - present article, :with => Entities::Article | |
| 134 | + present article, :with => Entities::Article, :fields => params[:fields] | |
| 135 | 135 | end |
| 136 | 136 | |
| 137 | 137 | post do |
| ... | ... | @@ -164,13 +164,13 @@ module Noosfero |
| 164 | 164 | enterprise = environment.enterprises.find(params[:enterprise_id]) |
| 165 | 165 | articles = select_filtered_collection_of(enterprise, 'articles', params) |
| 166 | 166 | articles = articles.display_filter(current_person, enterprise) |
| 167 | - present articles, :with => Entities::Article | |
| 167 | + present articles, :with => Entities::Article, :fields => params[:fields] | |
| 168 | 168 | end |
| 169 | 169 | |
| 170 | 170 | get ':id' do |
| 171 | 171 | enterprise = environment.enterprises.find(params[:enterprise_id]) |
| 172 | 172 | article = find_article(enterprise.articles, params[:id]) |
| 173 | - present article, :with => Entities::Article | |
| 173 | + present article, :with => Entities::Article, :fields => params[:fields] | |
| 174 | 174 | end |
| 175 | 175 | |
| 176 | 176 | post do | ... | ... |