diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-15 12:09:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-15 12:09:03 +0300 |
commit | 4c8b21b315f3454aec254dba4eeb0bfcb75e82a5 (patch) | |
tree | 4e59806ecc8712d1ce54ad06d78d01eecacb924f /lib | |
parent | a7d1525878904f2f8326baf1c8108f2204ac50cb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities.rb | 41 | ||||
-rw-r--r-- | lib/api/entities/pipeline.rb | 17 | ||||
-rw-r--r-- | lib/api/entities/pipeline_schedule.rb | 12 | ||||
-rw-r--r-- | lib/api/entities/pipeline_schedule_details.rb | 10 | ||||
-rw-r--r-- | lib/api/entities/trigger.rb | 15 | ||||
-rw-r--r-- | lib/api/entities/variable.rb | 12 |
6 files changed, 66 insertions, 41 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index c0970b4cd6c..479d662f3f5 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -128,47 +128,6 @@ module API projects_relation + projects_relation.map(&:forked_from_project).compact end end - - class Trigger < Grape::Entity - include ::API::Helpers::Presentable - - expose :id - expose :token - expose :description - expose :created_at, :updated_at, :last_used - expose :owner, using: Entities::UserBasic - end - - class Variable < Grape::Entity - expose :variable_type, :key, :value - expose :protected?, as: :protected, if: -> (entity, _) { entity.respond_to?(:protected?) } - expose :masked?, as: :masked, if: -> (entity, _) { entity.respond_to?(:masked?) } - expose :environment_scope, if: -> (entity, _) { entity.respond_to?(:environment_scope) } - end - - class Pipeline < PipelineBasic - expose :before_sha, :tag, :yaml_errors - - expose :user, with: Entities::UserBasic - expose :created_at, :updated_at, :started_at, :finished_at, :committed_at - expose :duration - expose :coverage - expose :detailed_status, using: DetailedStatusEntity do |pipeline, options| - pipeline.detailed_status(options[:current_user]) - end - end - - class PipelineSchedule < Grape::Entity - expose :id - expose :description, :ref, :cron, :cron_timezone, :next_run_at, :active - expose :created_at, :updated_at - expose :owner, using: Entities::UserBasic - end - - class PipelineScheduleDetails < PipelineSchedule - expose :last_pipeline, using: Entities::PipelineBasic - expose :variables, using: Entities::Variable - end end end diff --git a/lib/api/entities/pipeline.rb b/lib/api/entities/pipeline.rb new file mode 100644 index 00000000000..778efbe4bcc --- /dev/null +++ b/lib/api/entities/pipeline.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module API + module Entities + class Pipeline < Entities::PipelineBasic + expose :before_sha, :tag, :yaml_errors + + expose :user, with: Entities::UserBasic + expose :created_at, :updated_at, :started_at, :finished_at, :committed_at + expose :duration + expose :coverage + expose :detailed_status, using: DetailedStatusEntity do |pipeline, options| + pipeline.detailed_status(options[:current_user]) + end + end + end +end diff --git a/lib/api/entities/pipeline_schedule.rb b/lib/api/entities/pipeline_schedule.rb new file mode 100644 index 00000000000..a72fe3f3141 --- /dev/null +++ b/lib/api/entities/pipeline_schedule.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module API + module Entities + class PipelineSchedule < Grape::Entity + expose :id + expose :description, :ref, :cron, :cron_timezone, :next_run_at, :active + expose :created_at, :updated_at + expose :owner, using: Entities::UserBasic + end + end +end diff --git a/lib/api/entities/pipeline_schedule_details.rb b/lib/api/entities/pipeline_schedule_details.rb new file mode 100644 index 00000000000..5e54489a0f9 --- /dev/null +++ b/lib/api/entities/pipeline_schedule_details.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module API + module Entities + class PipelineScheduleDetails < Entities::PipelineSchedule + expose :last_pipeline, using: Entities::PipelineBasic + expose :variables, using: Entities::Variable + end + end +end diff --git a/lib/api/entities/trigger.rb b/lib/api/entities/trigger.rb new file mode 100644 index 00000000000..6a9f772fc6b --- /dev/null +++ b/lib/api/entities/trigger.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module API + module Entities + class Trigger < Grape::Entity + include ::API::Helpers::Presentable + + expose :id + expose :token + expose :description + expose :created_at, :updated_at, :last_used + expose :owner, using: Entities::UserBasic + end + end +end diff --git a/lib/api/entities/variable.rb b/lib/api/entities/variable.rb new file mode 100644 index 00000000000..6705df30b2e --- /dev/null +++ b/lib/api/entities/variable.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module API + module Entities + class Variable < Grape::Entity + expose :variable_type, :key, :value + expose :protected?, as: :protected, if: -> (entity, _) { entity.respond_to?(:protected?) } + expose :masked?, as: :masked, if: -> (entity, _) { entity.respond_to?(:masked?) } + expose :environment_scope, if: -> (entity, _) { entity.respond_to?(:environment_scope) } + end + end +end |