Class: GLPL
- Inherits:
-
Object
- Object
- GLPL
- Defined in:
- lib/glpl.rb
Overview
— FUNCTIONS
Defined Under Namespace
Instance Method Summary collapse
-
#cancel(project_id, pipeline_id) ⇒ Object
Cancels a pipeline.
-
#initialize(private_token) ⇒ GLPL
constructor
Creates a new GLPL instance with the provided Gitlab’s Private Token.
-
#jobs(project_id, pipeline_id) ⇒ Object
List jobs for a given project’s pipeline.
-
#pipelines(project_id) ⇒ Object
List recent pipelines for a given project.
-
#retry(project_id, pipeline_id) ⇒ Object
Retries a pipeline.
Constructor Details
#initialize(private_token) ⇒ GLPL
Creates a new GLPL instance with the provided Gitlab’s Private Token.
Params:
private_token-
StringGitlab’s Private Token to be used when making requests to Gitlab’s API.
14 15 16 17 |
# File 'lib/glpl.rb', line 14 def initialize(private_token) @private_token = private_token @api_url = "https://gitlab.com/api/v4/projects" end |
Instance Method Details
#cancel(project_id, pipeline_id) ⇒ Object
Cancels a pipeline.
Params:
project_id-
IntegerGitlab’s project ID. pipeline_id-
IntegerThe pipeline’s ID.
46 47 48 |
# File 'lib/glpl.rb', line 46 def cancel(project_id, pipeline_id) GLPL::Pipeline.new(request("/#{project_id}/pipelines/#{pipeline_id}/cancel", :post)) end |
#jobs(project_id, pipeline_id) ⇒ Object
List jobs for a given project’s pipeline. Params:
project_id-
IntegerGitlab’s project ID. pipeline_id-
IntegerThe pipeline’s ID.
29 30 31 |
# File 'lib/glpl.rb', line 29 def jobs(project_id, pipeline_id) request("/#{project_id}/pipelines/#{pipeline_id}/jobs", :get).map { |data| GLPL::Job.new(data) } end |
#pipelines(project_id) ⇒ Object
List recent pipelines for a given project. Params:
project_id-
Integerwhich contains the Gitlab’s project id.
21 22 23 |
# File 'lib/glpl.rb', line 21 def pipelines(project_id) request("/#{project_id}/pipelines", :get).map { |data| GLPL::Pipeline.new(data) } end |
#retry(project_id, pipeline_id) ⇒ Object
Retries a pipeline. Params:
project_id-
IntegerGitlab’s project ID. pipeline_id-
IntegerThe pipeline’s ID.
37 38 39 |
# File 'lib/glpl.rb', line 37 def retry(project_id, pipeline_id) GLPL::Pipeline.new(request("/#{project_id}/pipelines/#{pipeline_id}/retry", :post)) end |