Class: Pagerduty
- Inherits:
-
Object
- Object
- Pagerduty
- Defined in:
- lib/pagerduty.rb,
lib/pagerduty/version.rb
Direct Known Subclasses
Defined Under Namespace
Modules: HttpTransport
Constant Summary collapse
- VERSION =
"2.0.1"
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) ⇒ 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) ⇒ Pagerduty
Returns a new instance of Pagerduty.
21 22 23 |
# File 'lib/pagerduty.rb', line 21 def initialize(service_key) @service_key = service_key end |
Instance Attribute Details
#service_key ⇒ Object (readonly)
Returns the value of attribute service_key.
16 17 18 |
# File 'lib/pagerduty.rb', line 16 def service_key @service_key end |
Instance Method Details
#get_incident(incident_key) ⇒ PagerdutyIncident
Returns The incident referenced by the key.
66 67 68 |
# File 'lib/pagerduty.rb', line 66 def get_incident(incident_key) PagerdutyIncident.new service_key, incident_key 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.
58 59 60 61 62 |
# File 'lib/pagerduty.rb', line 58 def trigger(description, = {}) resp = api_call("trigger", .merge(:description => description)) ensure_success(resp) PagerdutyIncident.new service_key, resp["incident_key"] end |