Module: Gitlab::Client::Projects
- Included in:
- Gitlab::Client
- Defined in:
- lib/gitlab/client/projects.rb
Overview
Defines methods related to projects.
Instance Method Summary collapse
-
#add_git_hook(id, options = {}) ⇒ Gitlab::ObjectifiedHash
Adds a project git hook.
-
#add_project_hook(project, url, options = {}) ⇒ Gitlab::ObjectifiedHash
Adds a new hook to the project.
-
#add_team_member(project, id, access_level) ⇒ Gitlab::ObjectifiedHash
Adds a user to project team.
-
#create_deploy_key(project, title, key) ⇒ Gitlab::ObjectifiedHash
Creates a new deploy key.
-
#create_fork(id, options = {}) ⇒ Gitlab::ObjectifiedHash
Forks a project into the user namespace.
-
#create_project(name, options = {}) ⇒ Gitlab::ObjectifiedHash
Creates a new project.
-
#delete_deploy_key(project, id) ⇒ Gitlab::ObjectifiedHash
Deletes a deploy key from project.
-
#delete_git_hook(id, options = {}) ⇒ Gitlab::ObjectifiedHash
Deletes a git hook from a project.
-
#delete_project(id) ⇒ Gitlab::ObjectifiedHash
Deletes a project.
-
#delete_project_hook(project, id) ⇒ Gitlab::ObjectifiedHash
Deletes a hook from project.
-
#deploy_key(project, id) ⇒ Gitlab::ObjectifiedHash
Gets a single project deploy key.
-
#deploy_keys(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a project deploy keys.
-
#disable_deploy_key(project, key) ⇒ Gitlab::ObjectifiedHash
Disables a deploy key at the project.
-
#edit_git_hook(id, options = {}) ⇒ Gitlab::ObjectifiedHash
Updates a project git hook.
-
#edit_project(id, options = {}) ⇒ Gitlab::ObjectifiedHash
Updates an existing project.
-
#edit_project_hook(project, id, url, options = {}) ⇒ Gitlab::ObjectifiedHash
Updates a project hook URL.
-
#edit_team_member(project, id, access_level) ⇒ Array<Gitlab::ObjectifiedHash>
Updates a team member’s project access level.
-
#enable_deploy_key(project, key) ⇒ Gitlab::ObjectifiedHash
Enables a deploy key at the project.
-
#git_hook(id) ⇒ Gitlab::ObjectifiedHash
Gets a project git hook.
-
#make_forked_from(project, id) ⇒ Gitlab::ObjectifiedHash
Mark this project as forked from the other.
-
#project(id) ⇒ Gitlab::ObjectifiedHash
Gets information about a project.
-
#project_events(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of project events.
-
#project_hook(project, id) ⇒ Gitlab::ObjectifiedHash
Gets a project hook.
-
#project_hooks(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of project hooks.
-
#project_search(query, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
(also: #search_projects)
Search for projects by name.
-
#projects(options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of projects owned by the authenticated user.
-
#remove_forked(project) ⇒ Gitlab::ObjectifiedHash
Remove a forked_from relationship for a project.
-
#remove_team_member(project, id) ⇒ Gitlab::ObjectifiedHash
Removes a user from project team.
-
#share_project_with_group(project, id, group_access) ⇒ Object
Share project with group.
-
#star_project(id) ⇒ Gitlab::ObjectifiedHash
Stars a project.
-
#team_member(project, id) ⇒ Gitlab::ObjectifiedHash
Gets a project team member.
-
#team_members(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of project team members.
-
#unstar_project(id) ⇒ Gitlab::ObjectifiedHash
Unstars a project.
Instance Method Details
#add_git_hook(id, options = {}) ⇒ Gitlab::ObjectifiedHash
Adds a project git hook.
273 274 275 |
# File 'lib/gitlab/client/projects.rb', line 273 def add_git_hook(id, ={}) post("/projects/#{id}/git_hook", body: ) end |
#add_project_hook(project, url, options = {}) ⇒ Gitlab::ObjectifiedHash
Adds a new hook to the project.
214 215 216 217 |
# File 'lib/gitlab/client/projects.rb', line 214 def add_project_hook(project, url, ={}) body = { url: url }.merge() post("/projects/#{project}/hooks", body: body) end |
#add_team_member(project, id, access_level) ⇒ Gitlab::ObjectifiedHash
Adds a user to project team.
142 143 144 |
# File 'lib/gitlab/client/projects.rb', line 142 def add_team_member(project, id, access_level) post("/projects/#{project}/members", body: { user_id: id, access_level: access_level }) end |
#create_deploy_key(project, title, key) ⇒ Gitlab::ObjectifiedHash
Creates a new deploy key.
363 364 365 |
# File 'lib/gitlab/client/projects.rb', line 363 def create_deploy_key(project, title, key) post("/projects/#{project}/keys", body: { title: title, key: key }) end |
#create_fork(id, options = {}) ⇒ Gitlab::ObjectifiedHash
Forks a project into the user namespace.
413 414 415 |
# File 'lib/gitlab/client/projects.rb', line 413 def create_fork(id, ={}) post("/projects/fork/#{id}", body: ) end |
#create_project(name, options = {}) ⇒ Gitlab::ObjectifiedHash
Creates a new project.
88 89 90 91 |
# File 'lib/gitlab/client/projects.rb', line 88 def create_project(name, ={}) url = [:user_id] ? "/projects/user/#{[:user_id]}" : "/projects" post(url, body: { name: name }.merge()) end |
#delete_deploy_key(project, id) ⇒ Gitlab::ObjectifiedHash
Deletes a deploy key from project.
399 400 401 |
# File 'lib/gitlab/client/projects.rb', line 399 def delete_deploy_key(project, id) delete("/projects/#{project}/keys/#{id}") end |
#delete_git_hook(id, options = {}) ⇒ Gitlab::ObjectifiedHash
Deletes a git hook from a project.
300 301 302 |
# File 'lib/gitlab/client/projects.rb', line 300 def delete_git_hook(id, ={}) delete("/projects/#{id}/git_hook") end |
#delete_project(id) ⇒ Gitlab::ObjectifiedHash
Deletes a project.
100 101 102 |
# File 'lib/gitlab/client/projects.rb', line 100 def delete_project(id) delete("/projects/#{id}") end |
#delete_project_hook(project, id) ⇒ Gitlab::ObjectifiedHash
Deletes a hook from project.
246 247 248 |
# File 'lib/gitlab/client/projects.rb', line 246 def delete_project_hook(project, id) delete("/projects/#{project}/hooks/#{id}") end |
#deploy_key(project, id) ⇒ Gitlab::ObjectifiedHash
Gets a single project deploy key.
350 351 352 |
# File 'lib/gitlab/client/projects.rb', line 350 def deploy_key(project, id) get("/projects/#{project}/keys/#{id}") end |
#deploy_keys(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a project deploy keys.
338 339 340 |
# File 'lib/gitlab/client/projects.rb', line 338 def deploy_keys(project, ={}) get("/projects/#{project}/keys", query: ) end |
#disable_deploy_key(project, key) ⇒ Gitlab::ObjectifiedHash
Disables a deploy key at the project.
387 388 389 |
# File 'lib/gitlab/client/projects.rb', line 387 def disable_deploy_key(project, key) post("/projects/#{project}/deploy_keys/#{key}/disable", body: { id: project, key_id: key }) end |
#edit_git_hook(id, options = {}) ⇒ Gitlab::ObjectifiedHash
Updates a project git hook.
288 289 290 |
# File 'lib/gitlab/client/projects.rb', line 288 def edit_git_hook(id, ={}) put("/projects/#{id}/git_hook", body: ) end |
#edit_project(id, options = {}) ⇒ Gitlab::ObjectifiedHash
Updates an existing project.
429 430 431 |
# File 'lib/gitlab/client/projects.rb', line 429 def edit_project(id, ={}) put("/projects/#{id}", query: ) end |
#edit_project_hook(project, id, url, options = {}) ⇒ Gitlab::ObjectifiedHash
Updates a project hook URL.
233 234 235 236 |
# File 'lib/gitlab/client/projects.rb', line 233 def edit_project_hook(project, id, url, ={}) body = { url: url }.merge() put("/projects/#{project}/hooks/#{id}", body: body) end |
#edit_team_member(project, id, access_level) ⇒ Array<Gitlab::ObjectifiedHash>
Updates a team member’s project access level.
156 157 158 |
# File 'lib/gitlab/client/projects.rb', line 156 def edit_team_member(project, id, access_level) put("/projects/#{project}/members/#{id}", body: { access_level: access_level }) end |
#enable_deploy_key(project, key) ⇒ Gitlab::ObjectifiedHash
Enables a deploy key at the project.
375 376 377 |
# File 'lib/gitlab/client/projects.rb', line 375 def enable_deploy_key(project, key) post("/projects/#{project}/deploy_keys/#{key}/enable", body: { id: project, key_id: key }) end |
#git_hook(id) ⇒ Gitlab::ObjectifiedHash
Gets a project git hook.
258 259 260 |
# File 'lib/gitlab/client/projects.rb', line 258 def git_hook(id) get("/projects/#{id}/git_hook") end |
#make_forked_from(project, id) ⇒ Gitlab::ObjectifiedHash
Mark this project as forked from the other
312 313 314 |
# File 'lib/gitlab/client/projects.rb', line 312 def make_forked_from(project, id) post("/projects/#{project}/fork/#{id}") end |
#project(id) ⇒ Gitlab::ObjectifiedHash
Gets information about a project.
49 50 51 |
# File 'lib/gitlab/client/projects.rb', line 49 def project(id) get("/projects/#{id}") end |
#project_events(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of project events.
64 65 66 |
# File 'lib/gitlab/client/projects.rb', line 64 def project_events(project, ={}) get("/projects/#{project}/events", query: ) end |
#project_hook(project, id) ⇒ Gitlab::ObjectifiedHash
Gets a project hook.
197 198 199 |
# File 'lib/gitlab/client/projects.rb', line 197 def project_hook(project, id) get("/projects/#{project}/hooks/#{id}") end |
#project_hooks(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of project hooks.
184 185 186 |
# File 'lib/gitlab/client/projects.rb', line 184 def project_hooks(project, ={}) get("/projects/#{project}/hooks", query: ) end |
#project_search(query, options = {}) ⇒ Array<Gitlab::ObjectifiedHash> Also known as: search_projects
Search for projects by name.
36 37 38 |
# File 'lib/gitlab/client/projects.rb', line 36 def project_search(query, ={}) get("/projects/search/#{query}", query: ) end |
#projects(options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of projects owned by the authenticated user.
15 16 17 18 19 20 21 |
# File 'lib/gitlab/client/projects.rb', line 15 def projects(={}) if [:scope] get("/projects/#{[:scope]}", query: ) else get("/projects", query: ) end end |
#remove_forked(project) ⇒ Gitlab::ObjectifiedHash
Remove a forked_from relationship for a project.
324 325 326 |
# File 'lib/gitlab/client/projects.rb', line 324 def remove_forked(project) delete("/projects/#{project}/fork") end |
#remove_team_member(project, id) ⇒ Gitlab::ObjectifiedHash
Removes a user from project team.
169 170 171 |
# File 'lib/gitlab/client/projects.rb', line 169 def remove_team_member(project, id) delete("/projects/#{project}/members/#{id}") end |
#share_project_with_group(project, id, group_access) ⇒ Object
Share project with group.
441 442 443 |
# File 'lib/gitlab/client/projects.rb', line 441 def share_project_with_group(project, id, group_access) post("/projects/#{project}/share", body: { group_id: id, group_access: group_access }) end |
#star_project(id) ⇒ Gitlab::ObjectifiedHash
Stars a project.
454 455 456 |
# File 'lib/gitlab/client/projects.rb', line 454 def star_project(id) post("/projects/#{id}/star") end |
#team_member(project, id) ⇒ Gitlab::ObjectifiedHash
Gets a project team member.
128 129 130 |
# File 'lib/gitlab/client/projects.rb', line 128 def team_member(project, id) get("/projects/#{project}/members/#{id}") end |
#team_members(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of project team members.
116 117 118 |
# File 'lib/gitlab/client/projects.rb', line 116 def team_members(project, ={}) get("/projects/#{project}/members", query: ) end |
#unstar_project(id) ⇒ Gitlab::ObjectifiedHash
Unstars a project.
467 468 469 |
# File 'lib/gitlab/client/projects.rb', line 467 def unstar_project(id) delete("/projects/#{id}/star") end |