Class: BitBucket::Teams
- Extended by:
- AutoloadHelper
- Defined in:
- lib/bitbucket_rest_api/teams.rb
Constant Summary
Constants included from Validations
Constants included from Validations::Token
Validations::Token::TOKEN_REQUIRED, Validations::Token::TOKEN_REQUIRED_REGEXP
Constants included from Request
Request::METHODS, Request::METHODS_WITH_BODIES
Constants included from Connection
Constants included from Constants
Constants::ACCEPT, Constants::ACCEPT_CHARSET, Constants::CACHE_CONTROL, Constants::CONTENT_LENGTH, Constants::CONTENT_TYPE, Constants::DATE, Constants::ETAG, Constants::HEADER_LAST, Constants::HEADER_LINK, Constants::HEADER_NEXT, Constants::LOCATION, Constants::META_FIRST, Constants::META_LAST, Constants::META_NEXT, Constants::META_PREV, Constants::META_REL, Constants::PARAM_PAGE, Constants::PARAM_PER_PAGE, Constants::PARAM_START_PAGE, Constants::QUERY_STR_SEP, Constants::RATELIMIT_LIMIT, Constants::RATELIMIT_REMAINING, Constants::SERVER, Constants::USER_AGENT
Instance Method Summary collapse
-
#followers(team_name) ⇒ Object
List followers of the provided team.
-
#following(team_name) ⇒ Object
List accounts following the provided team.
-
#initialize(options = { }) ⇒ Teams
constructor
A new instance of Teams.
-
#list(user_role) ⇒ Object
(also: #all)
List teams for the authenticated user where the user has the provided role Roles are :admin, :contributor, :member.
-
#members(team_name) ⇒ Object
List members of the provided team.
-
#profile(team_name) ⇒ Object
Return the profile for the provided team.
-
#repos(team_name) ⇒ Object
(also: #repositories)
List repos for provided team Private repos will only be returned if the user is authorized to view them.
Methods included from AutoloadHelper
autoload_all, lookup_constant, register_constant
Methods inherited from API
#_merge_mime_type, #_merge_user_into_params!, #_merge_user_repo_into_params!, #_update_user_repo_params, #api_methods_in, inherited, #method_missing, #process_basic_auth, #set_api_client, #setup, #update_and_validate_user_repo_params
Methods included from Normalizer
Methods included from ParameterFilter
Methods included from Validations::Required
#assert_required_keys, #assert_required_values_present, #parse_values
Methods included from Validations::Token
Methods included from Validations::Format
Methods included from Validations::Presence
#_validate_presence_of, #_validate_user_repo_params
Methods included from Request
#delete_request, #get_request, #patch_request, #post_request, #put_request, #request
Methods included from Connection
#caching?, #clear_cache, #connection, #default_middleware, #default_options, #stack
Methods included from Authorization
#authenticated?, #authentication, #basic_authed?
Constructor Details
#initialize(options = { }) ⇒ Teams
Returns a new instance of Teams.
7 8 9 |
# File 'lib/bitbucket_rest_api/teams.rb', line 7 def initialize( = { }) super() end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class BitBucket::API
Instance Method Details
#followers(team_name) ⇒ Object
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| ... }
54 55 56 57 58 |
# File 'lib/bitbucket_rest_api/teams.rb', line 54 def followers(team_name) response = get_request("/2.0/teams/#{team_name.to_s}/followers") return response["values"] unless block_given? response["values"].each { |el| yield el } end |
#following(team_name) ⇒ Object
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| ... }
66 67 68 69 70 |
# File 'lib/bitbucket_rest_api/teams.rb', line 66 def following(team_name) response = get_request("/2.0/teams/#{team_name.to_s}/following") return response["values"] unless block_given? response["values"].each { |el| yield el } end |
#list(user_role) ⇒ Object Also known as: all
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| ... }
19 20 21 22 23 |
# File 'lib/bitbucket_rest_api/teams.rb', line 19 def list(user_role) response = get_request("/2.0/teams/?role=#{user_role.to_s}") return response["values"] unless block_given? response["values"].each { |el| yield el } end |
#members(team_name) ⇒ Object
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| ... }
42 43 44 45 46 |
# File 'lib/bitbucket_rest_api/teams.rb', line 42 def members(team_name) response = get_request("/2.0/teams/#{team_name.to_s}/members") return response["values"] unless block_given? response["values"].each { |el| yield el } end |
#profile(team_name) ⇒ Object
32 33 34 |
# File 'lib/bitbucket_rest_api/teams.rb', line 32 def profile(team_name) get_request("/2.0/teams/#{team_name.to_s}") end |
#repos(team_name) ⇒ Object Also known as: repositories
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| ... }
79 80 81 82 83 |
# File 'lib/bitbucket_rest_api/teams.rb', line 79 def repos(team_name) response = get_request("/2.0/repositories/#{team_name.to_s}") return response["values"] unless block_given? response["values"].each { |el| yield el } end |