Module: Brat::Client::Projects
- Included in:
- Brat::Client
- Defined in:
- lib/brat/client/projects.rb
Overview
Defines methods related to projects.
Instance Method Summary collapse
- 
  
    
      #add_project_hook(project, url, options = {})  ⇒ Brat::ObjectifiedHash 
    
    
  
  
  
  
  
  
  
  
  
    Adds a new hook to the project. 
- 
  
    
      #add_team_member(project, id, access_level)  ⇒ Brat::ObjectifiedHash 
    
    
  
  
  
  
  
  
  
  
  
    Adds a user to project team. 
- 
  
    
      #create_deploy_key(project, title, key)  ⇒ Brat::ObjectifiedHash 
    
    
  
  
  
  
  
  
  
  
  
    Creates a new deploy key. 
- 
  
    
      #create_project(name, options = {})  ⇒ Brat::ObjectifiedHash 
    
    
  
  
  
  
  
  
  
  
  
    Creates a new project. 
- 
  
    
      #delete_deploy_key(project, id)  ⇒ Brat::ObjectifiedHash 
    
    
  
  
  
  
  
  
  
  
  
    Deletes a deploy key from project. 
- 
  
    
      #delete_project(id)  ⇒ Brat::ObjectifiedHash 
    
    
  
  
  
  
  
  
  
  
  
    Deletes a project. 
- 
  
    
      #delete_project_hook(project, id)  ⇒ Brat::ObjectifiedHash 
    
    
  
  
  
  
  
  
  
  
  
    Deletes a hook from project. 
- 
  
    
      #deploy_key(project, id)  ⇒ Brat::ObjectifiedHash 
    
    
  
  
  
  
  
  
  
  
  
    Gets a single project deploy key. 
- 
  
    
      #deploy_keys(project, options = {})  ⇒ Array<Brat::ObjectifiedHash> 
    
    
  
  
  
  
  
  
  
  
  
    Gets a project deploy keys. 
- 
  
    
      #edit_project_hook(project, id, url)  ⇒ Brat::ObjectifiedHash 
    
    
  
  
  
  
  
  
  
  
  
    Updates a project hook URL. 
- 
  
    
      #edit_team_member(project, id, access_level)  ⇒ Array<Brat::ObjectifiedHash> 
    
    
  
  
  
  
  
  
  
  
  
    Updates a team member’s project access level. 
- 
  
    
      #make_forked_from(project, id)  ⇒ Brat::ObjectifiedHash 
    
    
  
  
  
  
  
  
  
  
  
    Mark this project as forked from the other. 
- 
  
    
      #project(id)  ⇒ Brat::ObjectifiedHash 
    
    
  
  
  
  
  
  
  
  
  
    Gets information about a project. 
- 
  
    
      #project_events(project, options = {})  ⇒ Array<Brat::ObjectifiedHash> 
    
    
  
  
  
  
  
  
  
  
  
    Gets a list of project events. 
- 
  
    
      #project_hook(project, id)  ⇒ Brat::ObjectifiedHash 
    
    
  
  
  
  
  
  
  
  
  
    Gets a project hook. 
- 
  
    
      #project_hooks(project, options = {})  ⇒ Array<Brat::ObjectifiedHash> 
    
    
  
  
  
  
  
  
  
  
  
    Gets a list of project hooks. 
- 
  
    
      #projects(options = {})  ⇒ Array<Brat::ObjectifiedHash> 
    
    
  
  
  
  
  
  
  
  
  
    Gets a list of projects owned by the authenticated user. 
- 
  
    
      #remove_forked(project)  ⇒ Brat::ObjectifiedHash 
    
    
  
  
  
  
  
  
  
  
  
    Remove a forked_from relationship for a project. 
- 
  
    
      #remove_team_member(project, id)  ⇒ Brat::ObjectifiedHash 
    
    
  
  
  
  
  
  
  
  
  
    Removes a user from project team. 
- 
  
    
      #team_member(project, id)  ⇒ Brat::ObjectifiedHash 
    
    
  
  
  
  
  
  
  
  
  
    Gets a project team member. 
- 
  
    
      #team_members(project, options = {})  ⇒ Array<Brat::ObjectifiedHash> 
    
    
  
  
  
  
  
  
  
  
  
    Gets a list of project team members. 
Instance Method Details
#add_project_hook(project, url, options = {}) ⇒ Brat::ObjectifiedHash
Adds a new hook to the project.
| 190 191 192 193 194 195 196 | # File 'lib/brat/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) ⇒ Brat::ObjectifiedHash
Adds a user to project team.
| 122 123 124 | # File 'lib/brat/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) ⇒ Brat::ObjectifiedHash
Creates a new deploy key.
| 282 283 284 | # File 'lib/brat/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 = {}) ⇒ Brat::ObjectifiedHash
Creates a new project.
| 68 69 70 71 | # File 'lib/brat/client/projects.rb', line 68 def create_project(name, ={}) url = [:user_id] ? "/projects/user/#{options[:user_id]}" : "/projects" post(url, :body => {:name => name}.merge()) end | 
#delete_deploy_key(project, id) ⇒ Brat::ObjectifiedHash
Deletes a deploy key from project.
| 294 295 296 | # File 'lib/brat/client/projects.rb', line 294 def delete_deploy_key(project, id) delete("/projects/#{project}/keys/#{id}") end | 
#delete_project(id) ⇒ Brat::ObjectifiedHash
Deletes a project.
| 80 81 82 | # File 'lib/brat/client/projects.rb', line 80 def delete_project(id) delete("/projects/#{id}") end | 
#delete_project_hook(project, id) ⇒ Brat::ObjectifiedHash
Deletes a hook from project.
| 219 220 221 | # File 'lib/brat/client/projects.rb', line 219 def delete_project_hook(project, id) delete("/projects/#{project}/hooks/#{id}") end | 
#deploy_key(project, id) ⇒ Brat::ObjectifiedHash
Gets a single project deploy key.
| 269 270 271 | # File 'lib/brat/client/projects.rb', line 269 def deploy_key(project, id) get("/projects/#{project}/keys/#{id}") end | 
#deploy_keys(project, options = {}) ⇒ Array<Brat::ObjectifiedHash>
Gets a project deploy keys.
| 257 258 259 | # File 'lib/brat/client/projects.rb', line 257 def deploy_keys(project, ={}) get("/projects/#{project}/keys", :query => ) end | 
#edit_project_hook(project, id, url) ⇒ Brat::ObjectifiedHash
Updates a project hook URL.
| 207 208 209 | # File 'lib/brat/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<Brat::ObjectifiedHash>
Updates a team member’s project access level.
| 136 137 138 | # File 'lib/brat/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) ⇒ Brat::ObjectifiedHash
Mark this project as forked from the other
| 231 232 233 | # File 'lib/brat/client/projects.rb', line 231 def make_forked_from(project, id) post("/projects/#{project}/fork/#{id}") end | 
#project(id) ⇒ Brat::ObjectifiedHash
Gets information about a project.
| 30 31 32 | # File 'lib/brat/client/projects.rb', line 30 def project(id) get("/projects/#{id}") end | 
#project_events(project, options = {}) ⇒ Array<Brat::ObjectifiedHash>
Gets a list of project events.
| 45 46 47 | # File 'lib/brat/client/projects.rb', line 45 def project_events(project, ={}) get("/projects/#{project}/events", :query => ) end | 
#project_hook(project, id) ⇒ Brat::ObjectifiedHash
Gets a project hook.
| 177 178 179 | # File 'lib/brat/client/projects.rb', line 177 def project_hook(project, id) get("/projects/#{project}/hooks/#{id}") end | 
#project_hooks(project, options = {}) ⇒ Array<Brat::ObjectifiedHash>
Gets a list of project hooks.
| 164 165 166 | # File 'lib/brat/client/projects.rb', line 164 def project_hooks(project, ={}) get("/projects/#{project}/hooks", :query => ) end | 
#projects(options = {}) ⇒ Array<Brat::ObjectifiedHash>
Gets a list of projects owned by the authenticated user.
| 14 15 16 17 18 19 20 | # File 'lib/brat/client/projects.rb', line 14 def projects(={}) if ([:scope]) get("/projects/#{options[:scope]}", :query => ) else get("/projects", :query => ) end end | 
#remove_forked(project) ⇒ Brat::ObjectifiedHash
Remove a forked_from relationship for a project.
| 243 244 245 | # File 'lib/brat/client/projects.rb', line 243 def remove_forked(project) delete("/projects/#{project}/fork") end | 
#remove_team_member(project, id) ⇒ Brat::ObjectifiedHash
Removes a user from project team.
| 149 150 151 | # File 'lib/brat/client/projects.rb', line 149 def remove_team_member(project, id) delete("/projects/#{project}/members/#{id}") end | 
#team_member(project, id) ⇒ Brat::ObjectifiedHash
Gets a project team member.
| 108 109 110 | # File 'lib/brat/client/projects.rb', line 108 def team_member(project, id) get("/projects/#{project}/members/#{id}") end | 
#team_members(project, options = {}) ⇒ Array<Brat::ObjectifiedHash>
Gets a list of project team members.
| 96 97 98 | # File 'lib/brat/client/projects.rb', line 96 def team_members(project, ={}) get("/projects/#{project}/members", :query => ) end |