pager_duty 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -3
  3. data/fixtures/vcr_cassettes/incidents/create_incident_notes/PDP31UM.yml +62 -0
  4. data/fixtures/vcr_cassettes/log_entries/index/no_query.yml +490 -0
  5. data/fixtures/vcr_cassettes/log_entries/index/time_zone.yml +490 -0
  6. data/fixtures/vcr_cassettes/log_entries/log_entry.yml +63 -0
  7. data/fixtures/vcr_cassettes/log_entries/log_entry_EST.yml +63 -0
  8. data/fixtures/vcr_cassettes/maintenance_windows/create.yml +65 -0
  9. data/fixtures/vcr_cassettes/maintenance_windows/delete.yml +164 -0
  10. data/fixtures/vcr_cassettes/maintenance_windows/delete_in_past.yml +117 -0
  11. data/fixtures/vcr_cassettes/maintenance_windows/get_PIVGPA6.yml +62 -0
  12. data/fixtures/vcr_cassettes/maintenance_windows/index/all.yml +62 -0
  13. data/fixtures/vcr_cassettes/maintenance_windows/index/future.yml +62 -0
  14. data/fixtures/vcr_cassettes/maintenance_windows/index/no_query.yml +62 -0
  15. data/fixtures/vcr_cassettes/maintenance_windows/index/ongoing.yml +62 -0
  16. data/fixtures/vcr_cassettes/maintenance_windows/index/past.yml +62 -0
  17. data/fixtures/vcr_cassettes/maintenance_windows/index/query.yml +62 -0
  18. data/fixtures/vcr_cassettes/maintenance_windows/update.yml +181 -0
  19. data/fixtures/vcr_cassettes/notifications/index/no_query.yml +57 -0
  20. data/fixtures/vcr_cassettes/notifications/index/query_since.yml +83 -0
  21. data/fixtures/vcr_cassettes/notifications/index/query_since_email_notification.yml +83 -0
  22. data/fixtures/vcr_cassettes/notifications/index/query_since_est.yml +83 -0
  23. data/fixtures/vcr_cassettes/notifications/index/query_since_sms_notification.yml +58 -0
  24. data/fixtures/vcr_cassettes/on_calls/index/query.yml +78 -0
  25. data/fixtures/vcr_cassettes/on_calls/index/query_.yml +48 -0
  26. data/fixtures/vcr_cassettes/on_calls/index/query_earliest.yml +78 -0
  27. data/fixtures/vcr_cassettes/on_calls/index/query_include_users.yml +102 -0
  28. data/fixtures/vcr_cassettes/on_calls/index/query_include_users_and_schedules.yml +154 -0
  29. data/fixtures/vcr_cassettes/on_calls/index/query_since_est.yml +78 -0
  30. data/fixtures/vcr_cassettes/on_calls/index/query_since_until.yml +78 -0
  31. data/fixtures/vcr_cassettes/vendors/index/no_query.yml +181 -0
  32. data/fixtures/vcr_cassettes/vendors/vendor.yml +63 -0
  33. data/lib/pager_duty/client.rb +10 -0
  34. data/lib/pager_duty/client/abilities.rb +4 -8
  35. data/lib/pager_duty/client/addons.rb +16 -18
  36. data/lib/pager_duty/client/escalation_policies.rb +3 -3
  37. data/lib/pager_duty/client/incidents.rb +19 -8
  38. data/lib/pager_duty/client/log_entries.rb +64 -0
  39. data/lib/pager_duty/client/maintenance_windows.rb +138 -0
  40. data/lib/pager_duty/client/notifications.rb +37 -0
  41. data/lib/pager_duty/client/on_calls.rb +59 -0
  42. data/lib/pager_duty/client/vendors.rb +38 -0
  43. data/lib/pager_duty/version.rb +1 -1
  44. data/pager_duty.gemspec +1 -0
  45. metadata +51 -2
@@ -4,12 +4,12 @@ module PagerDuty
4
4
  # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Escalation_Policies
5
5
  module EscalationPolicies
6
6
  # List escalation policies
7
- # @param options [Sawyer::Resource] A customizable set of options.
8
- # @option options [String] :query Filters the results, showing only the escalation policies whose names contain the query.
7
+ # @param options [Sawyer::Resource] A customizable set of options.
8
+ # @option options [String] :query Filters the results, showing only the escalation policies whose names contain the query.
9
9
  # @option options [Array<string>] :user_ids Filters the results, showing only escalation policies on which any of the users is a target.
10
10
  # @option options [Array<string>] :team_ids An array of team IDs. Only results related to these teams will be returned. Account must have the teams ability to use this parameter.
11
11
  # @option options [Array<string>] :include Array of additional details to include (One or more of <tt>:services</tt>, <tt>:teams</tt>, <tt>:targets</tt>)
12
- # @option options [String] :sort_by ("name") Sort the list by '<tt>name</tt>', '<tt>name:asc</tt>' or '<tt>name:desc</tt>'
12
+ # @option options [String] :sort_by ("name") Sort the list by '<tt>name</tt>', '<tt>name:asc</tt>' or '<tt>name:desc</tt>'
13
13
  #
14
14
  # @return [Array<Sawyer::Resource>] An array of hashes representing escalation policies
15
15
  # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Escalation_Policies/get_escalation_policies
@@ -1,8 +1,8 @@
1
1
  require "time"
2
2
  module PagerDuty
3
3
  class Client
4
- # Module encompassing interactions with the escalation policies API endpoint
5
- # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Escalation_Policies
4
+ # Module encompassing interactions with the incidents API endpoint
5
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Incidents
6
6
  module Incidents
7
7
  # List incidents
8
8
  # @param options [Sawyer::Resource] A customizable set of options.
@@ -202,10 +202,23 @@ module PagerDuty
202
202
  response[:incidents]
203
203
  end
204
204
 
205
- # # Create a new note for the specified incident.
206
- # # /incidents/{id}/notes
207
- # def post_incidents_notes(id)
208
- # end
205
+ # Create a new note for the specified incident.
206
+ # /incidents/{id}/notes
207
+ # @param incident_id [String] Incident ID
208
+ # @param from_email_address [String] The email address of the user making the request.
209
+ # @param options [Sawyer::Resource] A customizable set of options
210
+ #
211
+ # @return [Sawyer::Resource] A hash representing a note for the incident
212
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Incidents/post_incidents_id_notes
213
+ def create_incident_note(incident_id, from_email_address, options = {})
214
+ if from_email_address
215
+ options[:headers] ||= {}
216
+ options[:headers][:from] = from_email_address
217
+ end
218
+
219
+ response = post "/incidents/#{incident_id}/notes", options
220
+ response[:note]
221
+ end
209
222
 
210
223
  # # Create an incident synchronously without a corresponding event from a monitoring service.
211
224
  # # /incidents
@@ -221,8 +234,6 @@ module PagerDuty
221
234
  # # /incidents/{id}/alerts/{alert_id}/
222
235
  # def put_incidents(id, alert_id)
223
236
  # end
224
-
225
-
226
237
  end
227
238
  end
228
239
  end
@@ -0,0 +1,64 @@
1
+ require "time"
2
+ module PagerDuty
3
+ class Client
4
+ # Module encompassing interactions with the incidents API endpoint
5
+ #
6
+ # PagerDuty keeps a log of all the events that happen to an incident
7
+ #
8
+ # These are exposed as log entries.
9
+ #
10
+ # Log entries give you more insight into how your team or organization is handling your incidents.
11
+ #
12
+ # Log entry data includes details about the event(s) that affected the incident throughout its lifecycle, such as:
13
+ # - the data contained in events sent by the integration
14
+ # - what users were notified and when
15
+ # - how they were notified
16
+ # - what user(s) acknowledged or resolved the incident
17
+ # - any automatic actions that occurred to the incident
18
+ # - other manual user actions, such as a reassignment or a note
19
+ #
20
+ # Log entries cannot be created directly through the API; they are a result of other actions. The API provides read-only access to the log entries generated by PagerDuty.
21
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Log_Entries
22
+ module LogEntries
23
+ # List all of the incident log entries across the entire account.
24
+ # @param options [Sawyer::Resource] A customizable set of options.
25
+ # @option options [String] :time_zone Time zone in which dates in the result will be rendered.
26
+ # @option options [String] :since The start of the date range over which you want to search ISO8601 format
27
+ # @option options [String] :until The end of the date range over which you want to search ISO8601 format
28
+ # @option options [Boolean] :is_overview If <tt>true</tt>, will return a subset of log entries that show only the most important changes to the incident.
29
+ # @option options [Array<String>] :include Array of additional details to include. (One or more of <tt>incidents</tt>, <tt>services</tt>, <tt>channels</tt> or <tt>teams</tt>.)
30
+ # @return [Array<Sawyer::Resource>] An array of hashes representing log_entries
31
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Log_Entries/get_log_entries
32
+ def log_entries(options = {})
33
+ query_params = Hash.new
34
+ query_params[:since] = options[:since].utc.iso8601 if options[:since]
35
+ query_params[:until] = options[:until].utc.iso8601 if options[:until]
36
+ query_params[:time_zone] = options[:time_zone] if options[:time_zone]
37
+ query_params[:is_overview] = options.fetch(:is_overview, false)
38
+ query_params[:include] = options[:include] if options[:include]
39
+
40
+ response = get "/log_entries", options.merge({query: query_params})
41
+ response[:log_entries]
42
+ end
43
+ alias :list_log_entries :log_entries
44
+
45
+ # Get details for a specific incident log entry. This method provides additional information you can use to get at raw event data.
46
+ #
47
+ # @param id [String] A log entry id (required)
48
+ # @param options [Sawyer::Resource] A customizable set of options.
49
+ # @option options [String] :time_zone Default to UTC
50
+ # @option options [Array<String>] :include Array of additional details to include. (One or more of <tt>incidents</tt>, <tt>services</tt>, <tt>channels</tt> or <tt>teams</tt>.)
51
+ # @return [Sawyer::Resource] A hash representing log entry
52
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Log_Entries/get_log_entries_id
53
+ def log_entry(id, options = {})
54
+ query_params = Hash.new
55
+ query_params[:time_zone] = options[:time_zone] if options[:time_zone]
56
+ query_params[:include] = options[:include] if options[:include]
57
+
58
+ response = get "/log_entries/#{id}", options.merge({query: query_params})
59
+ response[:log_entry]
60
+ end
61
+ alias :get_log_entry :log_entry
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,138 @@
1
+ require "time"
2
+ module PagerDuty
3
+ class Client
4
+ # Methods for the MaintenanceWindows API
5
+ #
6
+ # A maintenance window is used to temporarily disable one or more services for a set period of time.
7
+ #
8
+ # No incidents will be triggered and no notifications will be received while a service is disabled by a maintenance window.
9
+ #
10
+ # Maintenance windows are specified to start at a certain time and end after they have begun.
11
+ #
12
+ # Once started, a maintenance window cannot be deleted; it can only be ended immediately to re-enable the service.
13
+ #
14
+ # Read more about maintenance windows in the PagerDuty Knowledge Base
15
+ # @see https://support.pagerduty.com/hc/en-us/articles/202830350-Putting-a-service-in-maintenance-mode
16
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Maintenance_windows
17
+ module MaintenanceWindows
18
+ # List existing maintenance windows, optionally filtered by service and/or team, or whether they are from the past, present or future.
19
+ # @param options [Sawyer::Resource] A customizable set of options.
20
+ # @option options [String] :query Filters the results, showing only the maintenance windows whose descriptions contain the query.
21
+ # @option options [Array<string>] :service_ids An array of service IDs. Only results related to these services will be returned.
22
+ # @option options [Array<string>] :team_ids An array of team IDs. Only results related to these teams will be returned. Account must have the teams ability to use this parameter.
23
+ # @option options [Array<string>] :include Array of additional details to include (One or more of <tt>:services</tt>, <tt>:teams</tt>, <tt>:users</tt>)
24
+ # @option options [String] :filter Only return maintenance windows in a given state. (One of <tt>:past</tt>, <tt>:future</tt>, <tt>:ongoing</tt>, <tt>:open</tt> or <tt>:all</tt>).
25
+ #
26
+ # @return [Array<Sawyer::Resource>] An array of hashes representing maintenance windows
27
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Maintenance_Windows/get_maintenance_windows
28
+ def maintenance_windows(options = {})
29
+ service_ids = options.fetch(:service_ids, [])
30
+ team_ids = options.fetch(:team_ids, [])
31
+
32
+ query_params = Hash.new
33
+ query_params["query"] = options[:query] if options[:query]
34
+ query_params["team_ids[]"] = team_ids.join(",") if team_ids.length > 0
35
+ query_params["service_ids[]"] = service_ids.join(",") if service_ids.length > 0
36
+ query_params["include[]"] = options[:include] if options[:include]
37
+ query_params["filter"] = options[:filter] if options[:filter]
38
+
39
+ response = get "/maintenance_windows", options.merge({query: query_params})
40
+ response[:maintenance_windows]
41
+ end
42
+ alias :list_maintenance_windows :maintenance_windows
43
+
44
+ # Get an existing maintenance window.
45
+ # @param id [String] ID for maintenance window
46
+ # @param options [Sawyer::Resource] A customizable set of options.
47
+ # @option options [Array<string>] :include Array of additional details to include (One or more of <tt>:services</tt>, <tt>:teams</tt>, <tt>:users</tt>)
48
+ #
49
+ # @return [Sawyer::Resource] An hash representing maintenance window
50
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Maintenance_Windows/get_maintenance_windows_id
51
+ def maintenance_window(id, options = {})
52
+ query_params = Hash.new
53
+ query_params["include[]"] = options[:include] if options[:include]
54
+
55
+ response = get "/maintenance_windows/#{id}", options.merge({query: query_params})
56
+ response[:maintenance_window]
57
+ end
58
+ alias :get_maintenance_window :maintenance_window
59
+
60
+ # # Create a new maintenance window for the specified services. No new incidents will be created for a service that is in maintenance.
61
+ # @param from_email_address [String] User creating maintenance window
62
+ # @param start_time [String] Start time of maintenance window in ISO8601 format
63
+ # @param end_time [String] End time of maintenance window in ISO8601 format
64
+ # @param description [String] Description of maintenace window
65
+ # @param service_id [String] Service referenced in maintenance window
66
+ # @param options [Sawyer::Resource] A customizable set of options.
67
+ #
68
+ # @return [Sawyer::Resource] An hash representing maintenance window
69
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Maintenance_Windows/post_maintenance_windows
70
+ def create_maintenance_window(from_email_address, start_time, end_time, description, service_id, options = {})
71
+ if from_email_address
72
+ options[:headers] ||= {}
73
+ options[:headers][:from] = from_email_address
74
+ end
75
+
76
+ params = {
77
+ maintenance_window: {
78
+ type: "maintenance_window",
79
+ start_time: start_time,
80
+ end_time: end_time,
81
+ description: description,
82
+ services: [
83
+ {
84
+ id: service_id,
85
+ type: "service_reference"
86
+ }
87
+ ]
88
+ }
89
+ }
90
+ response = post "/maintenance_windows", options.merge(params)
91
+ response[:maintenance_window]
92
+ end
93
+
94
+ # # Delete an existing maintenance window if it's in the future, or end it if it's currently on-going. If the maintenance window has already ended it cannot be deleted.
95
+ # @param id [String] PagerDuty identifier for maintenance window
96
+ #
97
+ # @return [Boolean]
98
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Maintenance_Windows/delete_maintenance_windows_id
99
+ def delete_maintenance_window(id, options = {})
100
+ boolean_from_response :delete, "/maintenance_windows/#{id}", options
101
+ end
102
+
103
+ # # Update an existing maintenance window.
104
+ # # /maintenance_windows/{id}
105
+ # def put_maintenance_windows/{id}({"name"=>"maintenance_window", "in"=>"body", "description"=>"The maintenance window to be updated.", "schema"=>{"type"=>"object", "properties"=>{"maintenance_window"=>{"$ref"=>"#/definitions/MaintenanceWindow"}}, "required"=>["maintenance_window"]}}, {"$ref"=>"#/parameters/id"}, id)
106
+ # end
107
+
108
+ # # Update an existing maintenance window.
109
+ # @param id [String] PagerDuty id for maintenance window
110
+ # @param start_time [String] Start time of maintenance window in ISO8601 format
111
+ # @param end_time [String] End time of maintenance window in ISO8601 format
112
+ # @param description [String] Description of maintenace window
113
+ # @param service_id [String] Service referenced in maintenance window
114
+ # @param options [Sawyer::Resource] A customizable set of options.
115
+ #
116
+ # @return [Sawyer::Resource] An hash representing maintenance window
117
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Maintenance_Windows/put_maintenance_windows_id
118
+ def update_maintenance_window(id, start_time, end_time, description, service_id, options = {})
119
+ params = {
120
+ maintenance_window: {
121
+ type: "maintenance_window",
122
+ start_time: start_time,
123
+ end_time: end_time,
124
+ description: description,
125
+ services: [
126
+ {
127
+ id: service_id,
128
+ type: "service_reference"
129
+ }
130
+ ]
131
+ }
132
+ }
133
+ response = put "/maintenance_windows/#{id}", options.merge(params)
134
+ response[:maintenance_window]
135
+ end
136
+ end
137
+ end
138
+ end
@@ -0,0 +1,37 @@
1
+ require "time"
2
+ module PagerDuty
3
+ class Client
4
+ # When an incident is triggered or escalated, it creates a notification.
5
+ #
6
+ # Notifications are messages containing the details of the incident, and can be sent through SMS, email, phone calls, and push notifications.
7
+ #
8
+ # Notifications cannot be created directly through the API; they are a result of other actions.
9
+ #
10
+ # The API provides read-only access to the notifications generated by PagerDuty.
11
+ # @see https://support.pagerduty.com/hc/en-us/articles/202828840-What-is-an-Alert-Notification-
12
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Notifications
13
+ module Notifications
14
+ # List notifications for a given time range, optionally filtered by type (sms_notification, email_notification, phone_notification, or push_notification).
15
+ # @param options [Sawyer::Resource] A customizable set of options.
16
+ # @option options [String] :time_zone Time zone in which dates in the result will be rendered.
17
+ # @option options [String] :since The start of the date range over which you want to search ISO8601 format
18
+ # @option options [String] :until The end of the date range over which you want to search ISO8601 format
19
+ # @option options [Array<String>] :filter Return only notifications with the given type (One of <tt>:sms_notification</tt>, <tt>:email_notification</tt>, <tt>:phone_notification</tt>, or <tt>:push_notification</tt>)
20
+ # @option options [Array<String>] :include Array of additional details to include. (One of <tt>users</tt>)
21
+ # @return [Array<Sawyer::Resource>] An array of hashes representing notifications
22
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Incidents/get_incidents
23
+ def notifications(options = {})
24
+ query_params = Hash.new
25
+ query_params[:time_zone] = options[:time_zone] if options[:time_zone]
26
+ query_params[:since] = options[:since].utc.iso8601 if options[:since]
27
+ query_params[:until] = options[:until].utc.iso8601 if options[:until]
28
+ query_params[:filter] = options[:filter] if options[:filter]
29
+ query_params[:include] = options[:include] if options[:include]
30
+
31
+ response = get "/notifications", options.merge({query: query_params})
32
+ response[:notifications]
33
+ end
34
+ alias :list_notifications :notifications
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,59 @@
1
+ require "time"
2
+ module PagerDuty
3
+ class Client
4
+ # An on-call represents a contiguous unit of time for which a [user](#resource_Users) will be on call for a given escalation policy and escalation rule.
5
+ #
6
+ # This may be the result of that user always being on call for the escalation rule, or a block of time during which the computed result of a schedule on that escalation rule puts the user on call.
7
+ #
8
+ # During an on-call, the user is expected to bear responsibility for responding to any notifications she receives and working to resolve the associated incident(s).
9
+ #
10
+ # On-calls cannot be created directly through the API; they are the computed result of how escalation policies and schedules are configured.
11
+ #
12
+ # The API provides read-only access to the on-calls generated by PagerDuty.
13
+ # @see https://support.pagerduty.com/hc/en-us/articles/202828840-What-is-an-Alert-Notification-
14
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/On-Calls
15
+ module OnCalls
16
+ # List all of the on-call entries within a given time range for a given set
17
+ # of users, escalation policies, and/or schedules. Each on-call entry
18
+ # includes:
19
+ #
20
+ # - the date/time period for the on-call entry;
21
+ # - the escalation policy, rule, and level;
22
+ # - the schedule, if the rule targeted a schedule and not a user; and,
23
+ # - the user on call for the escalation policy rule during that time.
24
+ # @param options [Sawyer::Resource] A customizable set of options.
25
+
26
+ # @option options [String] :time_zone Time zone in which dates in the result will be rendered.
27
+ # @option options [Array<String>] :include Array of additional details to include. (One of <tt>escalation_policies</tt>, <tt>schedules</tt> or <tt>users</tt>)
28
+ # @option options [Array<String>] :user_ids Filters the results, showing only on-calls for the specified user IDs.
29
+ # @option options [Array<String>] :escalation_policy_ids Filters the results, showing only on-calls for the specified escalation policy IDs.
30
+ # @option options [Array<String>] :schedule_ids Filters the results, showing only on-calls for the specified schedule IDs. If `null` is provided in the array, it includes permanent on-calls due to direct user escalation targets.
31
+ # @option options [String] :since The start of the date range over which you want to search ISO8601 format
32
+ # @option options [String] :until The end of the date range over which you want to search ISO8601 format
33
+ # @option options [Boolean] :earliest This will filter on-calls such that only the earliest on-call for each combination of escalation policy, escalation level, and user is returned. This is useful for determining when the "next" on-calls are for a given set of filters.
34
+ # @return [Array<Sawyer::Resource>] An array of hashes representing notifications
35
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Incidents/get_incidents
36
+ def on_calls(options = {})
37
+ user_ids = options.fetch(:user_ids, [])
38
+ escalation_policy_ids = options.fetch(:escalation_policy_ids, [])
39
+ schedule_ids = options.fetch(:schedule_ids, [])
40
+
41
+ query_params = Hash.new
42
+
43
+ query_params[:time_zone] = options[:time_zone] if options[:time_zone]
44
+ query_params[:since] = options[:since].utc.iso8601 if options[:since]
45
+ query_params[:until] = options[:until].utc.iso8601 if options[:until]
46
+ query_params[:earliest] = options.fetch(:earliest, false) if options[:earliest]
47
+
48
+ query_params[:include] = options[:include] if options[:include]
49
+ query_params["user_ids[]"] = user_ids.join(",") if user_ids.length > 0
50
+ query_params["escalation_policy_ids[]"] = escalation_policy_ids.join(",") if escalation_policy_ids.length > 0
51
+ query_params["schedule_ids[]"] = schedule_ids.join(",") if schedule_ids.length > 0
52
+
53
+ response = get "/oncalls", options.merge({query: query_params})
54
+ response[:oncalls]
55
+ end
56
+ alias :list_on_calls :on_calls
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,38 @@
1
+ require "time"
2
+ module PagerDuty
3
+ class Client
4
+ # Module encompassing interactions with the vendors API endpoint
5
+ #
6
+ # A PagerDuty vendor represents a specific type of integration.
7
+ #
8
+ # AWS Cloudwatch, Splunk, Datadog, etc are all examples of vendors that can be integrated in PagerDuty by making an integration.
9
+ #
10
+ # Vendored integrations (when compared to generic email and API integrations) are automatically configured with the right API or email filtering settings for inbound events from that vendor.
11
+ #
12
+ # Some vendors also have associated integration guides on the PagerDuty support site.
13
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Vendors
14
+ module Vendors
15
+ # List all vendors.
16
+ # @param options [Sawyer::Resource] A customizable set of options.
17
+ # @return [Array<Sawyer::Resource>] An array of hashes representing vendors
18
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Vendors/get_vendors
19
+ def vendors(options = {})
20
+ response = get "/vendors", options
21
+ response[:vendors]
22
+ end
23
+ alias :list_vendors :vendors
24
+
25
+ # Get details about one specific vendor.
26
+ #
27
+ # @param id [String] A vendor id (required)
28
+ # @param options [Sawyer::Resource] A customizable set of options.
29
+ # @return [Sawyer::Resource] A hash representing vendor
30
+ # @see https://v2.developer.pagerduty.com/v2/page/api-reference#!/Vendors/get_vendors_id
31
+ def vendor(id, options = {})
32
+ response = get "/vendors/#{id}", options
33
+ response[:vendor]
34
+ end
35
+ alias :get_vendor :vendor
36
+ end
37
+ end
38
+ end
@@ -1,3 +1,3 @@
1
1
  module PagerDuty
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_dependency 'sawyer', '>= 0.5.3', '~> 0.8.0'
25
25
 
26
26
  spec.add_development_dependency "faraday-detailed_logger"
27
+ spec.add_development_dependency "coveralls"
27
28
  spec.add_development_dependency "ruby-swagger"
28
29
  spec.add_development_dependency "bundler", "~> 1.14"
29
30
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pager_duty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Veverka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-24 00:00:00.000000000 Z
11
+ date: 2017-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sawyer
@@ -44,6 +44,20 @@ dependencies:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: coveralls
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
47
61
  - !ruby/object:Gem::Dependency
48
62
  name: ruby-swagger
49
63
  requirement: !ruby/object:Gem::Requirement
@@ -249,6 +263,7 @@ files:
249
263
  - fixtures/vcr_cassettes/escalation_policies/update_num_loops_only.yml
250
264
  - fixtures/vcr_cassettes/escalation_policies/update_repeat_enabled_only.yml
251
265
  - fixtures/vcr_cassettes/escalation_policies/update_teams.yml
266
+ - fixtures/vcr_cassettes/incidents/create_incident_notes/PDP31UM.yml
252
267
  - fixtures/vcr_cassettes/incidents/incident.yml
253
268
  - fixtures/vcr_cassettes/incidents/incident_alerts/P6M04C7.yml
254
269
  - fixtures/vcr_cassettes/incidents/incident_alerts/alert_key.yml
@@ -286,13 +301,47 @@ files:
286
301
  - fixtures/vcr_cassettes/incidents/snooze_incident/PD9WJA8.yml
287
302
  - fixtures/vcr_cassettes/incidents/snooze_incident/PD9WJA8_acknowledged.yml
288
303
  - fixtures/vcr_cassettes/incidents/update_incidents/PD9WJA8.yml
304
+ - fixtures/vcr_cassettes/log_entries/index/no_query.yml
305
+ - fixtures/vcr_cassettes/log_entries/index/time_zone.yml
306
+ - fixtures/vcr_cassettes/log_entries/log_entry.yml
307
+ - fixtures/vcr_cassettes/log_entries/log_entry_EST.yml
308
+ - fixtures/vcr_cassettes/maintenance_windows/create.yml
309
+ - fixtures/vcr_cassettes/maintenance_windows/delete.yml
310
+ - fixtures/vcr_cassettes/maintenance_windows/delete_in_past.yml
311
+ - fixtures/vcr_cassettes/maintenance_windows/get_PIVGPA6.yml
312
+ - fixtures/vcr_cassettes/maintenance_windows/index/all.yml
313
+ - fixtures/vcr_cassettes/maintenance_windows/index/future.yml
314
+ - fixtures/vcr_cassettes/maintenance_windows/index/no_query.yml
315
+ - fixtures/vcr_cassettes/maintenance_windows/index/ongoing.yml
316
+ - fixtures/vcr_cassettes/maintenance_windows/index/past.yml
317
+ - fixtures/vcr_cassettes/maintenance_windows/index/query.yml
318
+ - fixtures/vcr_cassettes/maintenance_windows/update.yml
319
+ - fixtures/vcr_cassettes/notifications/index/no_query.yml
320
+ - fixtures/vcr_cassettes/notifications/index/query_since.yml
321
+ - fixtures/vcr_cassettes/notifications/index/query_since_email_notification.yml
322
+ - fixtures/vcr_cassettes/notifications/index/query_since_est.yml
323
+ - fixtures/vcr_cassettes/notifications/index/query_since_sms_notification.yml
324
+ - fixtures/vcr_cassettes/on_calls/index/query.yml
325
+ - fixtures/vcr_cassettes/on_calls/index/query_.yml
326
+ - fixtures/vcr_cassettes/on_calls/index/query_earliest.yml
327
+ - fixtures/vcr_cassettes/on_calls/index/query_include_users.yml
328
+ - fixtures/vcr_cassettes/on_calls/index/query_include_users_and_schedules.yml
329
+ - fixtures/vcr_cassettes/on_calls/index/query_since_est.yml
330
+ - fixtures/vcr_cassettes/on_calls/index/query_since_until.yml
289
331
  - fixtures/vcr_cassettes/unauthorized_nil_token.yml
332
+ - fixtures/vcr_cassettes/vendors/index/no_query.yml
333
+ - fixtures/vcr_cassettes/vendors/vendor.yml
290
334
  - lib/pager_duty.rb
291
335
  - lib/pager_duty/client.rb
292
336
  - lib/pager_duty/client/abilities.rb
293
337
  - lib/pager_duty/client/addons.rb
294
338
  - lib/pager_duty/client/escalation_policies.rb
295
339
  - lib/pager_duty/client/incidents.rb
340
+ - lib/pager_duty/client/log_entries.rb
341
+ - lib/pager_duty/client/maintenance_windows.rb
342
+ - lib/pager_duty/client/notifications.rb
343
+ - lib/pager_duty/client/on_calls.rb
344
+ - lib/pager_duty/client/vendors.rb
296
345
  - lib/pager_duty/configurable.rb
297
346
  - lib/pager_duty/connection.rb
298
347
  - lib/pager_duty/default.rb