Skip to content

Commit

Permalink
Look up all teams for a user across all their orgs
Browse files Browse the repository at this point in the history
  • Loading branch information
pengwynn committed Oct 7, 2013
1 parent e4c104d commit d3ac397
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/octokit/client/organizations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,11 @@ def unpublicize_membership(org, user, options = {})
end
alias :conceal_membership :unpublicize_membership

# List all teams for the authenticated user across all their orgs
#
def user_teams(options = {})
paginate "/user/teams", options
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"http_interactions":[{"request":{"method":"get","uri":"https://api.github.com/user/teams","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"Accept":["application/vnd.github.beta+json"],"User-Agent":["Octokit Ruby Gem 2.3.1"],"Authorization":["token <<ACCESS_TOKEN>>"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["GitHub.com"],"Date":["Mon, 07 Oct 2013 23:05:02 GMT"],"Content-Type":["application/json; charset=utf-8"],"Transfer-Encoding":["chunked"],"Status":["200 OK"],"X-Ratelimit-Limit":["5000"],"X-Ratelimit-Remaining":["4997"],"X-Ratelimit-Reset":["1381190511"],"Cache-Control":["private, max-age=60, s-maxage=60"],"Last-Modified":["Wed, 01 May 2013 13:16:01 GMT"],"Etag":["\"c0aa814b8b30e8586564008a501e3928\""],"X-Oauth-Scopes":["repo, user, gist, delete_repo"],"X-Accepted-Oauth-Scopes":["repo, user"],"Vary":["Accept, Authorization, Cookie","Accept-Encoding"],"X-Github-Media-Type":["github.beta; format=json"],"X-Content-Type-Options":["nosniff"],"Access-Control-Allow-Credentials":["true"],"Access-Control-Expose-Headers":["ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes"],"Access-Control-Allow-Origin":["*"],"X-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aHViLmNvbS85YjVjNWViMTg5NzI0\nN2QxZDM5NTMzOGJhZWRiYzVjYS5wbmcifX1d\n"},"http_version":null},"recorded_at":"Mon, 07 Oct 2013 23:05:01 GMT"}],"recorded_with":"VCR 2.4.0"}
8 changes: 8 additions & 0 deletions spec/octokit/client/organizations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,12 @@
end
end # .remove_organization_member

describe ".user_teams", :vcr do
it "lists all teams for the authenticated user" do
teams = @client.user_teams
assert_requested :get, github_url("/user/teams")
expect(teams).to be_kind_of(Array)
end
end

end

0 comments on commit d3ac397

Please sign in to comment.