Module: Octokit::Client::Pulls
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/pulls.rb
Instance Method Summary collapse
-
#create_pull_request(repo, base, head, title, body, options = {}) ⇒ Hashie::Mash
Create a pull request.
-
#create_pull_request_for_issue(repo, base, head, issue, options = {}) ⇒ Hashie::Mash
Create a pull request from existing issue.
-
#merge_pull_request(repo, number, commit_message = '', options = {}) ⇒ Array<Hashie::Mash>
Merge a pull request.
-
#pull_merged?(repo, number, options = {}) ⇒ Boolean
(also: #pull_request_merged?)
Check pull request merge status.
-
#pull_request(repo, number, options = {}) ⇒ Hashie::Mash
(also: #pull)
Get a pull request.
-
#pull_request_comments(repo, number, options = {}) ⇒ Array<Hashie::Mash>
(also: #pull_comments, #review_comments)
List comments on a pull request.
-
#pull_request_commits(repo, number, options = {}) ⇒ Array<Hashie::Mash>
(also: #pull_commits)
List commits on a pull request.
-
#pull_request_files(repo, number, options = {}) ⇒ Array<Hashie::Mash>
(also: #pull_files)
List files on a pull request.
-
#pull_requests(repo, state = 'open', options = {}) ⇒ Array<Hashie::Mash>
(also: #pulls)
List pull requests for a repository.
-
#update_pull_request(repo, id, title = nil, body = nil, state = nil, options = {}) ⇒ Hashie::Mash
Update a pull request.
Instance Method Details
#create_pull_request(repo, base, head, title, body, options = {}) ⇒ Hashie::Mash
Create a pull request
41 42 43 44 45 46 47 48 49 |
# File 'lib/octokit/client/pulls.rb', line 41 def create_pull_request(repo, base, head, title, body, ={}) pull = { :base => base, :head => head, :title => title, :body => body, } post("repos/#{Repository.new(repo)}/pulls", .merge(pull)) end |
#create_pull_request_for_issue(repo, base, head, issue, options = {}) ⇒ Hashie::Mash
Create a pull request from existing issue
62 63 64 65 66 67 68 69 |
# File 'lib/octokit/client/pulls.rb', line 62 def create_pull_request_for_issue(repo, base, head, issue, ={}) pull = { :base => base, :head => head, :issue => issue } post("repos/#{Repository.new(repo)}/pulls", .merge(pull)) end |
#merge_pull_request(repo, number, commit_message = '', options = {}) ⇒ Array<Hashie::Mash>
Merge a pull request
139 140 141 |
# File 'lib/octokit/client/pulls.rb', line 139 def merge_pull_request(repo, number, ='', ={}) put("repos/#{Repository.new(repo)}/pulls/#{number}/merge", .merge({:commit_message => })) end |
#pull_merged?(repo, number, options = {}) ⇒ Boolean Also known as: pull_request_merged?
Check pull request merge status
149 150 151 152 153 154 155 156 |
# File 'lib/octokit/client/pulls.rb', line 149 def pull_merged?(repo, number, ={}) begin get("repos/#{Repository.new(repo)}/pulls/#{number}/merged", ) return true rescue Octokit::NotFound return false end end |
#pull_request(repo, number, options = {}) ⇒ Hashie::Mash Also known as: pull
Get a pull request
24 25 26 |
# File 'lib/octokit/client/pulls.rb', line 24 def pull_request(repo, number, ={}) get("repos/#{Repository.new(repo)}/pulls/#{number}", ) end |
#pull_request_comments(repo, number, options = {}) ⇒ Array<Hashie::Mash> Also known as: pull_comments, review_comments
List comments on a pull request
114 115 116 117 |
# File 'lib/octokit/client/pulls.rb', line 114 def pull_request_comments(repo, number, ={}) # return the comments for a pull request get("repos/#{Repository.new(repo)}/pulls/#{number}/comments", ) end |
#pull_request_commits(repo, number, options = {}) ⇒ Array<Hashie::Mash> Also known as: pull_commits
List commits on a pull request
103 104 105 |
# File 'lib/octokit/client/pulls.rb', line 103 def pull_request_commits(repo, number, ={}) get("repos/#{Repository.new(repo)}/pulls/#{number}/commits", ) end |
#pull_request_files(repo, number, options = {}) ⇒ Array<Hashie::Mash> Also known as: pull_files
List files on a pull request
127 128 129 |
# File 'lib/octokit/client/pulls.rb', line 127 def pull_request_files(repo, number, ={}) get("repos/#{Repository.new(repo)}/pulls/#{number}/files", ) end |
#pull_requests(repo, state = 'open', options = {}) ⇒ Array<Hashie::Mash> Also known as: pulls
List pull requests for a repository
13 14 15 |
# File 'lib/octokit/client/pulls.rb', line 13 def pull_requests(repo, state='open', ={}) get("repos/#{Repository.new(repo)}/pulls", .merge({:state => state}), 3) end |
#update_pull_request(repo, id, title = nil, body = nil, state = nil, options = {}) ⇒ Hashie::Mash
Update a pull request
86 87 88 89 90 91 92 93 94 |
# File 'lib/octokit/client/pulls.rb', line 86 def update_pull_request(repo, id, title=nil, body=nil, state=nil, ={}) .merge!({ :title => title, :body => body, :state => state }) .reject! { |_, value| value.nil? } post("repos/#{Repository.new repo}/pulls/#{id}", , 3) end |