Class: MonitoringProtocols::Notification

Inherits:
CommonData show all
Defined in:
lib/monitoring_protocols/struct.rb

Constant Summary collapse

SEVERITY =
[:info, :warn, :error].freeze

Instance Method Summary collapse

Methods inherited from CommonData

#convert_content, #measure_id, #time=

Methods inherited from DataStruct

#<=>, attributes, #initialize, #list_keys, #merge_data_from!, properties, #selected_field?, #to_a, #to_msgpack

Constructor Details

This class inherits a constructor from MonitoringProtocols::DataStruct

Instance Method Details

#data?Boolean

Returns:

  • (Boolean)


87
# File 'lib/monitoring_protocols/struct.rb', line 87

def data?; false; end

#severity=(val) ⇒ Object



79
80
81
82
83
84
85
# File 'lib/monitoring_protocols/struct.rb', line 79

def severity=(val)
  if val.is_a?(Fixnum)
    @severity = SEVERITY[val]
  else
    @severity = val
  end
end

#to_hObject



89
90
91
92
93
# File 'lib/monitoring_protocols/struct.rb', line 89

def to_h
  super.merge(
      type: 'notification'
    )
end