Class: SiteHealth::Issue
- Inherits:
-
Object
- Object
- SiteHealth::Issue
- Defined in:
- lib/site_health/issue.rb
Overview
Represents a found issue inspired by the JSONAPI error spec
Constant Summary collapse
- PRIORITIES =
Set.new( %i[ critial high medium low fyi unknown ].freeze )
- SEVERITIES =
Set.new( %i[ critial major medium low fyi unknown ].freeze )
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#detail ⇒ Object
Returns the value of attribute detail.
-
#links ⇒ Object
Returns the value of attribute links.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#name ⇒ Object
Returns the value of attribute name.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#severity ⇒ Object
Returns the value of attribute severity.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, title:, code: nil, detail: '', severity: :unknown, priority: :unknown, url: nil, links: [], meta: {}) ⇒ Issue
constructor
Initialize an Issue.
-
#to_h ⇒ Hash
Hash representation of the object.
Constructor Details
#initialize(name:, title:, code: nil, detail: '', severity: :unknown, priority: :unknown, url: nil, links: [], meta: {}) ⇒ Issue
Initialize an Issue
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/site_health/issue.rb', line 39 def initialize( name:, title:, code: nil, detail: '', severity: :unknown, priority: :unknown, url: nil, links: [], meta: {} ) self.name = name self.code = code self.url = url self. = self.title = title self.detail = detail self.links = links self.severity = severity self.priority = priority end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
30 31 32 |
# File 'lib/site_health/issue.rb', line 30 def code @code end |
#detail ⇒ Object
Returns the value of attribute detail.
31 32 33 |
# File 'lib/site_health/issue.rb', line 31 def detail @detail end |
#links ⇒ Object
Returns the value of attribute links.
31 32 33 |
# File 'lib/site_health/issue.rb', line 31 def links @links end |
#meta ⇒ Object
Returns the value of attribute meta.
30 31 32 |
# File 'lib/site_health/issue.rb', line 30 def @meta end |
#name ⇒ Object
Returns the value of attribute name.
30 31 32 |
# File 'lib/site_health/issue.rb', line 30 def name @name end |
#priority ⇒ Object
Returns the value of attribute priority.
31 32 33 |
# File 'lib/site_health/issue.rb', line 31 def priority @priority end |
#severity ⇒ Object
Returns the value of attribute severity.
31 32 33 |
# File 'lib/site_health/issue.rb', line 31 def severity @severity end |
#title ⇒ Object
Returns the value of attribute title.
31 32 33 |
# File 'lib/site_health/issue.rb', line 31 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
30 31 32 |
# File 'lib/site_health/issue.rb', line 30 def url @url end |
Class Method Details
.fields ⇒ Object
61 62 63 |
# File 'lib/site_health/issue.rb', line 61 def self.fields %i[name code title detail severity priority url links meta] end |
Instance Method Details
#to_h ⇒ Hash
Returns hash representation of the object.
66 67 68 69 70 |
# File 'lib/site_health/issue.rb', line 66 def to_h self.class.fields. map { |field| [field, send(field)] }. to_h end |