Class: Pagerduty::EventsApiV2
- Inherits:
-
Object
- Object
- Pagerduty::EventsApiV2
- Defined in:
- lib/pagerduty/events_api_v2.rb
Overview
Trigger incidents via the PagerDuty Events API version 2.
Defined Under Namespace
Classes: Incident
Instance Method Summary collapse
-
#incident(incident_key) ⇒ Pagerduty::EventsApiV2::Incident
The incident referenced by the provided key.
-
#initialize(config = {}) ⇒ EventsApiV2
constructor
Rather than using this directly, use the build method to construct an instance.
-
#trigger(details) ⇒ Pagerduty::EventsApiV2::Incident
Send PagerDuty a trigger event to report a new or ongoing problem.
Constructor Details
#initialize(config = {}) ⇒ EventsApiV2
Rather than using this directly, use the Pagerduty.build method to construct an instance.
39 40 41 |
# File 'lib/pagerduty/events_api_v2.rb', line 39 def initialize(config = {}) @config = config end |
Instance Method Details
#incident(incident_key) ⇒ Pagerduty::EventsApiV2::Incident
Returns The incident referenced by the provided key.
133 134 135 136 137 |
# File 'lib/pagerduty/events_api_v2.rb', line 133 def incident(incident_key) raise ArgumentError, "incident_key is nil" if incident_key.nil? Incident.new(@config.merge(incident_key: incident_key)) end |
#trigger(details) ⇒ Pagerduty::EventsApiV2::Incident
Send PagerDuty a trigger event to report a new or ongoing problem. When PagerDuty receives a trigger event, it will either open a new incident, or add a new trigger log entry to an existing incident, depending on the incident key.
122 123 124 |
# File 'lib/pagerduty/events_api_v2.rb', line 122 def trigger(details) Incident.new(@config).trigger(details) end |