class SinatraHealthCheck::Status::Aggregated

Application status definition with subsystems

Attributes

statuus[R]

Public Class Methods

new(level, message, statuus, extras = {}) click to toggle source
Calls superclass method SinatraHealthCheck::Status::new
# File lib/sinatra-health-check/status/aggregated.rb, line 6
def initialize(level, message, statuus, extras = {})
  raise ArgumentError, "statuus must be a hash of SinatraHealthCheck::Status, but is #{statuus.class}" \
    unless statuus.is_a?(Hash)
  super(level, message, { :statusDetails => statuus }.merge(extras))
end

Public Instance Methods

to_h() click to toggle source
# File lib/sinatra-health-check/status/aggregated.rb, line 12
def to_h
  subs = {}
  extras[:statusDetails].each { |k,v| subs[k] = v.to_h }

  s = extras.merge({
    :status  => level.to_s.upcase,
    :message => message,
    :statusDetails => subs
  })
  s.delete(:statusDetails) if s[:statusDetails].size == 0
  s
end