Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Client.add_assignees #894

Merged
merged 1 commit into from
May 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/octokit/client/issues.rb
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,19 @@ def issue_timeline(repo, number, options = {})
options = ensure_api_media_type(:issue_timelines, options)
paginate "#{Repository.path repo}/issues/#{number}/timeline", options
end

# Add assignees to an issue
#
# @param repo [Integer, String, Repository, Hash] A GitHub repository
# @param number [Integer] Issue number
# @param assignees [Array] Assignees to be added
# @return [Sawyer::Resource] Issue
# @see https://developer.github.com/v3/issues/assignees/#add-assignees-to-an-issue
# @example Add assignees "pengwynn" and "joeyw" to Issue #23 on octokit/octokit.rb
# Octokit.add_assignees("octokit/octokit.rb", 23, ["pengwynn", "joeyw"])
def add_assignees(repo, number, assignees, options = {})
post "#{Repository.path repo}/issues/#{number}/assignees", options.merge({:assignees => assignees})
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"http_interactions":[{"request":{"method":"post","uri":"https://api.github.com/repos/tomb0y/wheelbarrow/issues/10/assignees","body":{"encoding":"UTF-8","base64_string":"eyJhc3NpZ25lZXMiOlsidG9tYjB5Il19\n"},"headers":{"Accept":["application/vnd.github.v3+json"],"User-Agent":["Octokit Ruby Gem 4.7.0"],"Content-Type":["application/json"],"Authorization":["token <<ACCESS_TOKEN>>"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"]}},"response":{"status":{"code":201,"message":"Created"},"headers":{"Server":["GitHub.com"],"Date":["Sun, 28 May 2017 19:45:26 GMT"],"Content-Type":["application/json; charset=utf-8"],"Content-Length":["3336"],"Status":["201 Created"],"X-Ratelimit-Limit":["5000"],"X-Ratelimit-Remaining":["4997"],"X-Ratelimit-Reset":["1496004111"],"Cache-Control":["private, max-age=60, s-maxage=60"],"Vary":["Accept, Authorization, Cookie, X-GitHub-OTP","Accept-Encoding"],"Etag":["\"d0721a7294e0298af85e43e5eb738b5d\""],"X-Oauth-Scopes":["admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user"],"X-Accepted-Oauth-Scopes":["public_repo, repo"],"Location":["https://api.github.com/repos/tomb0y/wheelbarrow/issues/10"],"X-Github-Media-Type":["github.v3; format=json"],"Access-Control-Expose-Headers":["ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval"],"Access-Control-Allow-Origin":["*"],"Content-Security-Policy":["default-src 'none'"],"Strict-Transport-Security":["max-age=31536000; includeSubdomains; preload"],"X-Content-Type-Options":["nosniff"],"X-Frame-Options":["deny"],"X-Xss-Protection":["1; mode=block"],"X-Served-By":["b535085e7f4d6e3<GITHUB_TEST_INTEGRATION>3e016e684de0829"],"X-Github-Request-Id":["DDF6:13F60:B06ACA:E44408:592B28D6"]},"body":{"encoding":"UTF-8","base64_string":"eyJ1cmwiOiJodHRwczovL2FwaS5naXRodWIuY29tL3JlcG9zL3RvbWIweS93\naGVlbGJhcnJvdy9pc3N1ZXMvMTAiLCJyZXBvc2l0b3J5X3VybCI6Imh0dHBz\nOi8vYXBpLmdpdGh1Yi5jb20vcmVwb3MvdG9tYjB5L3doZWVsYmFycm93Iiwi\nbGFiZWxzX3VybCI6Imh0dHBzOi8vYXBpLmdpdGh1Yi5jb20vcmVwb3MvdG9t\nYjB5L3doZWVsYmFycm93L2lzc3Vlcy8xMC9sYWJlbHN7L25hbWV9IiwiY29t\nbWVudHNfdXJsIjoiaHR0cHM6Ly9hcGkuZ2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dG9tYjB5L2Zv\nbGxvd2VycyIsImZvbGxvd2luZ191cmwiOiJodHRwczovL2FwaS5naXRodWIu\nY29tL3VzZXJzL3RvbWIweS9mb2xsb3dpbmd7L290aGVyX3VzZXJ9IiwiZ2lz\ndHNfdXJsIjoiaHR0cHM6Ly9hcGkuZ2l0aHViLmNvbS91c2Vycy90b21iMHkv\nZ2lzdHN7L2dpc3RfaWR9Iiwic3RhcnJlZF91cmwiOiJodHRwczovL2FwaS5n\naXRodWIuY29tL3VzZXJzL3RvbWIweS9zdGFycmVkey9vd25lcn17L3JlcG99\nIiwic3Vic2NyaXB0aW9uc191cmwiOiJodHRwczovL2FwaS5naXRodWIuY29t\nL3VzZXJzL3RvbWIweS9zdWJzY3JpcHRpb25zIiwib3JnYW5pemF0aW9uc191\ncmwiOiJodHRwczovL2FwaS5naXRodWIuY29tL3VzZXJzL3RvbWIweS9vcmdz\nIiwicmVwb3NfdXJsIjoiaHR0cHM6Ly9hcGkuZ2l0aHViLmNvbS91c2Vycy90\nb21iMHkvcmVwb3MiLCJldmVudHNfdXJsIjoiaHR0cHM6Ly9hcGkuZ2l0aHVi\nLmNvbS91c2Vycy90b21iMHkvZXZlbnRzey9wcml2YWN5fSIsInJlY2VpdmVk\nX2V2ZW50c191cmwiOiJodHRwczovL2FwaS5naXRodWIuY29tL3VzZXJzL3Rv\nbWIweS9yZWNlaXZlZF9ldmVudHMiLCJ0eXBlIjoiVXNlciIsInNpdGVfYWRt\naW4iOmZhbHNlfV0sIm1pbGVzdG9uZSI6bnVsbCwiY29tbWVudHMiOjEsImNy\nZWF0ZWRfYXQiOiIyMDE3LTA1LTE4VDA4OjI4OjEyWiIsInVwZGF0ZWRfYXQi\nOiIyMDE3LTA1LTI4VDE5OjQ1OjI2WiIsImNsb3NlZF9hdCI6bnVsbCwiYm9k\neSI6IiJ9\n"},"http_version":null},"recorded_at":"Sun, 28 May 2017 19:45:26 GMT"}],"recorded_with":"VCR 2.9.3"}
8 changes: 8 additions & 0 deletions spec/octokit/client/issues_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,12 @@
assert_requested :get, github_url('/repos/octokit/octokit.rb/issues/comments/1194690')
end
end # .issue_comment

describe ".add_assignees", :vcr do
it "adds assignees" do
issue = @client.add_assignees('tomb0y/wheelbarrow', 10, ["tomb0y"])
expect(issue.assignees.count).not_to be_zero
assert_requested :post, github_url("repos/tomb0y/wheelbarrow/issues/10/assignees")
end
end # .add_assignees
end