module Github::Repos::Collaborators
def add_collaborator(user, repo, collaborator)
@repos.add_collaborator('user', 'repo', 'collaborator')
@repos = Github::Repos.new
@github.collaborators.add_collaborator('user', 'repo', 'collaborator')
@github = Github.new
Examples:
Add collaborator
def add_collaborator(user, repo, collaborator) put("/repos/#{user}/#{repo}/collaborators/#{collaborator}") end
def collaborator?(user_name, repo_name, collaborator)
@github.collaborators.collaborator?('user', 'repo', 'collaborator')
@github = Github.new
Examples:
Checks if user is a collaborator for a given repository
def collaborator?(user_name, repo_name, collaborator) get("/repos/#{user}/#{repo}/collaborators/#{collaborator}") end
def collaborators(user_name=nil, repo_name=nil)
@github.repos.collaborators('user-name', 'repo-name') { |cbr| .. }
@github.repos.collaborators('user-name', 'repo-name')
@github = Github.new
Examples:
List collaborators
def collaborators(user_name=nil, repo_name=nil) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless (user? && repo?) response = get("/repos/#{user}/#{repo}/collaborators") return response unless block_given? response.each { |el| yield el } end
def remove_collabolator(user, repo, collaborator)
@github.collaborators.remove('user', 'repo', 'collaborator')
@github = Github.new
Examples:
Removes collaborator
def remove_collabolator(user, repo, collaborator) delete("/repos/#{user}/#{repo}/collaborators/#{user}") end