class OopsGenie::OopsGenieAlert

configuration object to hold details of an OpsGenie Alert

Attributes

actions[RW]
alias[RW]
api_key[RW]
description[RW]
details[RW]
entity[RW]
message[RW]
priority[RW]
responders[RW]
tags[RW]

Public Class Methods

new(api_key, message) click to toggle source
# File lib/oops_genie/oops_genie_alert.rb, line 9
def initialize(api_key, message)
  @api_key = api_key
  @message = message
  @alias = nil
  @actions = nil
  @tags = nil
  @details = { description: message }
  @entity = nil
  @priority = nil
  @responders = nil
end

Public Instance Methods

alert_hash() click to toggle source
# File lib/oops_genie/oops_genie_alert.rb, line 21
def alert_hash
  attrs = {}
  instance_variables.each do |var|
    str = var.to_s.gsub /^@/, ''
    if respond_to? "#{str}="
      attrs[str.to_sym] = instance_variable_get var
    end
  end
  attrs
end
send_alert() click to toggle source
# File lib/oops_genie/oops_genie_alert.rb, line 32
def send_alert
  og_client = OopsGenie::OopsGenieClient.new(@api_key)
  response = og_client.send_alert(self)
  puts response
end