Class: ListPullRequests::Pr
- Inherits:
-
Object
- Object
- ListPullRequests::Pr
- Defined in:
- lib/list_pull_requests/pr.rb
Instance Attribute Summary collapse
-
#api_url ⇒ Object
Returns the value of attribute api_url.
-
#created ⇒ Object
Returns the value of attribute created.
-
#mergeable ⇒ Object
Returns the value of attribute mergeable.
-
#merged ⇒ Object
Returns the value of attribute merged.
-
#merged_by ⇒ Object
Returns the value of attribute merged_by.
-
#name ⇒ Object
Returns the value of attribute name.
-
#number ⇒ Object
Returns the value of attribute number.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(api_url, url, name, created) ⇒ Pr
constructor
A new instance of Pr.
- #lookup ⇒ Object
Constructor Details
#initialize(api_url, url, name, created) ⇒ Pr
Returns a new instance of Pr.
4 5 6 7 8 9 |
# File 'lib/list_pull_requests/pr.rb', line 4 def initialize(api_url, url, name, created) @api_url, @url, @name, @created = api_url, url, name, created split_url = url.split("/") @repo = split_url.fetch(-3) @number = split_url.last end |
Instance Attribute Details
#api_url ⇒ Object
Returns the value of attribute api_url.
2 3 4 |
# File 'lib/list_pull_requests/pr.rb', line 2 def api_url @api_url end |
#created ⇒ Object
Returns the value of attribute created.
2 3 4 |
# File 'lib/list_pull_requests/pr.rb', line 2 def created @created end |
#mergeable ⇒ Object
Returns the value of attribute mergeable.
2 3 4 |
# File 'lib/list_pull_requests/pr.rb', line 2 def mergeable @mergeable end |
#merged ⇒ Object
Returns the value of attribute merged.
2 3 4 |
# File 'lib/list_pull_requests/pr.rb', line 2 def merged @merged end |
#merged_by ⇒ Object
Returns the value of attribute merged_by.
2 3 4 |
# File 'lib/list_pull_requests/pr.rb', line 2 def merged_by @merged_by end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/list_pull_requests/pr.rb', line 2 def name @name end |
#number ⇒ Object
Returns the value of attribute number.
2 3 4 |
# File 'lib/list_pull_requests/pr.rb', line 2 def number @number end |
#repo ⇒ Object
Returns the value of attribute repo.
2 3 4 |
# File 'lib/list_pull_requests/pr.rb', line 2 def repo @repo end |
#url ⇒ Object
Returns the value of attribute url.
2 3 4 |
# File 'lib/list_pull_requests/pr.rb', line 2 def url @url end |
Instance Method Details
#lookup ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/list_pull_requests/pr.rb', line 11 def lookup unless @looked_up puts "Retrieving pull details....".red details = JSON.parse(open(api_url).read) @mergeable = details["mergeable"] @merged = details["merged_at"] @merged_by = details["merged_by"]["login"] if details["merged_by"] @looked_up = true end end |