class Dogapi::Event

Metadata class for storing the details of an event

Attributes

aggregation_key[R]
date_happened[R]
msg_text[R]
msg_title[R]
parent[R]
priority[R]
tags[R]

Public Class Methods

new(msg_text, options= {}) click to toggle source

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
   # File lib/dogapi/event.rb
33 def initialize(msg_text, options= {})
34   defaults = {
35     :date_happened => Time.now.to_i,
36     :msg_title => '',
37     :priority => "normal",
38     :parent => nil,
39     :tags => [],
40     :aggregation_key => nil
41   }
42   options = defaults.merge(options)
43 
44   @msg_text = msg_text
45   @date_happened = options[:date_happened]
46   @msg_title = options[:msg_title]
47   @priority = options[:priority]
48   @parent = options[:parent]
49   @tags = options[:tags]
50   @aggregation_key = options[:event_object] || options[:aggregation_key]
51   @alert_type = options[:alert_type]
52   @event_type = options[:event_type]
53   @source_type_name = options[:source_type_name]
54 end

Public Instance Methods

to_hash() click to toggle source

Copy and pasted from the internets stackoverflow.com/a/5031637/25276

   # File lib/dogapi/event.rb
58 def to_hash
59   hash = {}
60   instance_variables.each { |var| hash[var.to_s[1..-1].to_sym] = instance_variable_get(var) }
61   hash
62 end