module Github::Orgs::Teams
def add_team_member(team_name, member_name, params={})
@github.orgs.add_team_member 'team-name', 'user-name'
@github = Github.new :oauth_token => '...'
= Examples
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.
Add a team member
def add_team_member(team_name, member_name, params={}) _validate_presence_of team_name, member_name _normalize_params_keys(params) put("/teams/#{team_name}/members/#{member_name}", params) end
def add_team_repo(team_name, user_name, repo_name, params={})
@github.orgs.add_team_repo 'team-name', 'user-name', 'repo-name'
@github = Github.new :oauth_token => '...'
= Examples
an owner of the org that the team is associated with.
In order to add a repo to a team, the authenticated user must be
Add a team repository
def add_team_repo(team_name, user_name, repo_name, params={}) _validate_presence_of team_name, user_name, repo_name _normalize_params_keys(params) put("/teams/#{team_name}/repos/#{user_name}/#{repo_name}", params) end
def create_team(org_name, params={})
]
"github/dotfiles"
"repo_names" => [
"permission" => "push",
"name" => "new team",
@github.orgs.create_team 'org-name',
@github = Github.new :oauth_token => '...'
= Examples
* admin - team members can pull, push and administor these repositories.
* push - team members can pull and push, but not administor this repositores.
* pull - team members can pull, but not push or administor this repositories. Default
:permission - Optional string
:repo_names - Optional array of strings
:name - Required string
= Inputs
In order to create a team, the authenticated user must be an owner of:org.
Create a team
def create_team(org_name, params={}) _validate_presence_of org_name _normalize_params_keys(params) _filter_params_keys(VALID_TEAM_PARAM_NAMES, params) _validate_params_values(VALID_TEAM_PARAM_VALUES, params) raise ArgumentError, "Required params are: :name" unless _validate_inputs(%w[ name ], params) post("/orgs/#{org_name}/teams", params) end
def delete_team(team_name, params={})
@github.orgs.delete_team 'team-name'
@github = Github.new :oauth_token => '...'
= Examples
In order to delete a team, the authenticated user must be an owner of the org that the team is associated with
Delete a team
def delete_team(team_name, params={}) _validate_presence_of team_name _normalize_params_keys(params) delete("/teams/#{team_name}", params) end
def edit_team(team_name, params={})
"permission" => "push"
"name" => "new team name",
@github.orgs.edit_team 'team-name',
@github = Github.new :oauth_token => '...'
= Examples
* admin - team members can pull, push and administor these repositories.
* push - team members can pull and push, but not administor this repositores.
* pull - team members can pull, but not push or administor this repositories. Default
:permission - Optional string
:name - Required string
= Inputs
In order to edit a team, the authenticated user must be an owner of the org that the team is associated with.
Create a team
def edit_team(team_name, params={}) _validate_presence_of team_name _normalize_params_keys(params) _filter_params_keys(VALID_TEAM_PARAM_NAMES, params) _validate_params_values(VALID_TEAM_PARAM_VALUES, params) raise ArgumentError, "Required params are: :name" unless _validate_inputs(%w[ name ], params) patch("/teams/#{team_name}", params) end
def remove_team_member(team_name, member_name, params={})
@github.orgs.remove_team_member 'team-name', 'member-name'
@github = Github.new :oauth_token => '...'
= Examples
note: This does not delete the user, it just remove them from the team.
the team is associated with.
have ‘admin’ permissions to the team or be an owner of the org that
In order to remove a user from a team, the authenticated user must
Remove a team member
def remove_team_member(team_name, member_name, params={}) _validate_presence_of team_name, member_name _normalize_params_keys(params) delete("/teams/#{team_name}/members/#{member_name}", params) end
def remove_team_repo(team_name, user_name, repo_name, params={})
@github.orgs.remove_team_repo 'team-name', 'user-name', 'repo-name'
@github = Github.new :oauth_token => '...'
= Examples
note: This does not delete the repo, it just removes it from the team.
an owner of the org that the team is associated with.
In order to add a repo to a team, the authenticated user must be
Remove a team repository
def remove_team_repo(team_name, user_name, repo_name, params={}) _validate_presence_of team_name, user_name, repo_name _normalize_params_keys(params) delete("/teams/#{team_name}/repos/#{user_name}/#{repo_name}", params) end
def team(team_name, params={})
@github.orgs.team 'team-name'
@github = Github.new :oauth_token => '...'
= Examples
Get a team
def team(team_name, params={}) _validate_presence_of team_name _normalize_params_keys(params) get("/teams/#{team_name}", params) end
def team_member?(team_name, member_name, params={})
@github.orgs.team_member? 'team-name', 'user-name'
@github = Github.new :oauth_token => '...'
= Examples
Check if a user is a member of a team
def team_member?(team_name, member_name, params={}) _validate_presence_of team_name, member_name _normalize_params_keys(params) get("/teams/#{team_name}/members/#{member_name}", params) true rescue Github::ResourceNotFound false end
def team_members(team_name, params={})
@github.orgs.team_members 'team-name' { |member| ... }
@github.orgs.team_members 'team-name'
@github = Github.new :oauth_token => '...'
= Examples
In order to list members in a team, the authenticated user must be a member of the team.
List team members
def team_members(team_name, params={}) _validate_presence_of team_name _normalize_params_keys(params) response = get("/teams/:id/members", params) return response unless block_given? response.each { |el| yield el } end
def team_repo?(team_name, user_name, repo_name, params={})
@github.orgs.team_repo? 'team-name'
@github = Github.new :oauth_token => '...'
= Examples
Check if a repository belongs to a team
def team_repo?(team_name, user_name, repo_name, params={}) _validate_presence_of team_name, user_name, repo_name _normalize_params_keys(params) get("/teams/#{team_name}/repos/#{user_name}/#{repo_name}", params) true rescue Github::ResourceNotFound false end
def team_repos(team_name, params={})
@github.orgs.team_repos 'team-name'
@github = Github.new :oauth_token => '...'
= Examples
List team repositories
def team_repos(team_name, params={}) _validate_presence_of team_name, member_name _normalize_params_keys(params) response = get("/teams/#{team_name}/repos", params) return response unless block_given? response.each { |el| yield el } end
def teams(org_name, params={})
@github.orgs.teams 'org-name'
@github = Github.new :oauth_token => '...'
= Examples
List teams
def teams(org_name, params={}) _validate_presence_of org_name _normalize_params_keys(params) get("/orgs/#{org_name}/teams", params) return response unless block_given? response.each { |el| yield el } end