Class: PagerdutyCli::Trigger
- Inherits:
-
Object
- Object
- PagerdutyCli::Trigger
- Includes:
- Common
- Defined in:
- lib/pagerduty_cli/trigger.rb
Overview
Send a trigger to PagerDuty
Constant Summary
Constants included from Common
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ Trigger
constructor
A new instance of Trigger.
- #send_trigger ⇒ Object
Methods included from Common
#croak, #incident_file, #incident_key, #load_data, #parse_common_options, #require_event, #warn
Constructor Details
#initialize(args) ⇒ Trigger
Returns a new instance of Trigger.
13 14 15 16 17 18 19 20 |
# File 'lib/pagerduty_cli/trigger.rb', line 13 def initialize(args) @me = 'pagerduty_trigger' parse_opts(args) require_event load_data return unless @options[:force] || !incident_is_too_fresh? touch_incident_file unless @options[:no_touch] end |
Class Method Details
.trigger(args) ⇒ Object
23 24 25 |
# File 'lib/pagerduty_cli/trigger.rb', line 23 def trigger(args) new(args).send_trigger end |
Instance Method Details
#send_trigger ⇒ Object
28 29 30 31 32 |
# File 'lib/pagerduty_cli/trigger.rb', line 28 def send_trigger Pagerduty.new(@api_key).trigger(incident_description, incident_key: incident_key, client: @options[:host]) end |