Module: Bucketkit::Client::PullRequests
- Included in:
- Bucketkit::Client
- Defined in:
- lib/bucketkit/client/pull_requests.rb
Overview
Constant Summary collapse
- API_ENDPOINT =
'api/2.0/repositories'.freeze
Instance Method Summary collapse
- #approve_pull_request(repo, number, options = {}) ⇒ Object
- #create_pull_request(repo, title, source, destination, description, options = {}) ⇒ Object
- #decline_pull_request(repo, number, options = {}) ⇒ Object (also: #reject_pull_request)
- #delete_pull_request_approval(repo, number, options = {}) ⇒ Object
- #merge_pull_request(repo, number, options = {}) ⇒ Object (also: #accept_pull_request)
- #pull_request(repo, number, options = {}) ⇒ Object
- #pull_request_activity(repo, number = nil, options = {}) ⇒ Object
- #pull_request_comment(repo, number, comment_id, options = {}) ⇒ Object
- #pull_request_comments(repo, number, options = {}) ⇒ Object
- #pull_request_commits(repo, number, options = {}) ⇒ Object
- #pull_request_diff(repo, number, options = {}) ⇒ Object
- #pull_requests(repo, options = {}) ⇒ Object
- #update_pull_request(repo, number, options) ⇒ Object
Instance Method Details
#approve_pull_request(repo, number, options = {}) ⇒ Object
33 34 35 |
# File 'lib/bucketkit/client/pull_requests.rb', line 33 def approve_pull_request(repo, number, ={}) post "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/approve", end |
#create_pull_request(repo, title, source, destination, description, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/bucketkit/client/pull_requests.rb', line 11 def create_pull_request(repo, title, source, destination, description, ={}) pull = { title: title, description: description, source: { branch: { name: source } }, destination: { branch: { name: destination } } } post "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests", .merge(pull) end |
#decline_pull_request(repo, number, options = {}) ⇒ Object Also known as: reject_pull_request
54 55 56 |
# File 'lib/bucketkit/client/pull_requests.rb', line 54 def decline_pull_request(repo, number, ={}) post "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/decline", end |
#delete_pull_request_approval(repo, number, options = {}) ⇒ Object
37 38 39 |
# File 'lib/bucketkit/client/pull_requests.rb', line 37 def delete_pull_request_approval(repo, number, ={}) delete "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/approve", end |
#merge_pull_request(repo, number, options = {}) ⇒ Object Also known as: accept_pull_request
49 50 51 |
# File 'lib/bucketkit/client/pull_requests.rb', line 49 def merge_pull_request(repo, number, ={}) post "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/merge", end |
#pull_request(repo, number, options = {}) ⇒ Object
25 26 27 |
# File 'lib/bucketkit/client/pull_requests.rb', line 25 def pull_request(repo, number, ={}) get "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}", end |
#pull_request_activity(repo, number = nil, options = {}) ⇒ Object
45 46 47 |
# File 'lib/bucketkit/client/pull_requests.rb', line 45 def pull_request_activity(repo, number=nil, ={}) get "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/activity", end |
#pull_request_comment(repo, number, comment_id, options = {}) ⇒ Object
63 64 65 |
# File 'lib/bucketkit/client/pull_requests.rb', line 63 def pull_request_comment(repo, number, comment_id, ={}) get "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/comments/#{comment_id}", end |
#pull_request_comments(repo, number, options = {}) ⇒ Object
59 60 61 |
# File 'lib/bucketkit/client/pull_requests.rb', line 59 def pull_request_comments(repo, number, ={}) get "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/comments", end |
#pull_request_commits(repo, number, options = {}) ⇒ Object
29 30 31 |
# File 'lib/bucketkit/client/pull_requests.rb', line 29 def pull_request_commits(repo, number, ={}) paginate "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/commits", end |
#pull_request_diff(repo, number, options = {}) ⇒ Object
41 42 43 |
# File 'lib/bucketkit/client/pull_requests.rb', line 41 def pull_request_diff(repo, number, ={}) get "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/diff", end |
#pull_requests(repo, options = {}) ⇒ Object
7 8 9 |
# File 'lib/bucketkit/client/pull_requests.rb', line 7 def pull_requests(repo, ={}) paginate "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests", end |
#update_pull_request(repo, number, options) ⇒ Object
21 22 23 |
# File 'lib/bucketkit/client/pull_requests.rb', line 21 def update_pull_request(repo, number, ) patch "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}", end |