Class: Cipr::PullRequest
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Cipr::PullRequest
- Defined in:
- lib/cipr/pull_request.rb
Instance Method Summary collapse
- #apply ⇒ Object
- #checkout ⇒ Object
- #comment(body) ⇒ Object
-
#initialize(repo, *args) ⇒ PullRequest
constructor
A new instance of PullRequest.
- #merge_from ⇒ Object
- #merge_to ⇒ Object
- #mergeable? ⇒ Boolean
- #merged? ⇒ Boolean
- #pull_repo ⇒ Object
- #username ⇒ Object
Constructor Details
#initialize(repo, *args) ⇒ PullRequest
Returns a new instance of PullRequest.
4 5 6 7 |
# File 'lib/cipr/pull_request.rb', line 4 def initialize(repo, *args) @repo = repo super(*args) end |
Instance Method Details
#apply ⇒ Object
42 43 44 |
# File 'lib/cipr/pull_request.rb', line 42 def apply @repo.apply_pull_request(self) end |
#checkout ⇒ Object
46 47 48 |
# File 'lib/cipr/pull_request.rb', line 46 def checkout @repo.checkout_pull_request(self) end |
#comment(body) ⇒ Object
9 10 11 |
# File 'lib/cipr/pull_request.rb', line 9 def comment(body) @repo.comment(self.number, body) end |
#merge_from ⇒ Object
29 30 31 |
# File 'lib/cipr/pull_request.rb', line 29 def merge_from head['ref'] end |
#merge_to ⇒ Object
25 26 27 |
# File 'lib/cipr/pull_request.rb', line 25 def merge_to base['ref'] end |
#mergeable? ⇒ Boolean
13 14 15 |
# File 'lib/cipr/pull_request.rb', line 13 def mergeable? mergeable end |
#merged? ⇒ Boolean
17 18 19 |
# File 'lib/cipr/pull_request.rb', line 17 def merged? merged end |
#pull_repo ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/cipr/pull_request.rb', line 33 def pull_repo auth = @repo.auth_string if auth && !auth.empty? head['repo']['clone_url'].sub("https://", "https://#{auth}@") else head['repo']['clone_url'] end end |
#username ⇒ Object
21 22 23 |
# File 'lib/cipr/pull_request.rb', line 21 def username head['user']['login'] end |