Sha256: 011ced79be17646095afc05f254fe5e80ee869a60e59e16612454031944a1c16

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

class Gitlab::Client
  # Defines methods related to builds.
  # @see https://docs.gitlab.com/ce/api/build_triggers.html
  module BuildTriggers
    # Gets a list of the project's build triggers
    #
    # @example
    #   Gitlab.triggers(5)
    #
    # @param  [Integer] project The ID of a project.
    # @return [Array<Gitlab::ObjectifiedHash>] The list of triggers.
    def triggers(project)
      get("/projects/#{project}/triggers")
    end

    # Gets details of project's build trigger.
    #
    # @example
    #   Gitlab.trigger(5, '7b9148c158980bbd9bcea92c17522d')
    #
    # @param  [Integer] project The ID of a project.
    # @param  [String] token The token of a trigger.
    # @return [Gitlab::ObjectifiedHash] The trigger.
    def trigger(project, token)
      get("/projects/#{project}/triggers/#{token}")
    end

    # Create a build trigger for a project.
    #
    # @example
    #   Gitlab.create_trigger(5)
    #
    # @param  [Integer] project The ID of a project.
    # @return [Gitlab::ObjectifiedHash] The trigger.
    def create_trigger(project)
      post("/projects/#{project}/triggers")
    end

    # Remove a project's build trigger.
    #
    # @example
    #   Gitlab.remove_trigger(5, '7b9148c158980bbd9bcea92c17522d')
    #
    # @param  [Integer] project The ID of a project.
    # @param  [String] token The token of a trigger.
    # @return [Gitlab::ObjectifiedHash] The trigger.
    def remove_trigger(project, token)
      delete("/projects/#{project}/triggers/#{token}")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gitlab-akerl-4.0.0 lib/gitlab/client/build_triggers.rb