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_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_project(name, options = {}) ⇒ Gitlab::ObjectifiedHash
Creates a new project.
-
#delete_deploy_key(project, id) ⇒ Gitlab::ObjectifiedHash
Deletes a deploy key from 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.
-
#edit_project_hook(project, id, url) ⇒ 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.
-
#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_hook(project, id) ⇒ Gitlab::ObjectifiedHash
Gets a project hook.
-
#project_hooks(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of project hooks.
-
#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.
-
#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.
Instance Method Details
#add_project_hook(project, url, options = {}) ⇒ Gitlab::ObjectifiedHash
Adds a new hook to the project.
175 176 177 178 179 180 181 |
# File 'lib/gitlab/client/projects.rb', line 175 def add_project_hook(project, url, = {}) available_events = [:push_events, :merge_requests_events, :issues_events] passed_events = available_events.select { |event| [event] } events = Hash[passed_events.map { |event| [event, [event]] }] post("/projects/#{project}/hooks", :body => {:url => url}.merge(events)) end |
#add_team_member(project, id, access_level) ⇒ Gitlab::ObjectifiedHash
Adds a user to project team.
107 108 109 |
# File 'lib/gitlab/client/projects.rb', line 107 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.
267 268 269 |
# File 'lib/gitlab/client/projects.rb', line 267 def create_deploy_key(project, title, key) post("/projects/#{project}/keys", body: {title: title, key: key}) end |
#create_project(name, options = {}) ⇒ Gitlab::ObjectifiedHash
Creates a new project.
53 54 55 56 |
# File 'lib/gitlab/client/projects.rb', line 53 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.
279 280 281 |
# File 'lib/gitlab/client/projects.rb', line 279 def delete_deploy_key(project, id) delete("/projects/#{project}/keys/#{id}") end |
#delete_project(id) ⇒ Gitlab::ObjectifiedHash
Deletes a project.
65 66 67 |
# File 'lib/gitlab/client/projects.rb', line 65 def delete_project(id) delete("/projects/#{id}") end |
#delete_project_hook(project, id) ⇒ Gitlab::ObjectifiedHash
Deletes a hook from project.
204 205 206 |
# File 'lib/gitlab/client/projects.rb', line 204 def delete_project_hook(project, id) delete("/projects/#{project}/hooks/#{id}") end |
#deploy_key(project, id) ⇒ Gitlab::ObjectifiedHash
Gets a single project deploy key.
254 255 256 |
# File 'lib/gitlab/client/projects.rb', line 254 def deploy_key(project, id) get("/projects/#{project}/keys/#{id}") end |
#deploy_keys(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a project deploy keys.
242 243 244 |
# File 'lib/gitlab/client/projects.rb', line 242 def deploy_keys(project, ={}) get("/projects/#{project}/keys", :query => ) end |
#edit_project_hook(project, id, url) ⇒ Gitlab::ObjectifiedHash
Updates a project hook URL.
192 193 194 |
# File 'lib/gitlab/client/projects.rb', line 192 def edit_project_hook(project, id, url) put("/projects/#{project}/hooks/#{id}", :body => {:url => url}) end |
#edit_team_member(project, id, access_level) ⇒ Array<Gitlab::ObjectifiedHash>
Updates a team member’s project access level.
121 122 123 |
# File 'lib/gitlab/client/projects.rb', line 121 def edit_team_member(project, id, access_level) put("/projects/#{project}/members/#{id}", :body => {:access_level => access_level}) end |
#make_forked_from(project, id) ⇒ Gitlab::ObjectifiedHash
Mark this project as forked from the other
216 217 218 |
# File 'lib/gitlab/client/projects.rb', line 216 def make_forked_from(project, id) post("/projects/#{project}/fork/#{id}") end |
#project(id) ⇒ Gitlab::ObjectifiedHash
Gets information about a project.
30 31 32 |
# File 'lib/gitlab/client/projects.rb', line 30 def project(id) get("/projects/#{id}") end |
#project_hook(project, id) ⇒ Gitlab::ObjectifiedHash
Gets a project hook.
162 163 164 |
# File 'lib/gitlab/client/projects.rb', line 162 def project_hook(project, id) get("/projects/#{project}/hooks/#{id}") end |
#project_hooks(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of project hooks.
149 150 151 |
# File 'lib/gitlab/client/projects.rb', line 149 def project_hooks(project, ={}) get("/projects/#{project}/hooks", :query => ) end |
#projects(options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of projects owned by the authenticated user.
14 15 16 17 18 19 20 |
# File 'lib/gitlab/client/projects.rb', line 14 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.
228 229 230 |
# File 'lib/gitlab/client/projects.rb', line 228 def remove_forked(project) delete("/projects/#{project}/fork") end |
#remove_team_member(project, id) ⇒ Gitlab::ObjectifiedHash
Removes a user from project team.
134 135 136 |
# File 'lib/gitlab/client/projects.rb', line 134 def remove_team_member(project, id) delete("/projects/#{project}/members/#{id}") end |
#team_member(project, id) ⇒ Gitlab::ObjectifiedHash
Gets a project team member.
93 94 95 |
# File 'lib/gitlab/client/projects.rb', line 93 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.
81 82 83 |
# File 'lib/gitlab/client/projects.rb', line 81 def team_members(project, ={}) get("/projects/#{project}/members", :query => ) end |