class Github::Repos::Collaborators
def add(*args)
collaborators.add 'user', 'repo', 'collaborator'
collaborators = Github::Repos::Collaborators.new
github.collaborators.add 'user', 'repo', 'collaborator'
github = Github.new
Examples:
Add collaborator
def add(*args) arguments(args, :required => [:user, :repo, :collaborator]) params = arguments.params put_request("/repos/#{user}/#{repo}/collaborators/#{collaborator}", params) end
def collaborator?(*args)
github.collaborators.collaborator? collaborator: 'collaborator'
github = Github.new user: 'user-name', repo: 'repo-name'
github.repos.collaborators.collaborator?('user', 'repo', 'collaborator')
github = Github.new
Examples:
Checks if user is a collaborator for a given repository
def collaborator?(*args) arguments(args, :required => [:user, :repo, :collaborator]) params = arguments.params get_request("/repos/#{user}/#{repo}/collaborators/#{collaborator}", params) true rescue Github::Error::NotFound false end
def list(*args)
github.repos.collaborators.list 'user-name', 'repo-name' { |cbr| .. }
github.repos.collaborators.list 'user-name', 'repo-name'
github = Github.new
Examples:
List collaborators
def list(*args) arguments(args, :required => [:user, :repo]) params = arguments.params response = get_request("/repos/#{user}/#{repo}/collaborators", params) return response unless block_given? response.each { |el| yield el } end
def remove(*args)
github.repos.collaborators.remove 'user', 'repo', 'collaborator'
github = Github.new
Examples:
Removes collaborator
def remove(*args) arguments(args, :required => [:user, :repo, :collaborator]) params = arguments.params delete_request("/repos/#{user}/#{repo}/collaborators/#{collaborator}", params) end