Class: Soba::Domain::Issue
- Inherits:
-
Object
- Object
- Soba::Domain::Issue
- Defined in:
- lib/soba/domain/issue.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#labels ⇒ Object
readonly
Returns the value of attribute labels.
-
#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.
Instance Method Summary collapse
- #closed? ⇒ Boolean
- #has_label?(label_name) ⇒ Boolean
-
#initialize(attributes = {}) ⇒ Issue
constructor
A new instance of Issue.
- #open? ⇒ Boolean
- #priority ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Issue
Returns a new instance of Issue.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/soba/domain/issue.rb', line 8 def initialize(attributes = {}) @id = attributes[:id] @number = attributes[:number] @title = attributes[:title] @body = attributes[:body] @state = attributes[:state] @labels = attributes[:labels] || [] @created_at = attributes[:created_at] @updated_at = attributes[:updated_at] end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/soba/domain/issue.rb', line 6 def body @body end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
6 7 8 |
# File 'lib/soba/domain/issue.rb', line 6 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/soba/domain/issue.rb', line 6 def id @id end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
6 7 8 |
# File 'lib/soba/domain/issue.rb', line 6 def labels @labels end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
6 7 8 |
# File 'lib/soba/domain/issue.rb', line 6 def number @number end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
6 7 8 |
# File 'lib/soba/domain/issue.rb', line 6 def state @state end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
6 7 8 |
# File 'lib/soba/domain/issue.rb', line 6 def title @title end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
6 7 8 |
# File 'lib/soba/domain/issue.rb', line 6 def updated_at @updated_at end |
Instance Method Details
#closed? ⇒ Boolean
23 24 25 |
# File 'lib/soba/domain/issue.rb', line 23 def closed? state == "closed" end |
#has_label?(label_name) ⇒ Boolean
27 28 29 |
# File 'lib/soba/domain/issue.rb', line 27 def has_label?(label_name) labels.any? { |label| label[:name] == label_name } end |
#open? ⇒ Boolean
19 20 21 |
# File 'lib/soba/domain/issue.rb', line 19 def open? state == "open" end |
#priority ⇒ Object
31 32 33 34 35 |
# File 'lib/soba/domain/issue.rb', line 31 def priority return :high if has_label?("critical") || has_label?("urgent") return :medium if has_label?("important") :low end |