diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 15:09:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 15:09:42 +0300 |
commit | 729e3765d5feb762df1ccfbc228a8dd4662aa3f9 (patch) | |
tree | f326420fc64999c6bcc28816ed54f0972fb46459 /lib/api | |
parent | 6f7881ee9dcec34141a8f34fc814b56b366d2b48 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/entities/event.rb | 1 | ||||
-rw-r--r-- | lib/api/entities/group.rb | 1 | ||||
-rw-r--r-- | lib/api/entities/release.rb | 2 | ||||
-rw-r--r-- | lib/api/entities/releases/evidence.rb | 15 | ||||
-rw-r--r-- | lib/api/helpers/presentable.rb | 3 |
5 files changed, 21 insertions, 1 deletions
diff --git a/lib/api/entities/event.rb b/lib/api/entities/event.rb index 9c2d766b7f1..8fd0bac13f4 100644 --- a/lib/api/entities/event.rb +++ b/lib/api/entities/event.rb @@ -9,6 +9,7 @@ module API expose :created_at expose :note, using: Entities::Note, if: ->(event, options) { event.note? } expose :author, using: Entities::UserBasic, if: ->(event, options) { event.author } + expose :wiki_page, using: Entities::WikiPageBasic, if: ->(event, _options) { event.wiki_page? } expose :push_event_payload, as: :push_data, diff --git a/lib/api/entities/group.rb b/lib/api/entities/group.rb index 10e10e52d9f..8a6a5b7057c 100644 --- a/lib/api/entities/group.rb +++ b/lib/api/entities/group.rb @@ -19,6 +19,7 @@ module API end expose :request_access_enabled expose :full_name, :full_path + expose :created_at expose :parent_id expose :custom_attributes, using: 'API::Entities::CustomAttribute', if: :with_custom_attributes diff --git a/lib/api/entities/release.rb b/lib/api/entities/release.rb index c70982a9ece..edcd9bc6505 100644 --- a/lib/api/entities/release.rb +++ b/lib/api/entities/release.rb @@ -22,6 +22,7 @@ module API expose :commit_path, expose_nil: false expose :tag_path, expose_nil: false expose :evidence_sha, expose_nil: false, if: ->(_, _) { can_download_code? } + expose :assets do expose :assets_count, as: :count do |release, _| assets_to_exclude = can_download_code? ? [] : [:sources] @@ -33,6 +34,7 @@ module API end expose :evidence_file_path, expose_nil: false, if: ->(_, _) { can_download_code? } end + expose :evidences, using: Entities::Releases::Evidence, expose_nil: false, if: ->(_, _) { can_download_code? } expose :_links do expose :self_url, as: :self, expose_nil: false expose :merge_requests_url, expose_nil: false diff --git a/lib/api/entities/releases/evidence.rb b/lib/api/entities/releases/evidence.rb new file mode 100644 index 00000000000..25b2bf6bf6f --- /dev/null +++ b/lib/api/entities/releases/evidence.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module API + module Entities + module Releases + class Evidence < Grape::Entity + include ::API::Helpers::Presentable + + expose :summary_sha, as: :sha + expose :filepath + expose :collected_at + end + end + end +end diff --git a/lib/api/helpers/presentable.rb b/lib/api/helpers/presentable.rb index 973c2132efe..a5186cc56ea 100644 --- a/lib/api/helpers/presentable.rb +++ b/lib/api/helpers/presentable.rb @@ -4,7 +4,7 @@ module API module Helpers ## # This module makes it possible to use `app/presenters` with - # Grape Entities. It instantiates model presenter and passes + # Grape Entities. It instantiates the model presenter and passes # options defined in the API endpoint to the presenter itself. # # present object, with: Entities::Something, @@ -22,6 +22,7 @@ module API extend ActiveSupport::Concern def initialize(object, options = {}) + options = options.opts_hash if options.is_a?(Grape::Entity::Options) super(object.present(options), options) end end |