class Github::Client::Repos::Collaborators
Public Instance Methods
add(*args)
click to toggle source
Add collaborator
@example
github = Github.new github.repos.collaborators.add 'user', 'repo', 'username'
@example
collaborators = Github::Repos::Collaborators.new collaborators.add 'user', 'repo', 'username'
@api public
# File lib/github_api/client/repos/collaborators.rb, line 42 def add(*args) arguments(args, required: [:user, :repo, :username]) put_request("/repos/#{arguments.user}/#{arguments.repo}/collaborators/#{arguments.username}", arguments.params) end
Also aliased as: <<
collaborator?(*args)
click to toggle source
Checks if user is a collaborator for a given repository
@example
github = Github.new github.repos.collaborators.collaborator?('user', 'repo', 'username')
@example
github = Github.new user: 'user-name', repo: 'repo-name' github.collaborators.collaborator? username: 'collaborator'
@api public
# File lib/github_api/client/repos/collaborators.rb, line 60 def collaborator?(*args) arguments(args, required: [:user, :repo, :username]) get_request("/repos/#{arguments.user}/#{arguments.repo}/collaborators/#{arguments.username}", arguments.params) true rescue Github::Error::NotFound false end
list(*args) { |el| ... }
click to toggle source
List collaborators
When authenticating as an organization owner of an organization-owned repository, all organization owners are included in the list of collaborators. Otherwise, only users with access to the repository are returned in the collaborators list.
@example
github = Github.new github.repos.collaborators.list 'user-name', 'repo-name'
@example
github.repos.collaborators.list 'user-name', 'repo-name' { |cbr| .. }
@return [Array]
@api public
# File lib/github_api/client/repos/collaborators.rb, line 21 def list(*args) arguments(args, required: [:user, :repo]) params = arguments.params response = get_request("/repos/#{arguments.user}/#{arguments.repo}/collaborators", arguments.params) return response unless block_given? response.each { |el| yield el } end
Also aliased as: all
remove(*args)
click to toggle source
Removes collaborator
@example
github = Github.new github.repos.collaborators.remove 'user', 'repo', 'username'
@api public
# File lib/github_api/client/repos/collaborators.rb, line 76 def remove(*args) arguments(args, required: [:user, :repo, :username]) delete_request("/repos/#{arguments.user}/#{arguments.repo}/collaborators/#{arguments.username}", arguments.params) end