Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added check_assignee method to Repositories

  • Loading branch information...
commit 8d57dc94ee87955012ee22f409c78d949609d483 1 parent f8b83d8
Andrew Nesbitt andrew authored
13 lib/octokit/client/repositories.rb
View
@@ -605,6 +605,19 @@ def repository_assignees(repo, options={})
end
alias :repo_assignees :repository_assignees
+ # Check to see if a particular user is an assignee for a repository.
+ #
+ # @param repo [String, Hash, Repository] A GitHub repository.
+ # @param assignee [String] User login to check
+ # @return [Boolean] True if assignable on project, false otherwise.
+ # @see Octokit::Client
+ # @see http://developer.github.com/v3/issues/assignees/#check-assignee
+ # @example
+ # Octokit.check_assignee('pengwynn/octokit', 'andrew')
+ def check_assignee(repo, assignee, options={})
+ boolean_from_response(:get, "repos/#{Repository.new repo}/assignees/#{assignee}", options)
+ end
+
# List watchers subscribing to notifications for a repo
#
# @param repo [String, Hash, Repository] A GitHub repository.
11 spec/octokit/client/repositories_spec.rb
View
@@ -458,6 +458,17 @@
end
+ describe ".check_assignee" do
+
+ it "checks to see if a particular user is an assignee for a repository" do
+ stub_get("/repos/pengwynn/octokit/assignees/andrew").
+ to_return(:status => 204)
+ is_assignee = @client.check_assignee("pengwynn/octokit", 'andrew')
+ expect(is_assignee).to eq(true)
+ end
+
+ end
+
describe ".subscribers" do
it "lists all the users watching the repository" do
Please sign in to comment.
Something went wrong with that request. Please try again.