Class: GitMarkdown::Models::PullRequest
- Inherits:
-
Object
- Object
- GitMarkdown::Models::PullRequest
- Defined in:
- lib/git/markdown/models/pull_request.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#html_url ⇒ Object
readonly
Returns the value of attribute html_url.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Class Method Summary collapse
Instance Method Summary collapse
- #closed? ⇒ Boolean
-
#initialize(attrs = {}) ⇒ PullRequest
constructor
A new instance of PullRequest.
- #open? ⇒ Boolean
Constructor Details
#initialize(attrs = {}) ⇒ PullRequest
Returns a new instance of PullRequest.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/git/markdown/models/pull_request.rb', line 8 def initialize(attrs = {}) @number = attrs[:number] @title = attrs[:title] @body = attrs[:body] || "" @state = attrs[:state] @author = attrs[:author] @html_url = attrs[:html_url] @created_at = attrs[:created_at] @updated_at = attrs[:updated_at] end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
6 7 8 |
# File 'lib/git/markdown/models/pull_request.rb', line 6 def @author end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/git/markdown/models/pull_request.rb', line 6 def body @body end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
6 7 8 |
# File 'lib/git/markdown/models/pull_request.rb', line 6 def created_at @created_at end |
#html_url ⇒ Object (readonly)
Returns the value of attribute html_url.
6 7 8 |
# File 'lib/git/markdown/models/pull_request.rb', line 6 def html_url @html_url end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
6 7 8 |
# File 'lib/git/markdown/models/pull_request.rb', line 6 def number @number end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
6 7 8 |
# File 'lib/git/markdown/models/pull_request.rb', line 6 def state @state end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
6 7 8 |
# File 'lib/git/markdown/models/pull_request.rb', line 6 def title @title end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
6 7 8 |
# File 'lib/git/markdown/models/pull_request.rb', line 6 def updated_at @updated_at end |
Class Method Details
.from_api(data) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/git/markdown/models/pull_request.rb', line 19 def self.from_api(data) new( number: data["number"], title: data["title"], body: data["body"], state: data["state"], author: data.dig("user", "login"), html_url: data["html_url"], created_at: data["created_at"], updated_at: data["updated_at"] ) end |
Instance Method Details
#closed? ⇒ Boolean
36 37 38 |
# File 'lib/git/markdown/models/pull_request.rb', line 36 def closed? @state == "closed" end |
#open? ⇒ Boolean
32 33 34 |
# File 'lib/git/markdown/models/pull_request.rb', line 32 def open? @state == "open" end |