Module: Gitlab::CI::Client::Projects
- Included in:
- Gitlab::CI::Client
- Defined in:
- lib/gitlab/ci/client/projects.rb
Overview
Defines methods related to projects.
Instance Method Summary collapse
-
#create_project(name, id, ref = 'master') ⇒ Gitlab::ObjectifiedHash
Creates a GitLab CI project using GitLab project details.
-
#delete_project(id) ⇒ Gitlab::ObjectifiedHash
Removes a GitLab CI project that the authenticated user has access to.
-
#edit_project(id, name, ref = 'master') ⇒ Gitlab::ObjectifiedHash
Updates a GitLab CI project using GitLab project details that the authenticated user has access to.
-
#link_project_to_runner(id, runner) ⇒ Gitlab::ObjectifiedHash
Links a runner to a project so that it can make builds (only via authorized user).
-
#project(id) ⇒ Gitlab::ObjectifiedHash
Returns information about a single project for which the user is authorized.
-
#projects(options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Lists all projects that the authenticated user has access to.
-
#remove_project_from_runner(id, runner) ⇒ Gitlab::ObjectifiedHash
Removes a runner from a project so that it can not make builds (only via authorized user).
Instance Method Details
#create_project(name, id, ref = 'master') ⇒ Gitlab::ObjectifiedHash
Creates a GitLab CI project using GitLab project details.
46 47 48 49 |
# File 'lib/gitlab/ci/client/projects.rb', line 46 def create_project(name, id, ref='master') url = "/projects" post(url, body: { name: name, gitlab_id: id, default_ref: ref }) end |
#delete_project(id) ⇒ Gitlab::ObjectifiedHash
Removes a GitLab CI project that the authenticated user has access to.
70 71 72 |
# File 'lib/gitlab/ci/client/projects.rb', line 70 def delete_project(id) delete("/projects/#{id}") end |
#edit_project(id, name, ref = 'master') ⇒ Gitlab::ObjectifiedHash
Updates a GitLab CI project using GitLab project details that the authenticated user has access to.
59 60 61 |
# File 'lib/gitlab/ci/client/projects.rb', line 59 def edit_project(id, name, ref='master') put("/projects/#{id}", body: { name: name, gitlab_id: id, default_ref: ref }) end |
#link_project_to_runner(id, runner) ⇒ Gitlab::ObjectifiedHash
Links a runner to a project so that it can make builds (only via authorized user).
82 83 84 |
# File 'lib/gitlab/ci/client/projects.rb', line 82 def link_project_to_runner(id,runner) post("/projects/#{id}/runners/#{runner}", body: { id: id, runner_id: runner }) end |
#project(id) ⇒ Gitlab::ObjectifiedHash
Returns information about a single project for which the user is authorized.
31 32 33 |
# File 'lib/gitlab/ci/client/projects.rb', line 31 def project(id) get("/projects/#{id}") end |
#projects(options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Lists all projects that the authenticated user has access to.
15 16 17 18 19 20 21 |
# File 'lib/gitlab/ci/client/projects.rb', line 15 def projects(={}) if [:scope] get("/projects/#{options[:scope]}", query: ) else get("/projects", query: ) end end |
#remove_project_from_runner(id, runner) ⇒ Gitlab::ObjectifiedHash
Removes a runner from a project so that it can not make builds (only via authorized user).
94 95 96 |
# File 'lib/gitlab/ci/client/projects.rb', line 94 def remove_project_from_runner(id,runner) delete("/projects/#{id}/runners/#{runner}") end |