File: deployments.rb

package info (click to toggle)
ruby-gitlab 5.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,660 kB
  • sloc: ruby: 12,582; makefile: 7; sh: 4
file content (34 lines) | stat: -rw-r--r-- 1,127 bytes parent folder | download | duplicates (4)
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
31
32
33
34
# frozen_string_literal: true

class Gitlab::Client
  # Defines methods related to deployments.
  # @see https://docs.gitlab.com/ce/api/deployments.html
  module Deployments
    # Gets a list of project deployments.
    #
    # @example
    #   Gitlab.deployments(5)
    #   Gitlab.deployments(5, { per_page: 10, page:  2 })
    #
    # @param  [Integer, String] project The ID or name of a project.
    # @param  [Hash] options A customizable set of options.
    # @option options [Integer] :page The page number.
    # @option options [Integer] :per_page The number of results per page.
    # @return [Array<Gitlab::ObjectifiedHash>]
    def deployments(project, options = {})
      get("/projects/#{url_encode project}/deployments", query: options)
    end

    # Gets a single deployment.
    #
    # @example
    #   Gitlab.deployment(5, 36)
    #
    # @param  [Integer, String] project The ID or name of a project.
    # @param  [Integer] id The ID of an deployment.
    # @return [Gitlab::ObjectifiedHash]
    def deployment(project, id)
      get("/projects/#{url_encode project}/deployments/#{id}")
    end
  end
end