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,18 +1,18 @@
1
- class Pagerduty
2
- class Incidents
3
- include Virtus.model
4
-
5
- attribute :incidents, Array[Pagerduty::Incidents::Incident]
6
-
7
- self.instance_eval do
8
- %w(triggered open acknowledged resolved).each do |status|
9
- define_method(status) {
10
- self.incidents.select { |incident|
11
- incident.status == "#{status}"
12
- }
13
- }
14
- end
15
- end
16
-
17
- end
18
- end
1
+ class Pagerduty
2
+ class Incidents
3
+ include Virtus.model
4
+
5
+ attribute :incidents, Array[Pagerduty::Incidents::Incident]
6
+
7
+ self.instance_eval do
8
+ %w(triggered open acknowledged resolved).each do |status|
9
+ define_method(status) {
10
+ self.incidents.select { |incident|
11
+ incident.status == "#{status}"
12
+ }
13
+ }
14
+ end
15
+ end
16
+
17
+ end
18
+ end
@@ -1,9 +1,9 @@
1
- class Pagerduty
2
- class Integration
3
- include Virtus.model
4
-
5
- attribute :status
6
- attribute :message
7
- attribute :incident_key
8
- end
9
- end
1
+ class Pagerduty
2
+ class Integration
3
+ include Virtus.model
4
+
5
+ attribute :status
6
+ attribute :message
7
+ attribute :incident_key
8
+ end
9
+ end
@@ -1,9 +1,9 @@
1
- class LastStatusChangeBy
2
- include Virtus.model
3
-
4
- attribute :id
5
- attribute :name
6
- attribute :email
7
- attribute :html_url
8
- end
9
-
1
+ class LastStatusChangeBy
2
+ include Virtus.model
3
+
4
+ attribute :id
5
+ attribute :name
6
+ attribute :email
7
+ attribute :html_url
8
+ end
9
+
@@ -1,22 +1,22 @@
1
- class Pagerduty
2
- class LogEntry
3
- include Virtus.model
4
-
5
- attribute :id
6
- attribute :type
7
- attribute :created_at
8
- attribute :note
9
- attribute :agent, Pagerduty::User
10
- attribute :user, Pagerduty::User
11
- attribute :channel
12
- end
13
- end
14
-
15
- class LogEntries
16
- include Virtus.model
17
-
18
- attribute :log_entries, Array[Pagerduty::LogEntry]
19
- attribute :limit
20
- attribute :offset
21
- attribute :total
22
- end
1
+ class Pagerduty
2
+ class LogEntry
3
+ include Virtus.model
4
+
5
+ attribute :id
6
+ attribute :type
7
+ attribute :created_at
8
+ attribute :note
9
+ attribute :agent, Pagerduty::User
10
+ attribute :user, Pagerduty::User
11
+ attribute :channel
12
+ end
13
+ end
14
+
15
+ class LogEntries
16
+ include Virtus.model
17
+
18
+ attribute :log_entries, Array[Pagerduty::LogEntry]
19
+ attribute :limit
20
+ attribute :offset
21
+ attribute :total
22
+ end
@@ -1,66 +1,66 @@
1
- class Pagerduty
2
- class MaintenanceWindow < Pagerduty
3
- include Virtus.model
4
-
5
- attribute :id
6
- attribute :sequence_number
7
- attribute :start_time
8
- attribute :end_time
9
- attribute :description
10
- attribute :created_by, Pagerduty::User
11
- attribute :services, Array[Service]
12
- attribute :service_ids
13
-
14
- class Count
15
- include Virtus.model
16
-
17
- attribute :ongoing
18
- attribute :future
19
- attribute :past
20
- attribute :all
21
- end
22
-
23
- def initialize(attributes)
24
- self.attributes = attributes
25
- self.service_ids = self.services.map(&:id)
26
- end
27
-
28
- def save(options={})
29
- Pagerduty::MaintenanceWindow.new(JSON.parse(curl({
30
- uri: "https://#@@subdomain.pagerduty.com/api/v1/maintenance_windows/#{self.id}",
31
- data: {
32
- start_time: self.start_time,
33
- end_time: self.end_time,
34
- description: self.description,
35
- service_ids: self.service_ids
36
- },
37
- method: 'PUT'
38
- }).body)['maintenance_window'])
39
- end
40
-
41
- def delete
42
- res = curl({
43
- uri: "https://#@@subdomain.pagerduty.com/api/v1/maintenance_windows/#{self.id}",
44
- method: 'DELETE'
45
- })
46
-
47
- res.code == '204' ? "Successfully deleted Maintenance Window #{self.id}" : JSON.parse(response.body)
48
-
49
- end
50
-
51
- end
52
- end
53
-
54
- class Pagerduty
55
- class MaintenanceWindows
56
- include Virtus.model
57
-
58
- attribute :maintenance_windows, Array[Pagerduty::MaintenanceWindow]
59
- attribute :limit
60
- attribute :offset
61
- attribute :total
62
- attribute :query
63
- attribute :counts, Pagerduty::MaintenanceWindow::Count
64
-
65
- end
66
- end
1
+ class Pagerduty
2
+ class MaintenanceWindow < Pagerduty
3
+ include Virtus.model
4
+
5
+ attribute :id
6
+ attribute :sequence_number
7
+ attribute :start_time
8
+ attribute :end_time
9
+ attribute :description
10
+ attribute :created_by, Pagerduty::User
11
+ attribute :services, Array[Service]
12
+ attribute :service_ids
13
+
14
+ class Count
15
+ include Virtus.model
16
+
17
+ attribute :ongoing
18
+ attribute :future
19
+ attribute :past
20
+ attribute :all
21
+ end
22
+
23
+ def initialize(attributes)
24
+ self.attributes = attributes
25
+ self.service_ids = self.services.map(&:id)
26
+ end
27
+
28
+ def save(options={})
29
+ Pagerduty::MaintenanceWindow.new(JSON.parse(curl({
30
+ uri: "https://#@@subdomain.pagerduty.com/api/v1/maintenance_windows/#{self.id}",
31
+ data: {
32
+ start_time: self.start_time,
33
+ end_time: self.end_time,
34
+ description: self.description,
35
+ service_ids: self.service_ids
36
+ },
37
+ method: 'PUT'
38
+ }).body)['maintenance_window'])
39
+ end
40
+
41
+ def delete
42
+ res = curl({
43
+ uri: "https://#@@subdomain.pagerduty.com/api/v1/maintenance_windows/#{self.id}",
44
+ method: 'DELETE'
45
+ })
46
+
47
+ res['code'] == '204' ? "Successfully deleted Maintenance Window #{self.id}" : res
48
+
49
+ end
50
+
51
+ end
52
+ end
53
+
54
+ class Pagerduty
55
+ class MaintenanceWindows
56
+ include Virtus.model
57
+
58
+ attribute :maintenance_windows, Array[Pagerduty::MaintenanceWindow]
59
+ attribute :limit
60
+ attribute :offset
61
+ attribute :total
62
+ attribute :query
63
+ attribute :counts, Pagerduty::MaintenanceWindow::Count
64
+
65
+ end
66
+ end
@@ -1,9 +1,9 @@
1
- class Note
2
- include Virtus.model
3
-
4
- attribute :id
5
- attribute :user, Pagerduty::User
6
- attribute :content
7
- attribute :created_at
8
- end
9
-
1
+ class Note
2
+ include Virtus.model
3
+
4
+ attribute :id
5
+ attribute :user, Pagerduty::User
6
+ attribute :content
7
+ attribute :created_at
8
+ end
9
+
@@ -1,7 +1,7 @@
1
- class Notes
2
- include Virtus.model
3
-
4
- attribute :notes, Array[Note]
5
- end
6
-
7
-
1
+ class Notes
2
+ include Virtus.model
3
+
4
+ attribute :notes, Array[Note]
5
+ end
6
+
7
+
@@ -1,7 +1,7 @@
1
- class Notification
2
- include Virtus.model
3
-
4
- attribute :type
5
- attribute :address
6
- attribute :status
7
- end
1
+ class Notification
2
+ include Virtus.model
3
+
4
+ attribute :type
5
+ attribute :address
6
+ attribute :status
7
+ end
@@ -1,54 +1,54 @@
1
- class Pagerduty
2
- class Reports
3
- class Alert
4
- include Virtus.model
5
-
6
- attribute :number_of_alerts
7
- attribute :number_of_phone_alerts
8
- attribute :number_of_sms_alerts
9
- attribute :number_of_email_alerts
10
- attribute :start
11
- attribute :end
12
- end
13
- end
14
- end
15
-
16
- class Pagerduty
17
- class Reports
18
- class Incident
19
- include Virtus.model
20
-
21
- attribute :start
22
- attribute :number_of_incidents
23
- attribute :end
24
- end
25
- end
26
- end
27
-
28
- class Pagerduty
29
- class Reports
30
- class Incidents
31
- include Virtus.model
32
-
33
- attribute :incidents, Array[Pagerduty::Reports::Incident]
34
- end
35
- end
36
- end
37
-
38
- class Pagerduty
39
- class Reports
40
- class Alerts
41
-
42
- include Virtus.model
43
-
44
- attribute :alerts, Array[Pagerduty::Reports::Alert]
45
- attribute :total_number_of_alerts
46
- attribute :total_number_of_phone_alerts
47
- attribute :total_number_of_sms_alerts
48
- attribute :total_number_of_email_alerts
49
- attribute :total_number_of_billable_alerts
50
- end
51
- end
52
-
53
- end
54
-
1
+ class Pagerduty
2
+ class Reports
3
+ class Alert
4
+ include Virtus.model
5
+
6
+ attribute :number_of_alerts
7
+ attribute :number_of_phone_alerts
8
+ attribute :number_of_sms_alerts
9
+ attribute :number_of_email_alerts
10
+ attribute :start
11
+ attribute :end
12
+ end
13
+ end
14
+ end
15
+
16
+ class Pagerduty
17
+ class Reports
18
+ class Incident
19
+ include Virtus.model
20
+
21
+ attribute :start
22
+ attribute :number_of_incidents
23
+ attribute :end
24
+ end
25
+ end
26
+ end
27
+
28
+ class Pagerduty
29
+ class Reports
30
+ class Incidents
31
+ include Virtus.model
32
+
33
+ attribute :incidents, Array[Pagerduty::Reports::Incident]
34
+ end
35
+ end
36
+ end
37
+
38
+ class Pagerduty
39
+ class Reports
40
+ class Alerts
41
+
42
+ include Virtus.model
43
+
44
+ attribute :alerts, Array[Pagerduty::Reports::Alert]
45
+ attribute :total_number_of_alerts
46
+ attribute :total_number_of_phone_alerts
47
+ attribute :total_number_of_sms_alerts
48
+ attribute :total_number_of_email_alerts
49
+ attribute :total_number_of_billable_alerts
50
+ end
51
+ end
52
+
53
+ end
54
+
@@ -1,9 +1,9 @@
1
- class ResolvedByUser
2
- include Virtus.model
3
-
4
- attribute :id
5
- attribute :name
6
- attribute :email
7
- attribute :html_url
8
- end
9
-
1
+ class ResolvedByUser
2
+ include Virtus.model
3
+
4
+ attribute :id
5
+ attribute :name
6
+ attribute :email
7
+ attribute :html_url
8
+ end
9
+
@@ -1,109 +1,124 @@
1
- class Pagerduty
2
- class Schedules
3
- class Schedule
4
- include Virtus.model
5
-
6
- attribute :id
7
- attribute :name
8
- attribute :time_zone
9
- attribute :today
10
- attribute :escalation_policies, Array[EscalationPolicy]
11
- end
12
- end
13
- end
14
-
15
- class Pagerduty
16
- class Schedules
17
- class ScheduleLayer
18
- class User
19
- include Virtus.model
20
-
21
- attribute :member_order
22
- attribute :user, Pagerduty::User
23
- end
24
- end
25
- end
26
- end
27
-
28
- class Pagerduty
29
- class Schedules
30
- class Restriction
31
- include Virtus.model
32
-
33
- attribute :start_time_of_day
34
- attribute :duration_seconds
35
- end
36
- end
37
- end
38
-
39
- class Pagerduty
40
- class Schedules
41
- class ScheduleLayer
42
- include Virtus.model
43
-
44
- attribute :name
45
- attribute :rendered_schedule_entries, Array
46
- attribute :id
47
- attribute :priority
48
- attribute :start
49
- attribute :end
50
- attribute :restriction_type
51
- attribute :rotation_virtual_start
52
- attribute :rotation_turn_length_seconds
53
- attribute :users, Array[Pagerduty::Schedules::ScheduleLayer::User]
54
- attribute :restrictions, Array[Pagerduty::Schedules::Restriction]
55
- attribute :rendered_coverage_percentage
56
-
57
- end
58
- end
59
- end
60
-
61
- class Pagerduty
62
- class Schedules
63
- include Virtus.model
64
-
65
- attribute :schedules, Array[Pagerduty::Schedules::Schedule]
66
- attribute :limit
67
- attribute :offset
68
- attribute :total
69
- end
70
- end
71
-
72
- class Pagerduty
73
- class Schedules
74
- class Override
75
- include Virtus.model
76
-
77
- attribute :name
78
- attribute :rendered_schedule_entries, Array[Pagerduty::Schedules::ScheduleLayer]
79
- end
80
- end
81
- end
82
-
83
- class Pagerduty
84
- class Schedules
85
- class FinalSchedule
86
- include Virtus.model
87
-
88
- attribute :name
89
- attribute :rendered_schedule_entries, Array[Pagerduty::Schedules::ScheduleLayer]
90
- attribute :rendered_coverage_percentage
91
- end
92
- end
93
- end
94
-
95
- class Pagerduty
96
- class ScheduleInfo
97
- include Virtus.model
98
-
99
- attribute :id
100
- attribute :name
101
- attribute :time_zone
102
- attribute :today
103
- attribute :escalation_policies, Array[EscalationPolicy]
104
- attribute :schedule_layers, Array[Pagerduty::Schedules::ScheduleLayer]
105
- attribute :overrides_subschedule, Pagerduty::Schedules::Override
106
- attribute :final_schedule, Pagerduty::Schedules::FinalSchedule
107
-
108
- end
109
- end
1
+ class Pagerduty
2
+ class Schedules
3
+ class Schedule
4
+ include Virtus.model
5
+
6
+ attribute :id
7
+ attribute :name
8
+ attribute :time_zone
9
+ attribute :today
10
+ attribute :escalation_policies, Array[EscalationPolicy]
11
+ end
12
+ end
13
+ end
14
+
15
+ class Pagerduty
16
+ class Schedules
17
+ class ScheduleLayer
18
+ class User
19
+ include Virtus.model
20
+
21
+ attribute :member_order
22
+ attribute :user, Pagerduty::User
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ class Pagerduty
29
+ class Schedules
30
+ class Restriction
31
+ include Virtus.model
32
+
33
+ attribute :start_time_of_day
34
+ attribute :duration_seconds
35
+ end
36
+ end
37
+ end
38
+
39
+ class Pagerduty
40
+ class Schedules
41
+ class ScheduleLayer
42
+ include Virtus.model
43
+
44
+ attribute :name
45
+ attribute :rendered_schedule_entries, Array
46
+ attribute :id
47
+ attribute :priority
48
+ attribute :start
49
+ attribute :end
50
+ attribute :restriction_type
51
+ attribute :rotation_virtual_start
52
+ attribute :rotation_turn_length_seconds
53
+ attribute :users, Array[Pagerduty::Schedules::ScheduleLayer::User]
54
+ attribute :restrictions, Array[Pagerduty::Schedules::Restriction]
55
+ attribute :rendered_coverage_percentage
56
+
57
+ end
58
+ end
59
+ end
60
+
61
+ class Pagerduty
62
+ class Schedules
63
+ include Virtus.model
64
+
65
+ attribute :schedules, Array[Pagerduty::Schedules::Schedule]
66
+ attribute :limit
67
+ attribute :offset
68
+ attribute :total
69
+ end
70
+ end
71
+
72
+ class Pagerduty
73
+ class Schedules
74
+ class Override
75
+ include Virtus.model
76
+
77
+ attribute :name
78
+ attribute :rendered_schedule_entries, Array[Pagerduty::Schedules::ScheduleLayer]
79
+ end
80
+ end
81
+ end
82
+
83
+ class Pagerduty
84
+ class Schedules
85
+ class Overrides
86
+ class Override
87
+ include Virtus.model
88
+
89
+ attribute :id
90
+ attribute :start
91
+ attribute :end
92
+ attribute :user, Pagerduty::User
93
+ end
94
+ end
95
+ end
96
+ end
97
+
98
+ class Pagerduty
99
+ class Schedules
100
+ class FinalSchedule
101
+ include Virtus.model
102
+
103
+ attribute :name
104
+ attribute :rendered_schedule_entries, Array[Pagerduty::Schedules::ScheduleLayer]
105
+ attribute :rendered_coverage_percentage
106
+ end
107
+ end
108
+ end
109
+
110
+ class Pagerduty
111
+ class ScheduleInfo
112
+ include Virtus.model
113
+
114
+ attribute :id
115
+ attribute :name
116
+ attribute :time_zone
117
+ attribute :today
118
+ attribute :escalation_policies, Array[EscalationPolicy]
119
+ attribute :schedule_layers, Array[Pagerduty::Schedules::ScheduleLayer]
120
+ attribute :overrides_subschedule, Pagerduty::Schedules::Override
121
+ attribute :final_schedule, Pagerduty::Schedules::FinalSchedule
122
+
123
+ end
124
+ end