Parent

Class/Module Index [+]

Quicksearch

Github::Client::Repos::Collaborators

Public Instance Methods

<<(*args) click to toggle source
Alias for: add
add(*args) click to toggle source

Add collaborator

@example

github = Github.new
github.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: <<
all(*args) click to toggle source
Alias for: list
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) 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.