Class: GitMarkdown::Models::Review
- Inherits:
-
Object
- Object
- GitMarkdown::Models::Review
- Defined in:
- lib/git/markdown/models/review.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#comments ⇒ Object
Returns the value of attribute comments.
-
#html_url ⇒ Object
readonly
Returns the value of attribute html_url.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#submitted_at ⇒ Object
readonly
Returns the value of attribute submitted_at.
Class Method Summary collapse
Instance Method Summary collapse
- #approved? ⇒ Boolean
- #changes_requested? ⇒ Boolean
- #commented? ⇒ Boolean
- #dismissed? ⇒ Boolean
-
#initialize(attrs = {}) ⇒ Review
constructor
A new instance of Review.
Constructor Details
#initialize(attrs = {}) ⇒ Review
Returns a new instance of Review.
9 10 11 12 13 14 15 16 17 |
# File 'lib/git/markdown/models/review.rb', line 9 def initialize(attrs = {}) @id = attrs[:id] @state = attrs[:state] @body = attrs[:body] || "" @author = attrs[:author] @html_url = attrs[:html_url] @submitted_at = attrs[:submitted_at] @comments = attrs[:comments] || [] end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
6 7 8 |
# File 'lib/git/markdown/models/review.rb', line 6 def @author end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/git/markdown/models/review.rb', line 6 def body @body end |
#comments ⇒ Object
Returns the value of attribute comments.
7 8 9 |
# File 'lib/git/markdown/models/review.rb', line 7 def comments @comments end |
#html_url ⇒ Object (readonly)
Returns the value of attribute html_url.
6 7 8 |
# File 'lib/git/markdown/models/review.rb', line 6 def html_url @html_url end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/git/markdown/models/review.rb', line 6 def id @id end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
6 7 8 |
# File 'lib/git/markdown/models/review.rb', line 6 def state @state end |
#submitted_at ⇒ Object (readonly)
Returns the value of attribute submitted_at.
6 7 8 |
# File 'lib/git/markdown/models/review.rb', line 6 def submitted_at @submitted_at end |
Class Method Details
.from_api(data) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/git/markdown/models/review.rb', line 19 def self.from_api(data) new( id: data["id"], state: data["state"], body: data["body"], author: data.dig("user", "login"), html_url: data["html_url"], submitted_at: data["submitted_at"] ) end |
Instance Method Details
#approved? ⇒ Boolean
30 31 32 |
# File 'lib/git/markdown/models/review.rb', line 30 def approved? @state == "APPROVED" end |
#changes_requested? ⇒ Boolean
34 35 36 |
# File 'lib/git/markdown/models/review.rb', line 34 def changes_requested? @state == "CHANGES_REQUESTED" end |
#commented? ⇒ Boolean
38 39 40 |
# File 'lib/git/markdown/models/review.rb', line 38 def commented? @state == "COMMENTED" end |
#dismissed? ⇒ Boolean
42 43 44 |
# File 'lib/git/markdown/models/review.rb', line 42 def dismissed? @state == "DISMISSED" end |