Class: VoiceML::HealthStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/voiceml/models/diagnostics.rb

Overview

‘GET /health` response. Hard-check failures flip `ok` to false (server returns 503); soft-check warnings surface in `warnings` only.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ HealthStatus

Returns a new instance of HealthStatus.



46
47
48
49
50
# File 'lib/voiceml/models/diagnostics.rb', line 46

def initialize(hash = {})
  @ok        = hash['ok']
  @warnings  = (hash['warnings'] || []).map { |w| HealthFailure.from_hash(w) }
  @failures  = (hash['failures'] || []).map { |f| HealthFailure.from_hash(f) }
end

Instance Attribute Details

#failuresObject (readonly)

Returns the value of attribute failures.



44
45
46
# File 'lib/voiceml/models/diagnostics.rb', line 44

def failures
  @failures
end

#okObject (readonly)

Returns the value of attribute ok.



44
45
46
# File 'lib/voiceml/models/diagnostics.rb', line 44

def ok
  @ok
end

#warningsObject (readonly)

Returns the value of attribute warnings.



44
45
46
# File 'lib/voiceml/models/diagnostics.rb', line 44

def warnings
  @warnings
end

Class Method Details

.from_hash(hash) ⇒ Object



52
53
54
# File 'lib/voiceml/models/diagnostics.rb', line 52

def self.from_hash(hash)
  new(hash || {})
end