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_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.
-
#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.
190 191 192 193 194 195 196 |
# File 'lib/gitlab/client/projects.rb', line 190 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.
122 123 124 |
# File 'lib/gitlab/client/projects.rb', line 122 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.
282 283 284 |
# File 'lib/gitlab/client/projects.rb', line 282 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.
68 69 70 71 |
# File 'lib/gitlab/client/projects.rb', line 68 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.
294 295 296 |
# File 'lib/gitlab/client/projects.rb', line 294 def delete_deploy_key(project, id) delete("/projects/#{project}/keys/#{id}") end |
#delete_project(id) ⇒ Gitlab::ObjectifiedHash
Deletes a project.
80 81 82 |
# File 'lib/gitlab/client/projects.rb', line 80 def delete_project(id) delete("/projects/#{id}") end |
#delete_project_hook(project, id) ⇒ Gitlab::ObjectifiedHash
Deletes a hook from project.
219 220 221 |
# File 'lib/gitlab/client/projects.rb', line 219 def delete_project_hook(project, id) delete("/projects/#{project}/hooks/#{id}") end |
#deploy_key(project, id) ⇒ Gitlab::ObjectifiedHash
Gets a single project deploy key.
269 270 271 |
# File 'lib/gitlab/client/projects.rb', line 269 def deploy_key(project, id) get("/projects/#{project}/keys/#{id}") end |
#deploy_keys(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a project deploy keys.
257 258 259 |
# File 'lib/gitlab/client/projects.rb', line 257 def deploy_keys(project, ={}) get("/projects/#{project}/keys", :query => ) end |
#edit_project_hook(project, id, url) ⇒ Gitlab::ObjectifiedHash
Updates a project hook URL.
207 208 209 |
# File 'lib/gitlab/client/projects.rb', line 207 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.
136 137 138 |
# File 'lib/gitlab/client/projects.rb', line 136 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
231 232 233 |
# File 'lib/gitlab/client/projects.rb', line 231 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_events(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of project events.
45 46 47 |
# File 'lib/gitlab/client/projects.rb', line 45 def project_events(project, ={}) get("/projects/#{project}/events", :query => ) end |
#project_hook(project, id) ⇒ Gitlab::ObjectifiedHash
Gets a project hook.
177 178 179 |
# File 'lib/gitlab/client/projects.rb', line 177 def project_hook(project, id) get("/projects/#{project}/hooks/#{id}") end |
#project_hooks(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of project hooks.
164 165 166 |
# File 'lib/gitlab/client/projects.rb', line 164 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.
243 244 245 |
# File 'lib/gitlab/client/projects.rb', line 243 def remove_forked(project) delete("/projects/#{project}/fork") end |
#remove_team_member(project, id) ⇒ Gitlab::ObjectifiedHash
Removes a user from project team.
149 150 151 |
# File 'lib/gitlab/client/projects.rb', line 149 def remove_team_member(project, id) delete("/projects/#{project}/members/#{id}") end |
#team_member(project, id) ⇒ Gitlab::ObjectifiedHash
Gets a project team member.
108 109 110 |
# File 'lib/gitlab/client/projects.rb', line 108 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.
96 97 98 |
# File 'lib/gitlab/client/projects.rb', line 96 def team_members(project, ={}) get("/projects/#{project}/members", :query => ) end |