Class: LabClient::ProtectedBranches
- Defined in:
- lib/labclient/protected_branches/list.rb,
lib/labclient/protected_branches/show.rb,
lib/labclient/protected_branches/protect.rb,
lib/labclient/protected_branches/unprotect.rb,
lib/labclient/protected_branches/code_owner_approval.rb
Overview
Specifics
Constant Summary
Constants included from AccessLevel
AccessLevel::HUMAN_ACCESS_LEVELS, AccessLevel::MACHINE_ACCESS_LEVELS
Instance Attribute Summary
Attributes inherited from Common
Instance Method Summary collapse
- #code_owner_approval(project_id, branch_id, approv_id = true) ⇒ Object
- #list(project_id, search = nil) ⇒ Object
- #protect(project_id, query) ⇒ Object
- #show(project_id, branch_id) ⇒ Object
- #unprotect(project_id, branch_id) ⇒ Object
Methods inherited from Common
#api_methods, #api_methods_help, #format_id, #format_query_id, #format_query_ids, #format_time?, #group_name, #help, #initialize, #inspect, #klass, #protected_query_access_level, #query_access_level, #query_format_time
Methods included from Docs
#demo, #desc, #doc, docs, #example, #group_name, #help, json, #markdown, #navigation, #option, #result, #subtitle, #title
Methods included from AccessLevel
#human_access_level, #human_protected_access_level, #machine_access_level, #machine_protected_access_level
Constructor Details
This class inherits a constructor from LabClient::Common
Instance Method Details
#code_owner_approval(project_id, branch_id, approv_id = true) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/labclient/protected_branches/code_owner_approval.rb', line 19 def code_owner_approval(project_id, branch_id, approv_id = true) query = { code_owner_approval_required: approv_id } project_id = format_id(project_id) client.request(:patch, "projects/#{project_id}/protected_branches/#{branch_id}", Branch, query) end |
#list(project_id, search = nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/labclient/protected_branches/list.rb', line 23 def list(project_id, search = nil) query = if search.nil? nil else { search: search } end project_id = format_id(project_id) client.request(:get, "projects/#{project_id}/protected_branches", Branch, query) end |
#protect(project_id, query) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/labclient/protected_branches/protect.rb', line 40 def protect(project_id, query) protected_query_access_level(query, :push_access_level) protected_query_access_level(query, :merge_access_level) protected_query_access_level(query, :unprotect_access_level) # POST /projects/:id/protected_branches project_id = format_id(project_id) client.request(:post, "projects/#{project_id}/protected_branches", Branch, query) end |
#show(project_id, branch_id) ⇒ Object
19 20 21 22 |
# File 'lib/labclient/protected_branches/show.rb', line 19 def show(project_id, branch_id) project_id = format_id(project_id) client.request(:get, "projects/#{project_id}/protected_branches/#{branch_id}", Branch) end |
#unprotect(project_id, branch_id) ⇒ Object
19 20 21 22 |
# File 'lib/labclient/protected_branches/unprotect.rb', line 19 def unprotect(project_id, branch_id) project_id = format_id(project_id) client.request(:delete, "projects/#{project_id}/protected_branches/#{branch_id}", Branch) end |