Class: Startling::Github::PullRequest
- Inherits:
-
Object
- Object
- Startling::Github::PullRequest
- Defined in:
- lib/startling/github/pull_request.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#labels ⇒ Object
Returns the value of attribute labels.
Instance Method Summary collapse
- #author ⇒ Object
- #branch ⇒ Object
- #created_at ⇒ Object
- #id ⇒ Object
- #in_progress? ⇒ Boolean
-
#initialize(attributes, prefetch_data: true) ⇒ PullRequest
constructor
A new instance of PullRequest.
- #label_names ⇒ Object
- #title ⇒ Object
- #updated_at ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(attributes, prefetch_data: true) ⇒ PullRequest
Returns a new instance of PullRequest.
7 8 9 10 |
# File 'lib/startling/github/pull_request.rb', line 7 def initialize(attributes, prefetch_data: true) @attributes = attributes prefetch_data if prefetch_data end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/startling/github/pull_request.rb', line 4 def attributes @attributes end |
#labels ⇒ Object
Returns the value of attribute labels.
5 6 7 |
# File 'lib/startling/github/pull_request.rb', line 5 def labels @labels end |
Instance Method Details
#author ⇒ Object
44 45 46 |
# File 'lib/startling/github/pull_request.rb', line 44 def ||= attributes.user.rels[:self].get.data.name end |
#branch ⇒ Object
20 21 22 |
# File 'lib/startling/github/pull_request.rb', line 20 def branch attributes.head.ref end |
#created_at ⇒ Object
36 37 38 |
# File 'lib/startling/github/pull_request.rb', line 36 def created_at attributes.created_at end |
#id ⇒ Object
12 13 14 |
# File 'lib/startling/github/pull_request.rb', line 12 def id attributes.number end |
#in_progress? ⇒ Boolean
24 25 26 |
# File 'lib/startling/github/pull_request.rb', line 24 def in_progress? label_names.any? { |label| label.match(/(WIP|REVIEW)/) } end |
#label_names ⇒ Object
28 29 30 |
# File 'lib/startling/github/pull_request.rb', line 28 def label_names labels.map(&:name) end |
#title ⇒ Object
16 17 18 |
# File 'lib/startling/github/pull_request.rb', line 16 def title attributes.title end |
#updated_at ⇒ Object
40 41 42 |
# File 'lib/startling/github/pull_request.rb', line 40 def updated_at attributes.updated_at end |
#url ⇒ Object
32 33 34 |
# File 'lib/startling/github/pull_request.rb', line 32 def url attributes.rels[:html].href end |