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, gitlab_id, path, ssh_url_to_repo, default_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, gitlab_id, path, ssh_url_to_repo, default_ref = 'master') ⇒ Gitlab::ObjectifiedHash
Creates a GitLab CI project using GitLab project details.
48 49 50 |
# File 'lib/gitlab/ci/client/projects.rb', line 48 def create_project(name, gitlab_id, path, ssh_url_to_repo, default_ref='master') post('/projects', body: { name: name, gitlab_id: gitlab_id, path: path, ssh_url_to_repo: ssh_url_to_repo, default_ref: default_ref }) end |
#delete_project(id) ⇒ Gitlab::ObjectifiedHash
Removes a GitLab CI project that the authenticated user has access to.
71 72 73 |
# File 'lib/gitlab/ci/client/projects.rb', line 71 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.
60 61 62 |
# File 'lib/gitlab/ci/client/projects.rb', line 60 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).
83 84 85 |
# File 'lib/gitlab/ci/client/projects.rb', line 83 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/#{[: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).
95 96 97 |
# File 'lib/gitlab/ci/client/projects.rb', line 95 def remove_project_from_runner(id,runner) delete("/projects/#{id}/runners/#{runner}") end |