class BitBucket::Teams

Public Class Methods

new(options = {}) click to toggle source
Calls superclass method BitBucket::API::new
# File lib/bitbucket_rest_api/teams.rb, line 6
def initialize(options = {})
  super(options)
end

Public Instance Methods

all(user_role)
Alias for: list
followers(team_name) { |el| ... } click to toggle source

List followers of the provided team

Examples

bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...'
bitbucket.teams.followers(:team_name_here)
bitbucket.teams.followers(:team_name_here) { |follower| ... }
# File lib/bitbucket_rest_api/teams.rb, line 55
def followers(team_name)
  response = get_request("/2.0/teams/#{team_name}/followers")
  return response['values'] unless block_given?

  response['values'].each { |el| yield el }
end
following(team_name) { |el| ... } click to toggle source

List accounts following the provided team

Examples

bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...'
bitbucket.teams.following(:team_name_here)
bitbucket.teams.following(:team_name_here) { |followee| ... }
# File lib/bitbucket_rest_api/teams.rb, line 68
def following(team_name)
  response = get_request("/2.0/teams/#{team_name}/following")
  return response['values'] unless block_given?

  response['values'].each { |el| yield el }
end
list(user_role) { |el| ... } click to toggle source

List teams for the authenticated user where the user has the provided role Roles are :admin, :contributor, :member

Examples

bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...'
bitbucket.teams.list(:admin)
bitbucket.teams.list('member')
bitbucket.teams.list(:contributor) { |team| ... }
# File lib/bitbucket_rest_api/teams.rb, line 18
def list(user_role)
  response = get_request("/2.0/teams/?role=#{user_role}")
  return response['values'] unless block_given?

  response['values'].each { |el| yield el }
end
Also aliased as: all
members(team_name) { |el| ... } click to toggle source

List members of the provided team

Examples

bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...'
bitbucket.teams.members(:team_name_here)
bitbucket.teams.members(:team_name_here) { |member| ... }
# File lib/bitbucket_rest_api/teams.rb, line 42
def members(team_name)
  response = get_request("/2.0/teams/#{team_name}/members")
  return response['values'] unless block_given?

  response['values'].each { |el| yield el }
end
profile(team_name) click to toggle source

Return the profile for the provided team

Example

bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...'
bitbucket.teams.profile(:team_name_here)
# File lib/bitbucket_rest_api/teams.rb, line 32
def profile(team_name)
  get_request("/2.0/teams/#{team_name}")
end
repos(team_name) { |el| ... } click to toggle source

List repos for provided team Private repos will only be returned if the user is authorized to view them

Examples

bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...'
bitbucket.teams.repos(:team_name_here)
bitbucket.teams.repos(:team_name_here) { |repo| ... }
# File lib/bitbucket_rest_api/teams.rb, line 82
def repos(team_name)
  response = get_request("/2.0/repositories/#{team_name}")
  return response['values'] unless block_given?

  response['values'].each { |el| yield el }
end
Also aliased as: repositories
repositories(team_name)
Alias for: repos