lib/pagerduty/events_api_v1.rb in pagerduty-4.0.0 vs lib/pagerduty/events_api_v1.rb in pagerduty-4.0.1
- old
+ new
@@ -174,13 +174,11 @@
# )
#
# @param (see Pagerduty::EventsApiV1#trigger)
# @option (see Pagerduty::EventsApiV1#trigger)
def trigger(description, options = {})
- if options.key?(:incident_key)
- raise ArgumentError, "incident_key provided"
- end
+ raise ArgumentError, "incident_key provided" if options.key?(:incident_key)
options = options.merge(description: description)
options[:incident_key] = @incident_key unless @incident_key.nil?
response = api_call("trigger", options)
@incident_key = response["incident_key"]
@@ -266,12 +264,10 @@
args = args.merge(
service_key: @integration_key,
event_type: event_type,
)
response = @transport.send_payload(args)
- unless response["status"] == "success"
- raise PagerdutyException.new(self, response, response["message"])
- end
+ raise PagerdutyException.new(self, response, response["message"]) unless response["status"] == "success"
response
end
end
end