diff options
author | Markus Koller <markus.koller.ext@siemens.com> | 2017-12-22 16:54:55 +0100 |
---|---|---|
committer | Markus Koller <markus.koller.ext@siemens.com> | 2018-02-08 13:30:34 +0100 |
commit | b7cd99c376c2f953f30a4bf982b69780e3d6985b (patch) | |
tree | 1a808da75fbc90fc332765cbe338a6ede7335a7a /lib/api/entities.rb | |
parent | bb2478c205932429e7e519aaaf2d9b655aecf860 (diff) | |
download | gitlab-ce-b7cd99c376c2f953f30a4bf982b69780e3d6985b.tar.gz |
Allow including custom attributes in API responses
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r-- | lib/api/entities.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 7838de13c56..dc8e2b26316 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -22,6 +22,7 @@ module API end expose :avatar_path, if: ->(user, options) { options.fetch(:only_path, false) && user.avatar_path } + expose :custom_attributes, using: 'API::Entities::CustomAttribute', if: :with_custom_attributes expose :web_url do |user, options| Gitlab::Routing.url_helpers.user_url(user) @@ -109,6 +110,8 @@ module API expose :star_count, :forks_count expose :last_activity_at + expose :custom_attributes, using: 'API::Entities::CustomAttribute', if: :with_custom_attributes + def self.preload_relation(projects_relation, options = {}) projects_relation.preload(:project_feature, :route) .preload(namespace: [:route, :owner], @@ -230,6 +233,8 @@ module API expose :parent_id end + expose :custom_attributes, using: 'API::Entities::CustomAttribute', if: :with_custom_attributes + expose :statistics, if: :statistics do with_options format_with: -> (value) { value.to_i } do expose :storage_size |