Module: PagerDuty::Client::Notifications
- Included in:
- PagerDuty::Client
- Defined in:
- lib/pager_duty/client/notifications.rb
Overview
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.
Instance Method Summary collapse
-
#notifications(options = {}) ⇒ Array<Sawyer::Resource>
(also: #list_notifications)
List notifications for a given time range, optionally filtered by type (sms_notification, email_notification, phone_notification, or push_notification).
Instance Method Details
#notifications(options = {}) ⇒ Array<Sawyer::Resource> Also known as: list_notifications
List notifications for a given time range, optionally filtered by type (sms_notification, email_notification, phone_notification, or push_notification).
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/pager_duty/client/notifications.rb', line 23 def notifications( = {}) query_params = Hash.new query_params[:time_zone] = [:time_zone] if [:time_zone] query_params[:since] = [:since].utc.iso8601 if [:since] query_params[:until] = [:until].utc.iso8601 if [:until] query_params[:filter] = [:filter] if [:filter] query_params[:include] = [:include] if [:include] response = get "/notifications", .merge({query: query_params}) response[:notifications] end |