class PagerdutyIncident
Attributes
Public Class Methods
@param [String] service_key The GUID of one of your “Generic API” services.
This is the "service key" listed on a Generic API's service detail page.
@param [String] #incident_key The unique identifier for the incident.
# File lib/pagerduty.rb, line 126 def initialize(service_key, incident_key, options = {}) super service_key, options @incident_key = incident_key end
Public Instance Methods
Acknowledge the referenced incident. While an incident is acknowledged, it won't generate any additional notifications, even if it receives new trigger events. Send PagerDuty an acknowledge event when you know someone is presently working on the problem.
@param [String] description Text that will appear in the incident's log
associated with this event.
@param [Hash] details An arbitrary hash containing any data you'd like
included in the incident log.
@return [PagerdutyIncident] self
@raise [PagerdutyException] If PagerDuty responds with a status that is not
"success"
# File lib/pagerduty.rb, line 153 def acknowledge(description = nil, details = nil) modify_incident("acknowledge", description, details) end
Resolve the referenced incident. Once an incident is resolved, it won't generate any additional notifications. New trigger events with the same #incident_key as a resolved incident won't re-open the incident. Instead, a new incident will be created. Send PagerDuty a resolve event when the problem that caused the initial trigger event has been fixed.
@param [String] description Text that will appear in the incident's log
associated with this event.
@param [Hash] details An arbitrary hash containing any data you'd like
included in the incident log.
@return [PagerdutyIncident] self
@raise [PagerdutyException] If PagerDuty responds with a status that is not
"success"
# File lib/pagerduty.rb, line 174 def resolve(description = nil, details = nil) modify_incident("resolve", description, details) end
@param (see Pagerduty#trigger) @option (see Pagerduty#trigger)
# File lib/pagerduty.rb, line 133 def trigger(description, options = {}) super(description, { incident_key: incident_key }.merge(options)) end
Private Instance Methods
# File lib/pagerduty.rb, line 180 def modify_incident(event_type, description, details) options = { incident_key: incident_key } options[:description] = description if description options[:details] = details if details resp = api_call(event_type, options) ensure_success(resp) self end