Commit f6bbf0e60384a5d8a3ee15b2b5ae81d6482c2807
Committed by
Rodrigo Souto
1 parent
36c88d59
Exists in
master
and in
29 other branches
exposing profile image for articles on api
Showing
1 changed file
with
11 additions
and
0 deletions
Show diff stats
lib/api/entities.rb
| @@ -16,6 +16,17 @@ module API | @@ -16,6 +16,17 @@ module API | ||
| 16 | } | 16 | } |
| 17 | end | 17 | end |
| 18 | 18 | ||
| 19 | + expose :profile do |article, options| | ||
| 20 | + { | ||
| 21 | + :id => article.profile.id, | ||
| 22 | + :name => article.profile.name, | ||
| 23 | + :icon_url => article.profile.profile_custom_image(:icon), | ||
| 24 | + :minor_url => article.profile.profile_custom_image(:minor), | ||
| 25 | + :portrait_url => article.profile.profile_custom_image(:portrait), | ||
| 26 | + :thumb_url => article.profile.profile_custom_image(:thumb), | ||
| 27 | + } | ||
| 28 | + end | ||
| 29 | + | ||
| 19 | end | 30 | end |
| 20 | 31 | ||
| 21 | class Comment < Grape::Entity | 32 | class Comment < Grape::Entity |