module PagerDuty::Client::Notifications

When an incident is triggered or escalated, it creates a notification.

Notifications are messages containing the details of the incident, and can be sent through SMS, email, phone calls, and push notifications.

Notifications cannot be created directly through the API; they are a result of other actions.

The API provides read-only access to the notifications generated by PagerDuty. @see support.pagerduty.com/hc/en-us/articles/202828840-What-is-an-Alert-Notification- @see v2.developer.pagerduty.com/v2/page/api-reference#!/Notifications

Public Instance Methods

list_notifications(options = {})
Alias for: notifications
notifications(options = {}) click to toggle source

List notifications for a given time range, optionally filtered by type (sms_notification, email_notification, phone_notification, or push_notification). @param options [Sawyer::Resource] A customizable set of options. @option options [String] :time_zone Time zone in which dates in the result will be rendered. @option options [String] :since The start of the date range over which you want to search ISO8601 format @option options [String] :until The end of the date range over which you want to search ISO8601 format @option options [Array<String>] :filter Return only notifications with the given type (One of :sms_notification, :email_notification, :phone_notification, or :push_notification) @option options [Array<String>] :include Array of additional details to include. (One of users) @return [Array<Sawyer::Resource>] An array of hashes representing notifications @see v2.developer.pagerduty.com/v2/page/api-reference#!/Incidents/get_incidents

# File lib/pager_duty/client/notifications.rb, line 23
def notifications(options = {})
  query_params = Hash.new
  query_params[:time_zone]      = options[:time_zone] if options[:time_zone]
  query_params[:since] = options[:since].utc.iso8601 if options[:since]
  query_params[:until] = options[:until].utc.iso8601 if options[:until]
  query_params[:filter]        = options[:filter] if options[:filter]
  query_params[:include]       = options[:include] if options[:include]

  response = get "/notifications", options.merge({query: query_params})
  response[:notifications]
end
Also aliased as: list_notifications