summaryrefslogtreecommitdiff
path: root/qa/qa/resource/tag.rb
blob: ac4fccec52590e41c4c8291d4704147f90d993fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

module QA
  module Resource
    class Tag < Base
      attr_accessor :project, :name, :ref

      def resource_web_url(resource)
        super
      rescue ResourceURLMissingError
        # this particular resource does not expose a web_url property
      end

      def api_get_path
        "/projects/#{project.id}/repository/tags/#{name}"
      end

      def api_post_path
        "/projects/#{project.id}/repository/tags"
      end

      def api_post_body
        {
          tag_name: name,
          ref: ref
        }
      end
    end
  end
end