Parent

Class/Module Index [+]

Quicksearch

Github::Client::Orgs::Teams

Constants

VALID_TEAM_PARAM_NAMES

All actions against teams require at a minimum an authenticated user who is a member of the owner’s team in the :org being managed. Api calls that require explicit permissions are noted.

VALID_TEAM_PARAM_VALUES

Public Instance Methods

add_member(*args) click to toggle source

Add a team member

In order to add a user to a team, the authenticated user must have ‘admin’ permissions to the team or be an owner of the org that the team is associated with.

@example

github = Github.new oauth_token: '...'
github.orgs.teams.add_member 'team-id', 'user-name'

@api public

# File lib/github_api/client/orgs/teams.rb, line 194
def add_member(*args)
  arguments(args, required: [:id, :user])

  put_request("/teams/#{arguments.id}/members/#{arguments.user}", arguments.params)
end
Also aliased as: add_team_member
add_repo(*args) click to toggle source

Add a team repository

In order to add a repo to a team, the authenticated user must be an owner of the org that the team is associated with. Also, the repo must be owned by the organization, or a direct for of a repo owned by the organization.

@example

github = Github.new oauth_token: '...'
github.orgs.teams.add_repo 'team-id', 'user-name', 'repo-name'

@api public

# File lib/github_api/client/orgs/teams.rb, line 265
def add_repo(*args)
  arguments(args, required: [:id, :user, :repo])

  put_request("/teams/#{arguments.id}/repos/#{arguments.user}/#{arguments.repo}", arguments.params)
end
Also aliased as: add_repository
add_repository(*args) click to toggle source
Alias for: add_repo
add_team_member(*args) click to toggle source
Alias for: add_member
all(*args) click to toggle source
Alias for: list
all_members(*args) click to toggle source
Alias for: list_members
create(*args) click to toggle source

Create a team

In order to create a team, the authenticated user must be an owner of :org

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

Required. The name of the team

@input params [Array] :repo_names

The repositories to add the team to.

@input params [String] :permission

The permission to grant the team. Can be one of:
 * pull - team members can pull, but not push or
          administor this repositories.
 * push - team members can pull and push,
          but not administor this repositores.
 * admin - team members can pull, push and
           administor these repositories.
Default: pull

@example

github = Github.new oauth_token: '...'
github.orgs.teams.create 'org-name',
  name: "new team",
  permission: "push",
  repo_names: [
    "github/dotfiles"
  ]

@api public

# File lib/github_api/client/orgs/teams.rb, line 86
def create(*args)
  arguments(args, required: [:org_name]) do
    permit VALID_TEAM_PARAM_NAMES
    assert_values VALID_TEAM_PARAM_VALUES
    assert_required ]name]
  end

  post_request("/orgs/#{arguments.org_name}/teams", arguments.params)
end
delete(*args) click to toggle source

Delete a team

In order to delete a team, the authenticated user must be an owner of the org that the team is associated with

@example

github = Github.new oauth_token: '...'
github.orgs.teams.delete 'team-id'
# File lib/github_api/client/orgs/teams.rb, line 140
def delete(*args)
  arguments(args, required: [:id])

  delete_request("/teams/#{arguments.id}", arguments.params)
end
Also aliased as: remove
edit(*args) click to toggle source

Edit a team

In order to edit a team, the authenticated user must be an owner of the org that the team is associated with.

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

The repositories to add the team to.

@input params [String] :permission

The permission to grant the team. Can be one of:
 * pull - team members can pull, but not push or
          administor this repositories.
 * push - team members can pull and push,
          but not administor this repositores.
 * admin - team members can pull, push and
           administor these repositories.
Default: pull

@example

github = Github.new oauth_token: '...'
github.orgs.teams.edit 'team-id',
  name: "new team name",
  permission: "push"

@api public

# File lib/github_api/client/orgs/teams.rb, line 121
def edit(*args)
  arguments(args, required: [:id]) do
    permit VALID_TEAM_PARAM_NAMES
    assert_values VALID_TEAM_PARAM_VALUES
    assert_required ]name]
  end

  patch_request("/teams/#{arguments.id}", arguments.params)
end
find(*args) click to toggle source
Alias for: get
get(*args) click to toggle source

Get a team

@example

github = Github.new oauth_token: '...'
github.orgs.teams.get 'team-id'

@api public

# File lib/github_api/client/orgs/teams.rb, line 50
def get(*args)
  arguments(args, required: [:id])

  get_request("/teams/#{arguments.id}", arguments.params)
end
Also aliased as: find
list(*args) click to toggle source

List user teams

List all of the teams across all of the organizations to which the authenticated user belongs. This method requires user or repo scope when authenticating via OAuth.

@example

github = Github.new oauth_token: '...'
github.orgs.teams.list

List teams

@example

github = Github.new oauth_token: '...'
github.orgs.teams.list org: 'org-name'

@api public

# File lib/github_api/client/orgs/teams.rb, line 30
def list(*args)
  params = arguments(args).params

  response = if org = params.delete('org')
    get_request("/orgs/#{org}/teams", params)
  else
    get_request("/user/teams", params)
  end
  return response unless block_given?
  response.each { |el| yield el }
end
Also aliased as: all
list_members(*args) click to toggle source

List team members

In order to list members in a team, the authenticated user must be a member of the team.

@example

github = Github.new oauth_token: '...'
github.orgs.teams.list_members 'team-id'
github.orgs.teams.list_members 'team-id' { |member| ... }

@api public

# File lib/github_api/client/orgs/teams.rb, line 158
def list_members(*args)
  arguments(args, required: [:id])

  response = get_request("/teams/#{arguments.id}/members", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end
Also aliased as: all_members
list_repos(*args) click to toggle source

List team repositories

@example

github = Github.new oauth_token: '...'
github.orgs.teams.list_repos 'team-id'

@api public

# File lib/github_api/client/orgs/teams.rb, line 227
def list_repos(*args)
  arguments(args, required: [:id])

  response = get_request("/teams/#{arguments.id}/repos", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end
Also aliased as: repos
remove(*args) click to toggle source
Alias for: delete
remove_member(*args) click to toggle source

Remove a team member

In order to remove a user from a team, the authenticated user must have ‘admin’ permissions to the team or be an owner of the org that the team is associated with. note: This does not delete the user, it just remove them from the team.

@example

github = Github.new oauth_token: '...'
github.orgs.teams.remove_member 'team-id', 'user-name'

@api public

# File lib/github_api/client/orgs/teams.rb, line 213
def remove_member(*args)
  arguments(args, required: [:id, :user])

  delete_request("/teams/#{arguments.id}/members/#{arguments.user}", arguments.params)
end
Also aliased as: remove_team_member
remove_repo(*args) click to toggle source

Remove a team repository

In order to add a repo to a team, the authenticated user must be an owner of the org that the team is associated with. note: This does not delete the repo, it just removes it from the team.

@example

github = Github.new oauth_token: '...'
github.orgs.teams.remove_repo 'team-id', 'user-name', 'repo-name'

@api public

# File lib/github_api/client/orgs/teams.rb, line 283
def remove_repo(*args)
  arguments(args, required: [:id, :user, :repo])

  delete_request("/teams/#{arguments.id}/repos/#{arguments.user}/#{arguments.repo}", arguments.params)
end
Also aliased as: remove_repository
remove_repository(*args) click to toggle source
Alias for: remove_repo
remove_team_member(*args) click to toggle source
Alias for: remove_member
repos(*args) click to toggle source
Alias for: list_repos
team_member?(*args) click to toggle source

Check if a user is a member of a team

@example

github = Github.new oauth_token: '...'
github.orgs.teams.team_member? 'team-id', 'user-name'

@api public

# File lib/github_api/client/orgs/teams.rb, line 174
def team_member?(*args)
  arguments(args, required: [:id, :user])

  response = get_request("/teams/#{arguments.id}/members/#{arguments.user}", arguments.params)
  response.status == 204
rescue Github::Error::NotFound
  false
end
team_repo?(*args) click to toggle source

Check if a repository belongs to a team

@example

github = Github.new oauth_token: '...'
github.orgs.teams.team_repo? 'team-id', 'user-name', 'repo-name'

@api public

# File lib/github_api/client/orgs/teams.rb, line 243
def team_repo?(*args)
  arguments(args, required: [:id, :user, :repo])

  response = get_request("/teams/#{arguments.id}/repos/#{arguments.user}/#{arguments.repo}", arguments.params)
  response.status == 204
rescue Github::Error::NotFound
  false
end
Also aliased as: team_repository?
team_repository?(*args) click to toggle source
Alias for: team_repo?

[Validate]

Generated with the Darkfish Rdoc Generator 2.