Method: Dogapi::Event#initialize

Defined in:
lib/dogapi/event.rb

#initialize(msg_text, options = {}) ⇒ Event

Optional arguments:

:date_happened => time in seconds since the epoch (defaults to now)
:msg_title     => String
:priority      => String
:parent        => event ID (integer)
:tags          => array of Strings
:event_object  => String
:alert_type    => 'success', 'error'
:event_type    => String
:source_type_name => String
:aggregation_key => String


33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/dogapi/event.rb', line 33

def initialize(msg_text, options= {})
  defaults = {
    :date_happened => Time.now.to_i,
    :msg_title => '',
    :priority => "normal",
    :parent => nil,
    :tags => [],
    :aggregation_key => nil
  }
  options = defaults.merge(options)

  @msg_text = msg_text
  @date_happened = options[:date_happened]
  @msg_title = options[:msg_title]
  @priority = options[:priority]
  @parent = options[:parent]
  @tags = options[:tags]
  @aggregation_key = options[:event_object] || options[:aggregation_key]
  @alert_type = options[:alert_type]
  @event_type = options[:event_type]
  @source_type_name = options[:source_type_name]
end