diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2018-03-05 17:51:40 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-03-05 17:51:40 +0000 |
commit | 8fe880dc064e0e6cd10f7176ade7c312cfb37b90 (patch) | |
tree | fd52091357726e167d27690e5d1e99a981e1821d /lib/api/entities.rb | |
parent | 49f72d06654bd7bdea259154e1092a53aab57acc (diff) | |
download | gitlab-ce-8fe880dc064e0e6cd10f7176ade7c312cfb37b90.tar.gz |
Projects and groups badges API
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r-- | lib/api/entities.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 0c8ec7dd5f5..e5bcbface6b 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -1235,5 +1235,23 @@ module API expose :startline expose :project_id end + + class BasicBadgeDetails < Grape::Entity + expose :link_url + expose :image_url + expose :rendered_link_url do |badge, options| + badge.rendered_link_url(options.fetch(:project, nil)) + end + expose :rendered_image_url do |badge, options| + badge.rendered_image_url(options.fetch(:project, nil)) + end + end + + class Badge < BasicBadgeDetails + expose :id + expose :kind do |badge| + badge.type == 'ProjectBadge' ? 'project' : 'group' + end + end end end |