Class: AnalyticsOps::Health::Result
- Inherits:
-
Object
- Object
- AnalyticsOps::Health::Result
- Defined in:
- lib/analytics_ops/health.rb,
sig/analytics_ops.rbs
Overview
Immutable health summary and findings for one profile.
Instance Attribute Summary collapse
-
#date_ranges ⇒ Array[record]
readonly
Returns the value of attribute date_ranges.
-
#findings ⇒ Array[Finding]
readonly
Returns the value of attribute findings.
-
#profile ⇒ String
readonly
Returns the value of attribute profile.
-
#property_id ⇒ String
readonly
Returns the value of attribute property_id.
-
#summary ⇒ record
readonly
Returns the value of attribute summary.
Instance Method Summary collapse
- #healthy? ⇒ Boolean
-
#initialize(profile:, property_id:, date_ranges:, findings:, summary:) ⇒ Result
constructor
A new instance of Result.
- #to_h ⇒ record
Constructor Details
#initialize(profile:, property_id:, date_ranges:, findings:, summary:) ⇒ Result
Returns a new instance of Result.
38 39 40 41 42 43 44 45 |
# File 'lib/analytics_ops/health.rb', line 38 def initialize(profile:, property_id:, date_ranges:, findings:, summary:) @profile = Canonical.immutable(profile) @property_id = Canonical.immutable(property_id) @date_ranges = Canonical.immutable(date_ranges) @findings = findings.dup.freeze @summary = Canonical.immutable(summary) freeze end |
Instance Attribute Details
#date_ranges ⇒ Array[record] (readonly)
Returns the value of attribute date_ranges.
36 37 38 |
# File 'lib/analytics_ops/health.rb', line 36 def date_ranges @date_ranges end |
#findings ⇒ Array[Finding] (readonly)
Returns the value of attribute findings.
36 37 38 |
# File 'lib/analytics_ops/health.rb', line 36 def findings @findings end |
#profile ⇒ String (readonly)
Returns the value of attribute profile.
36 37 38 |
# File 'lib/analytics_ops/health.rb', line 36 def profile @profile end |
#property_id ⇒ String (readonly)
Returns the value of attribute property_id.
36 37 38 |
# File 'lib/analytics_ops/health.rb', line 36 def property_id @property_id end |
#summary ⇒ record (readonly)
Returns the value of attribute summary.
36 37 38 |
# File 'lib/analytics_ops/health.rb', line 36 def summary @summary end |
Instance Method Details
#healthy? ⇒ Boolean
47 48 49 |
# File 'lib/analytics_ops/health.rb', line 47 def healthy? findings.none? { |finding| %w[warning error].include?(finding.severity) } end |
#to_h ⇒ record
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/analytics_ops/health.rb', line 51 def to_h { "healthy" => healthy?, "profile" => profile, "property_id" => property_id, "date_ranges" => date_ranges, "summary" => summary, "findings" => findings.map(&:to_h) } end |