Class: Pagerduty
- Inherits:
-
Object
- Object
- Pagerduty
- Defined in:
- lib/pagerduty.rb,
lib/pagerduty/version.rb,
lib/pagerduty/http_transport.rb
Direct Known Subclasses
Defined Under Namespace
Classes: HttpTransport
Constant Summary collapse
- VERSION =
"2.1.0"
Instance Attribute Summary collapse
-
#service_key ⇒ Object
readonly
Returns the value of attribute service_key.
Instance Method Summary collapse
-
#get_incident(incident_key) ⇒ PagerdutyIncident
The incident referenced by the key.
-
#initialize(service_key, options = {}) ⇒ Pagerduty
constructor
A new instance of Pagerduty.
-
#trigger(description, options = {}) ⇒ PagerdutyIncident
Send PagerDuty a trigger event to report a new or ongoing problem.
Constructor Details
#initialize(service_key, options = {}) ⇒ Pagerduty
Returns a new instance of Pagerduty.
31 32 33 34 |
# File 'lib/pagerduty.rb', line 31 def initialize(service_key, = {}) @service_key = service_key @transport = () end |
Instance Attribute Details
#service_key ⇒ Object (readonly)
Returns the value of attribute service_key.
15 16 17 |
# File 'lib/pagerduty.rb', line 15 def service_key @service_key end |
Instance Method Details
#get_incident(incident_key) ⇒ PagerdutyIncident
Returns The incident referenced by the key.
85 86 87 88 89 90 91 92 |
# File 'lib/pagerduty.rb', line 85 def get_incident(incident_key) fail ArgumentError, "incident_key is nil" if incident_key.nil? PagerdutyIncident.new( service_key, incident_key, transport: @transport, ) end |
#trigger(description, options = {}) ⇒ PagerdutyIncident
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 provided incident_key.
69 70 71 72 73 74 75 76 77 |
# File 'lib/pagerduty.rb', line 69 def trigger(description, = {}) resp = api_call("trigger", .merge(description: description)) ensure_success(resp) PagerdutyIncident.new( service_key, resp["incident_key"], transport: @transport, ) end |