### Home Classes Methods

### In Files

- lib/github_api/orgs/teams.rb

### Parent

Github::API

### Methods

- #add_member
- #add_repo
- #add_repository
- #add_team_member
- #all
- #all_members
- #create
- #delete
- #edit
- #find
- #get
- #list
- #list_members
- #list_repos
- #remove
- #remove_member
- #remove_repo
- #remove_repository
- #remove_team_member
- #repos
- #team_member?
- #team_repo?
- #team_repository?

### Class/Module Index

Quicksearch

- Github
- Github::API
- Github::Activity
- Github::Activity::Events
- Github::Activity::Notifications
- Github::Activity::Starring
- Github::Activity::Watching
- Github::ApiFactory
- Github::Arguments
- Github::Authorization
- Github::Authorizations
- Github::AutoloadHelper
- Github::Client
- Github::Configuration
- Github::Connection
- Github::Constants
- Github::CoreExt
- Github::CoreExt::OrderedHash
- Github::Descendants
- Github::Emojis
- Github::Error
- Github::Error::BadRequest
- Github::Error::ClientError
- Github::Error::Forbidden
- Github::Error::GithubError
- Github::Error::InternalServerError
- Github::Error::InvalidOptions
- Github::Error::NotAcceptable
- Github::Error::NotFound
- Github::Error::RequiredParams
- Github::Error::ServiceError
- Github::Error::ServiceUnavailable
- Github::Error::Unauthorized
- Github::Error::UnknownValue
- Github::Error::UnprocessableEntity
- Github::Error::Validations
- Github::Gists
- Github::Gists::Comments
- Github::GitData
- Github::GitData::Blobs
- Github::GitData::Commits
- Github::GitData::References
- Github::GitData::Tags
- Github::GitData::Trees
- Github::Gitignore
- Github::Issues
- Github::Issues::Assignees
- Github::Issues::Comments
- Github::Issues::Events
- Github::Issues::Labels
- Github::Issues::Milestones
- Github::Jsonable
- Github::Markdown
- Github::Meta
- Github::MimeType
- Github::Normalizer
- Github::Orgs
- Github::Orgs::Members
- Github::Orgs::Teams
- Github::PageIterator
- Github::PageLinks
- Github::PagedRequest
- Github::Pagination
- Github::ParameterFilter
- Github::ParamsHash
- Github::PullRequests
- Github::PullRequests::Comments
- Github::RateLimit
- Github::Repos
- Github::Repos::Collaborators
- Github::Repos::Comments
- Github::Repos::Commits
- Github::Repos::Contents
- Github::Repos::Downloads
- Github::Repos::Forks
- Github::Repos::Hooks
- Github::Repos::Keys
- Github::Repos::Merging
- Github::Repos::PubSubHubbub
- Github::Repos::Statistics
- Github::Repos::Statuses
- Github::Request
- Github::Request::BasicAuth
- Github::Request::Jsonize
- Github::Request::OAuth2
- Github::Resource
- Github::Response
- Github::Response::Header
- Github::Response::Jsonize
- Github::Response::Mashify
- Github::Response::RaiseError
- Github::Response::Xmlize
- Github::ResponseWrapper
- Github::S3Uploader
- Github::Say
- Github::Scopes
- Github::Search
- Github::Users
- Github::Users::Emails
- Github::Users::Followers
- Github::Users::Keys
- Github::Utils
- Github::Utils::Url
- Github::VERSION
- Github::Validations
- Github::Validations::Format
- Github::Validations::Presence
- Github::Validations::Required
- Github::Validations::Token
- Hash

No matching classes.

# Github::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.

# Examples

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

    # File lib/github_api/orgs/teams.rb, line 150
    def add_member(*args)
      arguments(args, :required => [:team_id, :user])

      put_request("/teams/#{team_id}/members/#{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.

# Examples

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

    # File lib/github_api/orgs/teams.rb, line 217
    def add_repo(*args)
      arguments(args, :required => [:team_id, :user, :repo])

      put_request("/teams/#{team_id}/repos/#{user}/#{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`.

# Inputs

    <tt>:name</tt> - Required string
    <tt>:repo_names</tt> - Optional array of strings
    <tt>:permission</tt> - Optional string
      * <tt>pull</tt> - team members can pull, but not push or administor this repositories. Default
      * <tt>push</tt> - team members can pull and push, but not administor this repositores.
      * <tt>admin</tt> - team members can pull, push and administor these repositories.

# Examples

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

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

      post_request("/orgs/#{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

# Examples

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

    # File lib/github_api/orgs/teams.rb, line 104
    def delete(*args)
      arguments(args, :required => [:team_id])

      delete_request("/teams/#{team_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.

# Inputs

    <tt>:name</tt> - Required string
    <tt>:permission</tt> - Optional string
      * <tt>pull</tt> - team members can pull, but not push or administor this repositories. Default
      * <tt>push</tt> - team members can pull and push, but not administor this repositores.
      * <tt>admin</tt> - team members can pull, push and administor these repositories.

# Examples

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

    # File lib/github_api/orgs/teams.rb, line 87
    def edit(*args)
      arguments(args, :required => [:team_id]) do
        sift VALID_TEAM_PARAM_NAMES
        assert_values VALID_TEAM_PARAM_VALUES
        assert_required ]name]
      end

      patch_request("/teams/#{team_id}", arguments.params)
    end

find(*args) click to toggle source
Alias for: get
get(*args) click to toggle source

Get a team

# Examples

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

    # File lib/github_api/orgs/teams.rb, line 34
    def get(*args)
      arguments(args, :required => [:team_id])

      get_request("/teams/#{team_id}", arguments.params)
    end

Also aliased as: find
list(*args) click to toggle source

List teams

# Examples

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

    # File lib/github_api/orgs/teams.rb, line 19
    def list(*args)
      arguments(args, :required => [:org_name])

      response = get_request("/orgs/#{org_name}/teams", arguments.params)
      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.

# Examples

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

    # File lib/github_api/orgs/teams.rb, line 119
    def list_members(*args)
      arguments(args, :required => [:team_id])

      response = get_request("/teams/#{team_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

# Examples

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

    # File lib/github_api/orgs/teams.rb, line 181
    def list_repos(*args)
      arguments(args, :required => [:team_id])

      response = get_request("/teams/#{team_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.

# Examples

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

    # File lib/github_api/orgs/teams.rb, line 168
    def remove_member(*args)
      arguments(args, :required => [:team_id, :user])

      delete_request("/teams/#{team_id}/members/#{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.

# Examples

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

    # File lib/github_api/orgs/teams.rb, line 234
    def remove_repo(*args)
      arguments(args, :required => [:team_id, :user, :repo])

      delete_request("/teams/#{team_id}/repos/#{user}/#{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

# Examples

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

    # File lib/github_api/orgs/teams.rb, line 134
    def team_member?(*args)
      arguments(args, :required => [:team_id, :user])

      response = get_request("/teams/#{team_id}/members/#{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

# Examples

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

    # File lib/github_api/orgs/teams.rb, line 196
    def team_repo?(*args)
      arguments(args, :required => [:team_id, :user, :repo])

      response = get_request("/teams/#{team_id}/repos/#{user}/#{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.