pagerduty-sdk 1.0.6 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,53 +1,53 @@
1
- class Pagerduty
2
- module Requests
3
- module Alerts
4
-
5
- extend Pagerduty::Core
6
-
7
- # List existing alerts for a given time range, optionally filtered by type (SMS, Email, Phone, or Push)
8
- #
9
- # ==== Parameters
10
- # * params<~Hash>
11
- # * 'since'<~String>: The start of the date range over which you want to search. The time element is optional.
12
- # * 'until'<~String>: The end of the date range over which you want to search. This should be in the same format as since. The size of the date range must be less than 3 months.
13
- # * 'filter'<~String>: Returns only the alerts of the said types. Can be one of SMS, Email, Phone, or Push.
14
- # * 'time_zone'<~TimeZone>: Time zone in which dates in the result will be rendered. Defaults to account time zone.
15
- #
16
- # ==== Returns
17
- # * 'alerts'<~Array><~Alerts>
18
- # * 'id'<~String>
19
- # * 'type'<~String>
20
- # * 'started_at'<~String>
21
- # * 'user'<~Pagerduty::User>
22
- # * 'id'<~String>
23
- # * 'name'<~String>
24
- # * 'email'<~String>
25
- # * 'time_zone'<~String>
26
- # * 'color'<~String>
27
- # * 'avatar_url'<~String>
28
- # * 'user_url'<~String>
29
- # * 'invitation_sent'<~Boolean>
30
- # * 'marketing'<~String>
31
- # * 'marketing_opt_out'<~String>
32
- # * 'type'<~String>
33
- #
34
- # {Pagerduty API Reference}[http://developer.pagerduty.com/documentation/rest/alerts/list]
35
- def self.alerts(options={})
36
-
37
- unless has_requirements? [:since, :until], options
38
- puts "#> This function requires arguments :since, :until"
39
- puts "Please see: http://developer.pagerduty.com/documentation/rest/alerts/list"
40
- return
41
- end
42
-
43
- Pagerduty::Alerts.new(curl({
44
- uri: "https://#{Pagerduty.class_variable_get(:@@subdomain)}.pagerduty.com/api/v1/alerts",
45
- params: options,
46
- method: 'GET'
47
- }))
48
- end
49
-
50
-
51
- end
52
- end
53
- end
1
+ class Pagerduty
2
+ module Requests
3
+ module Alerts
4
+
5
+ extend Pagerduty::Core
6
+
7
+ # List existing alerts for a given time range, optionally filtered by type (SMS, Email, Phone, or Push)
8
+ #
9
+ # ==== Parameters
10
+ # * params<~Hash>
11
+ # * 'since'<~String>: The start of the date range over which you want to search. The time element is optional.
12
+ # * 'until'<~String>: The end of the date range over which you want to search. This should be in the same format as since. The size of the date range must be less than 3 months.
13
+ # * 'filter'<~String>: Returns only the alerts of the said types. Can be one of SMS, Email, Phone, or Push.
14
+ # * 'time_zone'<~TimeZone>: Time zone in which dates in the result will be rendered. Defaults to account time zone.
15
+ #
16
+ # ==== Returns
17
+ # * 'alerts'<~Array><~Alerts>
18
+ # * 'id'<~String>
19
+ # * 'type'<~String>
20
+ # * 'started_at'<~String>
21
+ # * 'user'<~Pagerduty::User>
22
+ # * 'id'<~String>
23
+ # * 'name'<~String>
24
+ # * 'email'<~String>
25
+ # * 'time_zone'<~String>
26
+ # * 'color'<~String>
27
+ # * 'avatar_url'<~String>
28
+ # * 'user_url'<~String>
29
+ # * 'invitation_sent'<~Boolean>
30
+ # * 'marketing'<~String>
31
+ # * 'marketing_opt_out'<~String>
32
+ # * 'type'<~String>
33
+ #
34
+ # {Pagerduty API Reference}[http://developer.pagerduty.com/documentation/rest/alerts/list]
35
+ def self.alerts(options={})
36
+
37
+ unless has_requirements? [:since, :until], options
38
+ puts "#> This function requires arguments :since, :until"
39
+ puts "Please see: http://developer.pagerduty.com/documentation/rest/alerts/list"
40
+ return
41
+ end
42
+
43
+ Pagerduty::Alerts.new(curl({
44
+ uri: "https://#{Pagerduty.class_variable_get(:@@subdomain)}.pagerduty.com/api/v1/alerts",
45
+ params: options,
46
+ method: 'GET'
47
+ }))
48
+ end
49
+
50
+
51
+ end
52
+ end
53
+ end
@@ -1,69 +1,69 @@
1
- class Pagerduty
2
- class Incidents
3
- class Incident
4
- include Pagerduty::Core
5
-
6
- def initialize(options={})
7
- super
8
- @@subdomain = Pagerduty.class_variable_get(:@@subdomain)
9
- end
10
-
11
- def inspect
12
- puts "<Pagerduty::#{self.class}"
13
- self.attributes.each { |attr,val|
14
- puts "\t#{attr}=#{val.class == Class ? "BLOCK" : val.inspect}"
15
- }
16
- puts ">"
17
-
18
- self.attributes
19
- end
20
-
21
- def notes
22
- Notes.new(curl({
23
- uri: "https://#@@subdomain.pagerduty.com/api/v1/incidents/#{self.id}/notes",
24
- method: 'GET'
25
- }))
26
- end
27
-
28
- def acknowledge
29
- curl({
30
- uri: "https://#@@subdomain.pagerduty.com/api/v1/incidents/#{self.id}/acknowledge",
31
- data: { 'requester_id' => self.assigned_to_user.id },
32
- method: 'PUT'
33
- })
34
- end
35
-
36
- def resolve
37
- curl({
38
- uri: "https://#@@subdomain.pagerduty.com/api/v1/incidents/#{self.id}/resolve",
39
- data: { 'requester_id' => self.assigned_to_user.id },
40
- method: 'PUT'
41
- })
42
- end
43
-
44
- def reassign(options={})
45
- curl({
46
- uri: "https://#@@subdomain.pagerduty.com/api/v1/incidents/#{self.id}/resolve",
47
- data: { 'requester_id' => self.assigned_to_user.id, }.merge(options),
48
- method: 'PUT'
49
- })
50
- end
51
-
52
- self.instance_eval do
53
- %w(triggered open acknowledged resolved).each do |status|
54
- define_method("#{status}?") { self.status == "#{status}" }
55
- end
56
- end
57
-
58
-
59
- def log_entries(options={})
60
- LogEntries.new(curl({
61
- uri: "https://#@@subdomain.pagerduty.com/api/v1/incidents/#{self.id}/log_entries",
62
- params: options,
63
- method: 'GET'
64
- }))
65
- end
66
-
67
- end
68
- end
69
- end
1
+ class Pagerduty
2
+ class Incidents
3
+ class Incident
4
+ include Pagerduty::Core
5
+
6
+ def initialize(options={})
7
+ super
8
+ @@subdomain = Pagerduty.class_variable_get(:@@subdomain)
9
+ end
10
+
11
+ def inspect
12
+ puts "<Pagerduty::#{self.class}"
13
+ self.attributes.each { |attr,val|
14
+ puts "\t#{attr}=#{val.class == Class ? "BLOCK" : val.inspect}"
15
+ }
16
+ puts ">"
17
+
18
+ self.attributes
19
+ end
20
+
21
+ def notes
22
+ Notes.new(curl({
23
+ uri: "https://#@@subdomain.pagerduty.com/api/v1/incidents/#{self.id}/notes",
24
+ method: 'GET'
25
+ }))
26
+ end
27
+
28
+ def acknowledge
29
+ curl({
30
+ uri: "https://#@@subdomain.pagerduty.com/api/v1/incidents/#{self.id}/acknowledge",
31
+ data: { 'requester_id' => self.assigned_to_user.id },
32
+ method: 'PUT'
33
+ })
34
+ end
35
+
36
+ def resolve
37
+ curl({
38
+ uri: "https://#@@subdomain.pagerduty.com/api/v1/incidents/#{self.id}/resolve",
39
+ data: { 'requester_id' => self.assigned_to_user.id },
40
+ method: 'PUT'
41
+ })
42
+ end
43
+
44
+ def reassign(options={})
45
+ curl({
46
+ uri: "https://#@@subdomain.pagerduty.com/api/v1/incidents/#{self.id}/resolve",
47
+ data: { 'requester_id' => self.assigned_to_user.id, }.merge(options),
48
+ method: 'PUT'
49
+ })
50
+ end
51
+
52
+ self.instance_eval do
53
+ %w(triggered open acknowledged resolved).each do |status|
54
+ define_method("#{status}?") { self.status == "#{status}" }
55
+ end
56
+ end
57
+
58
+
59
+ def log_entries(options={})
60
+ LogEntries.new(curl({
61
+ uri: "https://#@@subdomain.pagerduty.com/api/v1/incidents/#{self.id}/log_entries",
62
+ params: options,
63
+ method: 'GET'
64
+ }))
65
+ end
66
+
67
+ end
68
+ end
69
+ end
@@ -1,74 +1,74 @@
1
- class Pagerduty
2
-
3
- # Your monitoring tools should send PagerDuty a trigger event to report a new or ongoing problem. When PagerDuty receives a trigger event, it will either open a new incident, or add a new trigger log entry to an existing incident, depending on the provided incident_key
4
- #
5
- # ==== Parameters
6
- # * options<~Hash>:
7
- # * 'service_key'<~String> - The GUID of one of your "Generic API" services. This is the "service key" listed on a Generic API's service detail page
8
- # * 'description'<~String> - A short description of the problem that led to this trigger. This field (or a truncated version) will be used when generating phone calls, SMS messages and alert emails. It will also appear on the incidents tables in the PagerDuty UI. The maximum length is 1024 characters
9
- # * 'incident_key'<~String> - Identifies the incident to which this trigger event should be applied. If there's no open (i.e. unresolved) incident with this key, a new one will be created. If there's already an open incident with a matching key, this event will be appended to that incident's log. The event key provides an easy way to "de-dup" problem reports. If this field isn't provided, PagerDuty will automatically open a new incident with a unique key
10
- # * 'details'<~Hash> - Any data you'd like included in the incident log
11
- #
12
- # ==== Returns
13
- # * <~Pagerduty::Integration>
14
- # * 'status'<~String>
15
- # * 'incident_key'<~String>
16
- # * 'message'<~String>
17
- #
18
- # {Pagerduty API Reference}[http://developer.pagerduty.com/documentation/integration/events/trigger]
19
- def trigger(options={})
20
- Pagerduty::Integration.new(curl({
21
- uri: 'https://events.pagerduty.com/generic/2010-04-15/create_event.json',
22
- data: options.merge({event_type: 'trigger'}),
23
- method: 'POST'
24
- }))
25
- end
26
-
27
- # Acknowledge events cause the referenced incident to enter the acknowledged state
28
- #
29
- # ==== Parameters
30
- # * options<~Hash>:
31
- # * 'service_key'<~String> - The GUID of one of your "Generic API" services. This is the "service key" listed on a Generic API's service detail page
32
- # * 'description'<~String> - Text that will appear in the incident's log associated with this event.
33
- # * 'incident_key'<~String> - Identifies the incident to acknowledge. This should be the incident_key you received back when the incident was first opened by a trigger event. Acknowledge events referencing resolved or nonexistent incidents will be discarded
34
- # * 'details'<~Hash> - Any data you'd like included in the incident log
35
- #
36
- # ==== Returns
37
- # * <~Pagerduty::Integration>
38
- # * 'status'<~String>
39
- # * 'incident_key'<~String>
40
- # * 'message'<~String>
41
- #
42
- # {Pagerduty API Reference}[http://developer.pagerduty.com/documentation/integration/events/trigger]
43
- def acknowledge(options={})
44
- Pagerduty::Integration.new(curl({
45
- uri: 'https://events.pagerduty.com/generic/2010-04-15/create_event.json',
46
- data: options.merge({event_type: 'acknowledge'}),
47
- method: 'POST'
48
- }))
49
- end
50
-
51
- # Resolve events cause the referenced incident to enter the resolved state
52
- #
53
- # ==== Parameters
54
- # * options<~Hash>:
55
- # * 'service_key'<~String> - The GUID of one of your "Generic API" services. This is the "service key" listed on a Generic API's service detail page
56
- # * 'description'<~String> - Text that will appear in the incident's log associated with this event.
57
- # * 'incident_key'<~String> - Identifies the incident to acknowledge. This should be the incident_key you received back when the incident was first opened by a trigger event. Acknowledge events referencing resolved or nonexistent incidents will be discarded
58
- # * 'details'<~Hash> - Any data you'd like included in the incident log
59
- #
60
- # ==== Returns
61
- # * <~Pagerduty::Integration>
62
- # * 'status'<~String>
63
- # * 'incident_key'<~String>
64
- # * 'message'<~String>
65
- #
66
- # {Pagerduty API Reference}[http://developer.pagerduty.com/documentation/integration/events/trigger]
67
- def resolve(options={})
68
- Pagerduty::Integration.new(curl({
69
- uri: 'https://events.pagerduty.com/generic/2010-04-15/create_event.json',
70
- data: options.merge({event_type: 'resolve'}),
71
- method: 'POST'
72
- }))
73
- end
74
- end
1
+ class Pagerduty
2
+
3
+ # Your monitoring tools should send PagerDuty a trigger event to report a new or ongoing problem. When PagerDuty receives a trigger event, it will either open a new incident, or add a new trigger log entry to an existing incident, depending on the provided incident_key
4
+ #
5
+ # ==== Parameters
6
+ # * options<~Hash>:
7
+ # * 'service_key'<~String> - The GUID of one of your "Generic API" services. This is the "service key" listed on a Generic API's service detail page
8
+ # * 'description'<~String> - A short description of the problem that led to this trigger. This field (or a truncated version) will be used when generating phone calls, SMS messages and alert emails. It will also appear on the incidents tables in the PagerDuty UI. The maximum length is 1024 characters
9
+ # * 'incident_key'<~String> - Identifies the incident to which this trigger event should be applied. If there's no open (i.e. unresolved) incident with this key, a new one will be created. If there's already an open incident with a matching key, this event will be appended to that incident's log. The event key provides an easy way to "de-dup" problem reports. If this field isn't provided, PagerDuty will automatically open a new incident with a unique key
10
+ # * 'details'<~Hash> - Any data you'd like included in the incident log
11
+ #
12
+ # ==== Returns
13
+ # * <~Pagerduty::Integration>
14
+ # * 'status'<~String>
15
+ # * 'incident_key'<~String>
16
+ # * 'message'<~String>
17
+ #
18
+ # {Pagerduty API Reference}[http://developer.pagerduty.com/documentation/integration/events/trigger]
19
+ def trigger(options={})
20
+ Pagerduty::Integration.new(curl({
21
+ uri: 'https://events.pagerduty.com/generic/2010-04-15/create_event.json',
22
+ data: options.merge({event_type: 'trigger'}),
23
+ method: 'POST'
24
+ }))
25
+ end
26
+
27
+ # Acknowledge events cause the referenced incident to enter the acknowledged state
28
+ #
29
+ # ==== Parameters
30
+ # * options<~Hash>:
31
+ # * 'service_key'<~String> - The GUID of one of your "Generic API" services. This is the "service key" listed on a Generic API's service detail page
32
+ # * 'description'<~String> - Text that will appear in the incident's log associated with this event.
33
+ # * 'incident_key'<~String> - Identifies the incident to acknowledge. This should be the incident_key you received back when the incident was first opened by a trigger event. Acknowledge events referencing resolved or nonexistent incidents will be discarded
34
+ # * 'details'<~Hash> - Any data you'd like included in the incident log
35
+ #
36
+ # ==== Returns
37
+ # * <~Pagerduty::Integration>
38
+ # * 'status'<~String>
39
+ # * 'incident_key'<~String>
40
+ # * 'message'<~String>
41
+ #
42
+ # {Pagerduty API Reference}[http://developer.pagerduty.com/documentation/integration/events/trigger]
43
+ def acknowledge(options={})
44
+ Pagerduty::Integration.new(curl({
45
+ uri: 'https://events.pagerduty.com/generic/2010-04-15/create_event.json',
46
+ data: options.merge({event_type: 'acknowledge'}),
47
+ method: 'POST'
48
+ }))
49
+ end
50
+
51
+ # Resolve events cause the referenced incident to enter the resolved state
52
+ #
53
+ # ==== Parameters
54
+ # * options<~Hash>:
55
+ # * 'service_key'<~String> - The GUID of one of your "Generic API" services. This is the "service key" listed on a Generic API's service detail page
56
+ # * 'description'<~String> - Text that will appear in the incident's log associated with this event.
57
+ # * 'incident_key'<~String> - Identifies the incident to acknowledge. This should be the incident_key you received back when the incident was first opened by a trigger event. Acknowledge events referencing resolved or nonexistent incidents will be discarded
58
+ # * 'details'<~Hash> - Any data you'd like included in the incident log
59
+ #
60
+ # ==== Returns
61
+ # * <~Pagerduty::Integration>
62
+ # * 'status'<~String>
63
+ # * 'incident_key'<~String>
64
+ # * 'message'<~String>
65
+ #
66
+ # {Pagerduty API Reference}[http://developer.pagerduty.com/documentation/integration/events/trigger]
67
+ def resolve(options={})
68
+ Pagerduty::Integration.new(curl({
69
+ uri: 'https://events.pagerduty.com/generic/2010-04-15/create_event.json',
70
+ data: options.merge({event_type: 'resolve'}),
71
+ method: 'POST'
72
+ }))
73
+ end
74
+ end
@@ -1,26 +1,26 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'pagerduty/core'
5
- require 'pagerduty/pagerduty'
6
-
7
- Gem::Specification.new do |gem|
8
- gem.name = "pagerduty-sdk"
9
- gem.version = '1.0.6'
10
- gem.authors = ["Alfred Moreno"]
11
- gem.email = ["kryptek@gmail.com"]
12
- gem.description = %q{An SDK for Pagerduty's API}
13
- gem.summary = %q{An SDK for communication with the entire Pagerduty API}
14
- gem.homepage = "https://github.com/kryptek/pagerduty-sdk"
15
-
16
- gem.files = `git ls-files`.split($/)
17
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
- gem.require_paths = ["lib"]
20
-
21
- gem.add_dependency 'activesupport'
22
- gem.add_dependency 'json'
23
- gem.add_dependency 'virtus'
24
-
25
- gem.license = 'MIT'
26
- end
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'pagerduty/core'
5
+ require 'pagerduty/pagerduty'
6
+
7
+ Gem::Specification.new do |gem|
8
+ gem.name = "pagerduty-sdk"
9
+ gem.version = '1.0.9'
10
+ gem.authors = ["Alfred Moreno"]
11
+ gem.email = ["kryptek@gmail.com"]
12
+ gem.description = %q{An SDK for Pagerduty's API}
13
+ gem.summary = %q{An SDK for communication with the entire Pagerduty API}
14
+ gem.homepage = "https://github.com/kryptek/pagerduty-sdk"
15
+
16
+ gem.files = `git ls-files`.split($/)
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.require_paths = ["lib"]
20
+
21
+ gem.add_dependency 'activesupport'
22
+ gem.add_dependency 'json'
23
+ gem.add_dependency 'virtus'
24
+
25
+ gem.license = 'MIT'
26
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagerduty-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alfred Moreno
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-30 00:00:00.000000000 Z
11
+ date: 2016-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  requirements: []
114
114
  rubyforge_project:
115
- rubygems_version: 2.3.0
115
+ rubygems_version: 2.4.5.1
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: An SDK for communication with the entire Pagerduty API