Class: LockDiff::PullRequest
- Inherits:
-
Object
- Object
- LockDiff::PullRequest
- Defined in:
- lib/lock_diff/pull_request.rb
Defined Under Namespace
Classes: NotFoundPullRequest
Instance Attribute Summary collapse
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
- #base_sha ⇒ Object
- #find_content_path(file_name) ⇒ Object
- #head_sha ⇒ Object
-
#initialize(repository:, number:) ⇒ PullRequest
constructor
A new instance of PullRequest.
Constructor Details
#initialize(repository:, number:) ⇒ PullRequest
7 8 9 10 11 12 13 14 15 |
# File 'lib/lock_diff/pull_request.rb', line 7 def initialize(repository:, number:) @repository = repository @number = number @pr = LockDiff.client.pull_request(repository, number) rescue => e = "Not found pull request by (repository: #{repository}, number: #{number}, client: #{LockDiff.client.class}). Becase of #{e.inspect}" LockDiff.logger.warn() raise NotFoundPullRequest.new() end |
Instance Attribute Details
#number ⇒ Object (readonly)
Returns the value of attribute number.
3 4 5 |
# File 'lib/lock_diff/pull_request.rb', line 3 def number @number end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
3 4 5 |
# File 'lib/lock_diff/pull_request.rb', line 3 def repository @repository end |
Instance Method Details
#base_sha ⇒ Object
17 18 19 |
# File 'lib/lock_diff/pull_request.rb', line 17 def base_sha @pr.base_sha end |
#find_content_path(file_name) ⇒ Object
25 26 27 |
# File 'lib/lock_diff/pull_request.rb', line 25 def find_content_path(file_name) LockDiff.client.pull_request_content_path(@repository, @number, file_name) end |
#head_sha ⇒ Object
21 22 23 |
# File 'lib/lock_diff/pull_request.rb', line 21 def head_sha @pr.head_sha end |