Permalink
Browse files

add repo watchers

  • Loading branch information...
1 parent 5d7bd58 commit 410a8475eb501a41dd978f17766d80ccdb5c7169 John Ledbetter committed Jan 14, 2012
Showing with 16 additions and 0 deletions.
  1. +4 −0 lib/github_v3_api/repo.rb
  2. +12 −0 lib/github_v3_api/repos_api.rb
@@ -15,6 +15,10 @@ def collaborators
api.list_collaborators(owner_login, name)
end
+ def watchers
+ api.list_watchers(owner_login, name)
+ end
+
private
def natural_key
@@ -54,5 +54,17 @@ def list_collaborators(user, repo_name)
GitHubV3API::User.new(@connection.users, user_data)
end
end
+
+ # Returns an array of GitHubV3API::User instances containing the users who are
+ # watching the repository specified by +user+ and +repo_name+.
+ #
+ # +user+:: the string ID of the user, e.g. "octocat"
+ # +repo_name+:: the string ID of the repository, e.g. "hello-world"
+ def list_watchers(user, repo_name)
+ @connection.get("/repos/#{user}/#{repo_name}/watchers").map do |user_data|
+ GitHubV3API::User.new(@connection.users, user_data)
+ end
+ end
+
end
end

0 comments on commit 410a847

Please sign in to comment.