summaryrefslogtreecommitdiff
path: root/app/serializers/pipeline_entity.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-11-10 18:15:16 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2016-11-10 18:15:16 +0100
commitba2d1fde773c33044c7fe7b298abd09b640bcfc5 (patch)
tree725135498efab438e350c2a634c52f6687bb099f /app/serializers/pipeline_entity.rb
parent8012abf4ccee90d02f3ff386115f73eb24a87c20 (diff)
downloadgitlab-ce-ba2d1fde773c33044c7fe7b298abd09b640bcfc5.tar.gz
Add `pipeline.url` to API [ci skip]
Diffstat (limited to 'app/serializers/pipeline_entity.rb')
-rw-r--r--app/serializers/pipeline_entity.rb27
1 files changed, 8 insertions, 19 deletions
diff --git a/app/serializers/pipeline_entity.rb b/app/serializers/pipeline_entity.rb
index c57c08b4830..6191d63fd7f 100644
--- a/app/serializers/pipeline_entity.rb
+++ b/app/serializers/pipeline_entity.rb
@@ -3,6 +3,12 @@ class PipelineEntity < Grape::Entity
expose :id
expose :user, if: -> (pipeline, opts) { created?(pipeline, opts) }, using: UserEntity
+ expose :url do |pipeline|
+ namespace_project_pipeline_path(
+ pipeline.project.namespace,
+ pipeline.project,
+ pipeline)
+ end
expose :details, if: -> (pipeline, opts) { updated?(pipeline, opts) } do
expose :status
@@ -29,7 +35,7 @@ class PipelineEntity < Grape::Entity
pipeline.ref
end
- expose :ref_url do |pipeline|
+ expose :url do |pipeline|
namespace_project_tree_url(
pipeline.project.namespace,
pipeline.project,
@@ -39,24 +45,7 @@ class PipelineEntity < Grape::Entity
expose :tag?
end
- expose :commit, if: -> (pipeline, opts) { created?(pipeline, opts) } do
- expose :short_sha
-
- expose :sha_url do |pipeline|
- namespace_project_commit_path(
- pipeline.project.namespace,
- pipeline.project,
- pipeline.sha)
- end
-
- expose :title do |pipeline|
- pipeline.commit.try(:title)
- end
-
- expose :author, using: UserEntity do |pipeline|
- pipeline.commit.try(:author)
- end
- end
+ expose :commit, if: -> (pipeline, opts) { created?(pipeline, opts) }, using: CommitEntity
expose :retry_url, if: -> (pipeline, opts) { updated?(pipeline, opts) } do |pipeline|
can?(current_user, :update_pipeline, pipeline.project) &&