Class: Gitomator::GitHub::Model::PullRequest
- Inherits:
-
Object
- Object
- Gitomator::GitHub::Model::PullRequest
- Defined in:
- lib/gitomator/github/model/pull_request.rb
Instance Method Summary collapse
- #base_branch ⇒ Object
-
#base_repo ⇒ Object
The “destination repo”.
- #created_at ⇒ Object
- #created_by ⇒ Object
- #head_branch ⇒ Object
-
#head_repo ⇒ Object
The “source repo”.
- #id ⇒ Object
-
#initialize(gh_pull_request, octokit) ⇒ PullRequest
constructor
A new instance of PullRequest.
-
#mergeable? ⇒ Boolean
True/false/nil.
-
#state ⇒ String
One of ‘open’, ‘close’.
- #title ⇒ Object
Constructor Details
#initialize(gh_pull_request, octokit) ⇒ PullRequest
Returns a new instance of PullRequest.
13 14 15 16 |
# File 'lib/gitomator/github/model/pull_request.rb', line 13 def initialize(gh_pull_request, octokit) @r = gh_pull_request @octokit = octokit end |
Instance Method Details
#base_branch ⇒ Object
73 74 75 |
# File 'lib/gitomator/github/model/pull_request.rb', line 73 def base_branch @r.base.label.split(':').last end |
#base_repo ⇒ Object
The “destination repo”
69 70 71 |
# File 'lib/gitomator/github/model/pull_request.rb', line 69 def base_repo Gitomator::GitHub::Model::HostedRepo.new(@r.base.repo) end |
#created_at ⇒ Object
31 32 33 |
# File 'lib/gitomator/github/model/pull_request.rb', line 31 def created_at @r.created_at end |
#created_by ⇒ Object
27 28 29 |
# File 'lib/gitomator/github/model/pull_request.rb', line 27 def created_by @r.user.login end |
#head_branch ⇒ Object
64 65 66 |
# File 'lib/gitomator/github/model/pull_request.rb', line 64 def head_branch @r.head.label.split(':').last end |
#head_repo ⇒ Object
The “source repo”
60 61 62 |
# File 'lib/gitomator/github/model/pull_request.rb', line 60 def head_repo Gitomator::GitHub::Model::HostedRepo.new(@r.head.repo) end |
#id ⇒ Object
19 20 21 |
# File 'lib/gitomator/github/model/pull_request.rb', line 19 def id @r.number end |
#mergeable? ⇒ Boolean
Returns true/false/nil.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/gitomator/github/model/pull_request.rb', line 44 def mergeable? # In Octokit, the two methods `pull_request` and `pull_requests` return # different type of objects (the one returned by `pull_requests` is missing # the mergeable? method) if (not @r.respond_to? :mergeable?) @r = @octokit.pull_request(@r.base.repo.full_name, @r.number) end if @r.mergeable_state == 'clean' return @r.mergeable? else return nil end end |
#state ⇒ String
Returns One of ‘open’, ‘close’.
37 38 39 |
# File 'lib/gitomator/github/model/pull_request.rb', line 37 def state @r.state end |
#title ⇒ Object
23 24 25 |
# File 'lib/gitomator/github/model/pull_request.rb', line 23 def title @r.title end |