Class: LockDiff::Github::PullRequest
- Inherits:
-
Object
- Object
- LockDiff::Github::PullRequest
- Defined in:
- lib/lock_diff/github/pull_request.rb
Overview
wrapper of github PullRequest
Instance Method Summary collapse
- #add_comment(comment) ⇒ Object
- #base_file(path) ⇒ Object
- #base_ref ⇒ Object
- #find_content_path(file_name) ⇒ Object
- #head_file(path) ⇒ Object
- #head_ref ⇒ Object
-
#initialize(pull_request) ⇒ PullRequest
constructor
A new instance of PullRequest.
- #number ⇒ Object
- #repository ⇒ Object
Constructor Details
#initialize(pull_request) ⇒ PullRequest
Returns a new instance of PullRequest.
5 6 7 |
# File 'lib/lock_diff/github/pull_request.rb', line 5 def initialize(pull_request) @pr = pull_request end |
Instance Method Details
#add_comment(comment) ⇒ Object
29 30 31 |
# File 'lib/lock_diff/github/pull_request.rb', line 29 def add_comment(comment) Github.client.add_comment(repository, number, comment) end |
#base_file(path) ⇒ Object
33 34 35 |
# File 'lib/lock_diff/github/pull_request.rb', line 33 def base_file(path) Github.client.file(repository, path: path, ref: @pr.base.sha) end |
#base_ref ⇒ Object
9 10 11 |
# File 'lib/lock_diff/github/pull_request.rb', line 9 def base_ref @pr.base.ref end |
#find_content_path(file_name) ⇒ Object
25 26 27 |
# File 'lib/lock_diff/github/pull_request.rb', line 25 def find_content_path(file_name) Github.client.pull_request_content_path(repository, number, file_name) end |
#head_file(path) ⇒ Object
37 38 39 |
# File 'lib/lock_diff/github/pull_request.rb', line 37 def head_file(path) Github.client.file(repository, path: path, ref: @pr.head.sha) end |
#head_ref ⇒ Object
13 14 15 |
# File 'lib/lock_diff/github/pull_request.rb', line 13 def head_ref @pr.head.ref end |
#number ⇒ Object
17 18 19 |
# File 'lib/lock_diff/github/pull_request.rb', line 17 def number @pr.number end |
#repository ⇒ Object
21 22 23 |
# File 'lib/lock_diff/github/pull_request.rb', line 21 def repository @pr.base.repo.full_name end |