diff options
Diffstat (limited to 'app/serializers/triggered_pipeline_entity.rb')
-rw-r--r-- | app/serializers/triggered_pipeline_entity.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/app/serializers/triggered_pipeline_entity.rb b/app/serializers/triggered_pipeline_entity.rb new file mode 100644 index 00000000000..23f2c7f125f --- /dev/null +++ b/app/serializers/triggered_pipeline_entity.rb @@ -0,0 +1,30 @@ +class TriggeredPipelineEntity < Grape::Entity + include RequestAwareEntity + + expose :id + expose :user, using: UserEntity + expose :active?, as: :active + expose :coverage + expose :source + + expose :path do |pipeline| + namespace_project_pipeline_path( + pipeline.project.namespace, + pipeline.project, + pipeline) + end + + expose :details do + expose :detailed_status, as: :status, with: StatusEntity + end + + expose :project, using: ProjectEntity + + private + + alias_method :pipeline, :object + + def detailed_status + pipeline.detailed_status(request.current_user) + end +end |