Class: Pagerduty::EventsApiV1
- Inherits:
-
Object
- Object
- Pagerduty::EventsApiV1
- Defined in:
- lib/pagerduty/events_api_v1.rb
Overview
Trigger incidents via the PagerDuty Events API version 1.
Defined Under Namespace
Classes: Incident
Instance Method Summary collapse
-
#incident(incident_key) ⇒ Pagerduty::EventsApiV1::Incident
The incident referenced by the key.
-
#initialize(config) ⇒ EventsApiV1
constructor
Rather than using this directly, use the build method to construct an instance.
-
#trigger(description, options = {}) ⇒ Pagerduty::EventsApiV1::Incident
Send PagerDuty a trigger event to report a new or ongoing problem.
Constructor Details
#initialize(config) ⇒ EventsApiV1
Rather than using this directly, use the Pagerduty.build method to construct an instance.
37 38 39 |
# File 'lib/pagerduty/events_api_v1.rb', line 37 def initialize(config) @config = config end |
Instance Method Details
#incident(incident_key) ⇒ Pagerduty::EventsApiV1::Incident
Returns The incident referenced by the key.
113 114 115 116 117 |
# File 'lib/pagerduty/events_api_v1.rb', line 113 def incident(incident_key) raise ArgumentError, "incident_key is nil" if incident_key.nil? Incident.new(@config.merge(incident_key: incident_key)) end |
#trigger(description, options = {}) ⇒ Pagerduty::EventsApiV1::Incident
Send PagerDuty a trigger event to report a new or ongoing problem.
93 94 95 96 97 |
# File 'lib/pagerduty/events_api_v1.rb', line 93 def trigger(description, = {}) config = @config.merge(incident_key: [:incident_key]) = .reject { |key| key == :incident_key } Incident.new(config).trigger(description, ) end |