summaryrefslogtreecommitdiff
path: root/app/serializers/deployment_entity.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-11-03 12:54:10 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-11-03 13:27:00 +0100
commit573921cb9d0b139dec324fb1368feb1347b51624 (patch)
tree048c3f8a4c05127a0fc1be1de6ad60b6165bcb32 /app/serializers/deployment_entity.rb
parentf1e9c97d64b96bdd398616743ad048f8d147e26b (diff)
downloadgitlab-ce-573921cb9d0b139dec324fb1368feb1347b51624.tar.gz
Implement entities needed for environments folders
Diffstat (limited to 'app/serializers/deployment_entity.rb')
-rw-r--r--app/serializers/deployment_entity.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/app/serializers/deployment_entity.rb b/app/serializers/deployment_entity.rb
new file mode 100644
index 00000000000..3462b188337
--- /dev/null
+++ b/app/serializers/deployment_entity.rb
@@ -0,0 +1,27 @@
+class DeploymentEntity < Grape::Entity
+ include RequestAwareEntity
+
+ expose :id
+ expose :iid
+ expose :sha
+
+ expose :ref do
+ expose :name do |deployment|
+ deployment.ref
+ end
+
+ expose :ref_url do |deployment|
+ @urls.namespace_project_tree_url(
+ deployment.project.namespace,
+ deployment.project,
+ id: deployment.ref)
+ end
+ end
+
+ expose :tag
+ expose :last?
+ expose :user, using: API::Entities::UserBasic
+ expose :commit, using: CommitEntity
+ expose :deployable, using: BuildEntity
+ expose :manual_actions
+end