summaryrefslogtreecommitdiff
path: root/lib/gitlab/badge/build/metadata.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/badge/build/metadata.rb')
-rw-r--r--lib/gitlab/badge/build/metadata.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/gitlab/badge/build/metadata.rb b/lib/gitlab/badge/build/metadata.rb
new file mode 100644
index 00000000000..f87a7b7942e
--- /dev/null
+++ b/lib/gitlab/badge/build/metadata.rb
@@ -0,0 +1,28 @@
+module Gitlab
+ module Badge
+ module Build
+ ##
+ # Class that describes build badge metadata
+ #
+ class Metadata < Badge::Metadata
+ def initialize(badge)
+ @project = badge.project
+ @ref = badge.ref
+ end
+
+ def title
+ 'build status'
+ end
+
+ def image_url
+ build_namespace_project_badges_url(@project.namespace,
+ @project, @ref, format: :svg)
+ end
+
+ def link_url
+ namespace_project_commits_url(@project.namespace, @project, id: @ref)
+ end
+ end
+ end
+ end
+end