Skip to content

Commit 0d27aab

Browse files
committed
Add documenting comments
This matches the rest of the gem - these can go into the README when this is updated
1 parent ed4da9e commit 0d27aab

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

lib/bitbucket_rest_api/teams.rb

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ def initialize(options = { })
88
super(options)
99
end
1010

11+
# List teams for the authenticated user where the user has the provided role
12+
# Roles are :admin, :contributor, :member
13+
#
14+
# = Examples
15+
# bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...'
16+
# Teams.new.list(:admin)
17+
# Teams.new.list('member')
18+
# Teams.new.list(:contributor) { |team| ... }
1119
def list(user_role)
1220
response = get_request("/2.0/teams/?role=#{user_role.to_s}")
1321
return response["values"] unless block_given?
@@ -16,28 +24,58 @@ def list(user_role)
1624

1725
alias :all :list
1826

27+
# Return the profile for the provided team
28+
#
29+
# = Example
30+
# bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...'
31+
# Teams.new.profile(:team_name_here)
1932
def profile(team_name)
2033
get_request("/2.0/teams/#{team_name.to_s}")
2134
end
2235

36+
# List members of the provided team
37+
#
38+
# = Examples
39+
# bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...'
40+
# Teams.new.members(:team_name_here)
41+
# Teams.new.members(:team_name_here) { |member| ... }
2342
def members(team_name)
2443
response = get_request("/2.0/teams/#{team_name.to_s}/members")
2544
return response["values"] unless block_given?
2645
response["values"].each { |el| yield el }
2746
end
2847

48+
# List followers of the provided team
49+
#
50+
# = Examples
51+
# bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...'
52+
# Teams.new.followers(:team_name_here)
53+
# Teams.new.followers(:team_name_here) { |follower| ... }
2954
def followers(team_name)
3055
response = get_request("/2.0/teams/#{team_name.to_s}/followers")
3156
return response["values"] unless block_given?
3257
response["values"].each { |el| yield el }
3358
end
3459

60+
# List accounts following the provided team
61+
#
62+
# = Examples
63+
# bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...'
64+
# Teams.new.following(:team_name_here)
65+
# Teams.new.following(:team_name_here) { |followee| ... }
3566
def following(team_name)
3667
response = get_request("/2.0/teams/#{team_name.to_s}/following")
3768
return response["values"] unless block_given?
3869
response["values"].each { |el| yield el }
3970
end
4071

72+
# List repos for provided team
73+
# Private repos will only be returned if the user is authorized to view them
74+
#
75+
# = Examples
76+
# bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...'
77+
# Teams.new.repos(:team_name_here)
78+
# Teams.new.repos(:team_name_here) { |repo| ... }
4179
def repos(team_name)
4280
response = get_request("/2.0/repositories/#{team_name.to_s}")
4381
return response["values"] unless block_given?

0 commit comments

Comments
 (0)