class Github::Client::Repos::Branches::Protections

The Branch Protections API

Constants

VALID_PROTECTION_PARAM_NAMES

Public Instance Methods

delete(*args) click to toggle source

Delete a branch protection

@example

github = Github.new
github.repos.branches.protections.delete 'user', 'repo', 'branch'

@api public

# File lib/github_api/client/repos/branches/protections.rb, line 68
def delete(*args)
  arguments(args, required: [:user, :repo, :branch])

  delete_request("/repos/#{arguments.user}/#{arguments.repo}/branches/#{arguments.branch}/protection", arguments.params)
end
Also aliased as: remove
edit(*args) click to toggle source

Edit a branch protection

Users with push access to the repository can edit a branch protection.

@param [Hash] params @input params [String] :required_status_checks

Required.

@input params [String] :enforce_admins

Required.

@input params [String] :restrictions

Required.

@input params [String] :required_pull_request_reviews

Required.

Look to the branch protection API to see how to use these developer.github.com/v3/repos/branches/#update-branch-protection

@example

github = Github.new
github.repos.branches.protections.edit 'user', 'repo', 'branch',
  required_pull_request_reviews: {dismiss_stale_reviews: false}

@api public

# File lib/github_api/client/repos/branches/protections.rb, line 52
def edit(*args)
  arguments(args, required: [:user, :repo, :branch]) do
    permit VALID_PROTECTION_PARAM_NAMES
  end

  put_request("/repos/#{arguments.user}/#{arguments.repo}/branches/#{arguments.branch}/protection", arguments.params)
end
Also aliased as: update
find(*args)
Alias for: get
get(*args) click to toggle source

Get a single branch's protection

@example

github = Github.new
github.repos.branches.protections.get 'user', 'repo', 'branch'

@api public

# File lib/github_api/client/repos/branches/protections.rb, line 23
def get(*args)
  arguments(args, required: [:user, :repo, :branch])

  get_request("/repos/#{arguments.user}/#{arguments.repo}/branches/#{arguments.branch}/protection", arguments.params)
end
Also aliased as: find
remove(*args)
Alias for: delete
update(*args)
Alias for: edit