pagerduty 2.1.2 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +305 -0
- data/README.md +2 -25
- data/lib/pagerduty.rb +6 -4
- data/lib/pagerduty/http_transport.rb +5 -3
- data/lib/pagerduty/version.rb +3 -1
- metadata +14 -25
- data/.gitignore +0 -9
- data/.rubocop.yml +0 -38
- data/.travis.yml +0 -9
- data/Gemfile +0 -4
- data/Rakefile +0 -12
- data/pagerduty.gemspec +0 -26
- data/script/setup.sh +0 -8
- data/spec/pagerduty/http_transport_spec.rb +0 -131
- data/spec/pagerduty_spec.rb +0 -363
- data/spec/spec_helper.rb +0 -13
- data/spec/support/warnings.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d72d062459cac16c3caf4d7f16441317cb9f9321cdea1c22e159b0babc66104e
|
4
|
+
data.tar.gz: f0f3f0774ea4c23775f71b15165b709f5b39d6a42ea8b8cdfecefd189b2f6de4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaf6d784d1aafc96ab531bab1654f084b741ae60ff829409544455b05691b7244c395e9a4dc503d3ec48149281ff2782d8aac61e625784213d568b53af9f63da
|
7
|
+
data.tar.gz: dd8d7ef4981e8504c0ceec06dceb783b03622dbf44dfbd0a47abe8bd4737099122d23f71679ed5fbbf6e9831c498dfa57a3e6273d422a75839ae09189b11f2fe
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,305 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog], and this project adheres to
|
6
|
+
[Semantic Versioning].
|
7
|
+
|
8
|
+
[Keep a Changelog]: https://keepachangelog.com/en/1.0.0/
|
9
|
+
[Semantic Versioning]: https://semver.org/spec/v2.0.0.html
|
10
|
+
|
11
|
+
## [Unreleased]
|
12
|
+
|
13
|
+
[Unreleased]: https://github.com/envato/pagerduty/compare/v2.1.3...HEAD
|
14
|
+
|
15
|
+
## [2.1.3] - 2020-02-10
|
16
|
+
|
17
|
+
### Added
|
18
|
+
|
19
|
+
- Test against Ruby 2.6 and 2.7 in CI ([#55], [#63]).
|
20
|
+
|
21
|
+
- Add project metadata to the gemspec ([#57]).
|
22
|
+
|
23
|
+
- A downloads badge to the readme ([#58]).
|
24
|
+
|
25
|
+
- This changelog document ([#59]).
|
26
|
+
|
27
|
+
### Fixed
|
28
|
+
|
29
|
+
- Realign with latest Rubocop style ([#54], [#62]).
|
30
|
+
|
31
|
+
### Removed
|
32
|
+
|
33
|
+
- Test files are no longer included in the gem file ([#60]).
|
34
|
+
|
35
|
+
[2.1.3]: https://github.com/envato/pagerduty/compare/v2.1.2...v2.1.3
|
36
|
+
[#54]: https://github.com/envato/pagerduty/pull/54
|
37
|
+
[#55]: https://github.com/envato/pagerduty/pull/55
|
38
|
+
[#57]: https://github.com/envato/pagerduty/pull/57
|
39
|
+
[#58]: https://github.com/envato/pagerduty/pull/58
|
40
|
+
[#59]: https://github.com/envato/pagerduty/pull/59
|
41
|
+
[#60]: https://github.com/envato/pagerduty/pull/60
|
42
|
+
[#62]: https://github.com/envato/pagerduty/pull/62
|
43
|
+
[#63]: https://github.com/envato/pagerduty/pull/63
|
44
|
+
|
45
|
+
## [2.1.2] - 2018-09-18
|
46
|
+
|
47
|
+
### Fixed
|
48
|
+
|
49
|
+
- Remove leading and trailing whitespace in the gem post-install message
|
50
|
+
([#53]).
|
51
|
+
|
52
|
+
- Realign with latest Rubocop style ([#53]).
|
53
|
+
|
54
|
+
- Update the links to Pagerduty official API documentation.
|
55
|
+
|
56
|
+
- Don't specify Ruby patch versions in Travis CI build configuration. Remove
|
57
|
+
the toil involved in keeping these up to date.
|
58
|
+
|
59
|
+
### Removed
|
60
|
+
|
61
|
+
- Remove gem post-install message.
|
62
|
+
|
63
|
+
[2.1.2]: https://github.com/envato/pagerduty/compare/v2.1.1...v2.1.2
|
64
|
+
[#53]: https://github.com/envato/pagerduty/pull/53
|
65
|
+
|
66
|
+
## [2.1.1] - 2018-03-06
|
67
|
+
|
68
|
+
### Added
|
69
|
+
|
70
|
+
- Test against Ruby 2.4 and 2.5 in CI ([#51]).
|
71
|
+
|
72
|
+
### Fixed
|
73
|
+
|
74
|
+
- Removed version restrictions on the `rubocop` development dependency, and
|
75
|
+
realigned code with the latest version. ([#51]).
|
76
|
+
|
77
|
+
### Removed
|
78
|
+
|
79
|
+
- Ruby 1.9.3 and Ruby 2.0.0 from the CI build ([#51]).
|
80
|
+
|
81
|
+
[2.1.1]: https://github.com/envato/pagerduty/compare/v2.1.0...v2.1.1
|
82
|
+
[#51]: https://github.com/envato/pagerduty/pull/51
|
83
|
+
|
84
|
+
## [2.1.0] - 2016-01-19
|
85
|
+
|
86
|
+
### Added
|
87
|
+
|
88
|
+
- Rubocop configuration and align syntax ([#32], [#35], [#38], [#43]).
|
89
|
+
|
90
|
+
- Documentation describing how to resolve an existing incident ([#34]).
|
91
|
+
|
92
|
+
- Print Ruby warnings during the CI build ([#36]).
|
93
|
+
|
94
|
+
- Remove restrictions on `bundler` development dependency ([#37]).
|
95
|
+
|
96
|
+
- Test against Ruby 2.3 in CI ([#41]).
|
97
|
+
|
98
|
+
- Add support for HTTP proxy ([#47]).
|
99
|
+
|
100
|
+
### Fixed
|
101
|
+
|
102
|
+
- `Pagerduty#get_incident` raises `ArgumentError` if the provided incident key
|
103
|
+
is `nil` ([#46]).
|
104
|
+
|
105
|
+
[2.1.0]: https://github.com/envato/pagerduty/compare/v2.0.1...v2.1.0
|
106
|
+
[#32]: https://github.com/envato/pagerduty/pull/32
|
107
|
+
[#34]: https://github.com/envato/pagerduty/pull/34
|
108
|
+
[#35]: https://github.com/envato/pagerduty/pull/35
|
109
|
+
[#36]: https://github.com/envato/pagerduty/pull/36
|
110
|
+
[#37]: https://github.com/envato/pagerduty/pull/37
|
111
|
+
[#38]: https://github.com/envato/pagerduty/pull/38
|
112
|
+
[#41]: https://github.com/envato/pagerduty/pull/41
|
113
|
+
[#43]: https://github.com/envato/pagerduty/pull/43
|
114
|
+
[#46]: https://github.com/envato/pagerduty/pull/46
|
115
|
+
[#47]: https://github.com/envato/pagerduty/pull/47
|
116
|
+
|
117
|
+
## [2.0.1] - 2015-03-29
|
118
|
+
|
119
|
+
### Added
|
120
|
+
|
121
|
+
- Moved specs to RSpec 3.0 ([#30]).
|
122
|
+
|
123
|
+
- Test against Ruby 2.2 in CI ([#31]).
|
124
|
+
|
125
|
+
### Changed
|
126
|
+
|
127
|
+
- Rename `HttpTransport#send` to `httpTransport#send_payload`. This avoids
|
128
|
+
shawdowing `Object#send` ([#29]).
|
129
|
+
|
130
|
+
[2.0.1]: https://github.com/envato/pagerduty/compare/v2.0.0...v2.0.1
|
131
|
+
[#29]: https://github.com/envato/pagerduty/pull/29
|
132
|
+
[#30]: https://github.com/envato/pagerduty/pull/30
|
133
|
+
[#31]: https://github.com/envato/pagerduty/pull/31
|
134
|
+
|
135
|
+
## [2.0.0] - 2014-05-26
|
136
|
+
|
137
|
+
### Added
|
138
|
+
|
139
|
+
- The `description` argument in the `PagerdutyIncident#acknowledge` and
|
140
|
+
`PagerdutyIncident#resolve` methods is now optional. As specified by the
|
141
|
+
API ([#19]).
|
142
|
+
|
143
|
+
- YARD class and method documentation. In addition to updating the readme
|
144
|
+
([#20]).
|
145
|
+
|
146
|
+
### Changed
|
147
|
+
|
148
|
+
- `Pagerduty#trigger` arguments have changed to accept all available options
|
149
|
+
provided by the API, rather than just `details` ([#19]).
|
150
|
+
|
151
|
+
```ruby
|
152
|
+
pagerduty.trigger(
|
153
|
+
"incident description",
|
154
|
+
incident_key: "my unique incident identifier",
|
155
|
+
client: "server in trouble",
|
156
|
+
client_url: "http://server.in.trouble",
|
157
|
+
details: {my: "extra details"},
|
158
|
+
)
|
159
|
+
```
|
160
|
+
|
161
|
+
This is breaking in the case where providing a `details` hash:
|
162
|
+
|
163
|
+
```ruby
|
164
|
+
# This no longer works post v2.0.0. If you're
|
165
|
+
# providing details in this form, please migrate.
|
166
|
+
pagerduty.trigger("desc", key: "value")
|
167
|
+
|
168
|
+
# Post v2.0.0 this is how to send details (migrate to this please).
|
169
|
+
pagerduty.trigger("desc", details: {key: "value"})
|
170
|
+
```
|
171
|
+
|
172
|
+
- `Pagerduty` class initialiser no longer accepts an `incident_key`. This
|
173
|
+
attribute can now be provided when calling the `#trigger` method (see above)
|
174
|
+
([#19]).
|
175
|
+
|
176
|
+
- `PagerdutyException` now extends from `StandardError` rather than
|
177
|
+
`Exception`. This may affect how you rescue the error. i.e. `rescue
|
178
|
+
StandardError` will now rescue a `PagerdutyException` where it did not
|
179
|
+
before ([#21]).
|
180
|
+
|
181
|
+
[2.0.0]: https://github.com/envato/pagerduty/compare/v1.4.1...v2.0.0
|
182
|
+
[#19]: https://github.com/envato/pagerduty/pull/19
|
183
|
+
[#20]: https://github.com/envato/pagerduty/pull/20
|
184
|
+
[#21]: https://github.com/envato/pagerduty/pull/21
|
185
|
+
|
186
|
+
## [1.4.1] - 2014-05-21
|
187
|
+
|
188
|
+
### Added
|
189
|
+
|
190
|
+
- Set HTTP open and read timeouts to 60 seconds ([#16]).
|
191
|
+
|
192
|
+
- Add tests and a CI build (TravisCI) ([#17]).
|
193
|
+
|
194
|
+
- Add `bundler`, `rake` and `rspec-given` as development dependencies ([#17]).
|
195
|
+
|
196
|
+
- Extract (private) `HttpTransport` class, for single responsibility and ease
|
197
|
+
of testing ([#18]).
|
198
|
+
|
199
|
+
### Changed
|
200
|
+
|
201
|
+
- Raise errors instead of throwing them ([#17]).
|
202
|
+
|
203
|
+
### Fixed
|
204
|
+
|
205
|
+
- Use the OS default `CA path` rather than explicitly setting one ([#18]).
|
206
|
+
|
207
|
+
[1.4.1]: https://github.com/envato/pagerduty/compare/v1.4.0...v1.4.1
|
208
|
+
[#16]: https://github.com/envato/pagerduty/pull/16
|
209
|
+
[#17]: https://github.com/envato/pagerduty/pull/17
|
210
|
+
[#18]: https://github.com/envato/pagerduty/pull/18
|
211
|
+
|
212
|
+
## [1.4.0] - 2014-04-02
|
213
|
+
|
214
|
+
### Added
|
215
|
+
|
216
|
+
- Support TLS to the Pagerduty API ([#14]).
|
217
|
+
|
218
|
+
[1.4.0]: https://github.com/envato/pagerduty/compare/v1.3.4...v1.4.0
|
219
|
+
[#14]: https://github.com/envato/pagerduty/pull/14
|
220
|
+
|
221
|
+
## [1.3.4] - 2013-02-12
|
222
|
+
|
223
|
+
### Fixed
|
224
|
+
|
225
|
+
- Update `Rakefile` to word with recent versions of RDoc
|
226
|
+
|
227
|
+
### Changed
|
228
|
+
|
229
|
+
- Enforce `json` gem to versions 1.7.7 and above.
|
230
|
+
|
231
|
+
[1.3.4]: https://github.com/envato/pagerduty/compare/v1.3.3...v1.3.4
|
232
|
+
|
233
|
+
## [1.3.3] - 2012-12-12
|
234
|
+
|
235
|
+
### Changed
|
236
|
+
|
237
|
+
- Allow `json` gem versions 1.5 and above.
|
238
|
+
|
239
|
+
[1.3.3]: https://github.com/envato/pagerduty/compare/v1.3.2...v1.3.3
|
240
|
+
|
241
|
+
## [1.3.2] - 2012-10-31
|
242
|
+
|
243
|
+
### Fixed
|
244
|
+
|
245
|
+
- `details` are now correctly passed in the API call.
|
246
|
+
|
247
|
+
[1.3.2]: https://github.com/envato/pagerduty/compare/v1.3.1...v1.3.2
|
248
|
+
|
249
|
+
## [1.3.1] - 2012-10-19
|
250
|
+
|
251
|
+
### Fixed
|
252
|
+
|
253
|
+
- Consolidated all Pagerduty definitions to be a `class`.
|
254
|
+
|
255
|
+
[1.3.1]: https://github.com/envato/pagerduty/compare/v1.3.0...v1.3.1
|
256
|
+
|
257
|
+
## [1.3.0] - 2012-10-18
|
258
|
+
|
259
|
+
### Added
|
260
|
+
|
261
|
+
- Add ability to set the incident key via the initializer.
|
262
|
+
|
263
|
+
### Changed
|
264
|
+
|
265
|
+
- Perform release with `bundler` instead of `jeweller`.
|
266
|
+
- Manage all gem dependencies in the gemspec file.
|
267
|
+
- Remove dependency on `curb`.
|
268
|
+
|
269
|
+
[1.3.0]: https://github.com/envato/pagerduty/compare/v1.1.1...v1.3.0
|
270
|
+
|
271
|
+
## [1.1.1] - 2010-11-17
|
272
|
+
|
273
|
+
### Fixed
|
274
|
+
|
275
|
+
- Specify `json` and `curb` gems as dependencies in the default gem group.
|
276
|
+
|
277
|
+
### Added
|
278
|
+
|
279
|
+
- Prevent the `.bundle` directory from being added to the git repository.
|
280
|
+
|
281
|
+
[1.1.1]: https://github.com/envato/pagerduty/compare/v1.1.0...v1.1.1
|
282
|
+
|
283
|
+
## [1.1.0] - 2010-11-16
|
284
|
+
|
285
|
+
### Added
|
286
|
+
|
287
|
+
- New `Pagerduty#get_incident` method.
|
288
|
+
|
289
|
+
[1.1.0]: https://github.com/envato/pagerduty/compare/v1.0.1...v1.1.0
|
290
|
+
|
291
|
+
## [1.0.1] - 2010-11-16
|
292
|
+
|
293
|
+
### Fixed
|
294
|
+
|
295
|
+
- Specify `json` and `curb` gems as dependencies.
|
296
|
+
|
297
|
+
[1.0.1]: https://github.com/envato/pagerduty/compare/v1.0.0...v1.0.1
|
298
|
+
|
299
|
+
## [1.0.0] - 2010-11-16
|
300
|
+
|
301
|
+
### Added
|
302
|
+
|
303
|
+
- Library released as Open Source!
|
304
|
+
|
305
|
+
[1.0.0]: https://github.com/envato/pagerduty/releases/tag/v1.0.0
|
data/README.md
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
[![License MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/envato/pagerduty/blob/master/LICENSE.txt)
|
5
|
-
[![Gem Version](https://
|
5
|
+
[![Gem Version](https://img.shields.io/gem/v/pagerduty.svg?maxAge=2592000)](https://rubygems.org/gems/pagerduty)
|
6
|
+
[![Gem Downloads](https://img.shields.io/gem/dt/pagerduty.svg?maxAge=2592000)](https://rubygems.org/gems/pagerduty)
|
6
7
|
[![Build Status](https://travis-ci.org/envato/pagerduty.svg?branch=master)](https://travis-ci.org/envato/pagerduty)
|
7
8
|
|
8
9
|
Provides a lightweight Ruby interface for calling the [PagerDuty
|
@@ -95,30 +96,6 @@ rescue Net::HTTPServerException => error
|
|
95
96
|
end
|
96
97
|
```
|
97
98
|
|
98
|
-
### Upgrading to Version 2.0.0
|
99
|
-
|
100
|
-
The API has changed in three ways that you need to be aware of:
|
101
|
-
|
102
|
-
1. `Pagerduty` class initialiser no longer accepts an `incident_key`. This
|
103
|
-
attribute can now be provided when calling the `#trigger` method (see above).
|
104
|
-
|
105
|
-
2. `Pagerduty#trigger` arguments have changed to accept all available options
|
106
|
-
rather than just details.
|
107
|
-
|
108
|
-
```ruby
|
109
|
-
# This no longer works post v2.0.0. If you're
|
110
|
-
# providing details in this form, please migrate.
|
111
|
-
pagerduty.trigger("desc", key: "value")
|
112
|
-
|
113
|
-
# Post v2.0.0 this is how to send details (migrate to this please).
|
114
|
-
pagerduty.trigger("desc", details: { key: "value" })
|
115
|
-
```
|
116
|
-
|
117
|
-
3. `PagerdutyException` now extends from `StandardError` rather than
|
118
|
-
`Exception`. This may affect how you rescue the error. i.e. `rescue
|
119
|
-
StandardError` will now rescue a `PagerdutyException` where it did not
|
120
|
-
before.
|
121
|
-
|
122
99
|
## Contributing
|
123
100
|
|
124
101
|
1. Fork it ( https://github.com/envato/pagerduty/fork )
|
data/lib/pagerduty.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "pagerduty/version"
|
2
4
|
require "pagerduty/http_transport"
|
3
5
|
|
@@ -92,12 +94,12 @@ class Pagerduty
|
|
92
94
|
)
|
93
95
|
end
|
94
96
|
|
95
|
-
protected
|
97
|
+
protected
|
96
98
|
|
97
99
|
def api_call(event_type, args)
|
98
100
|
args = args.merge(
|
99
101
|
service_key: service_key,
|
100
|
-
event_type:
|
102
|
+
event_type: event_type,
|
101
103
|
)
|
102
104
|
@transport.send_payload(args)
|
103
105
|
end
|
@@ -108,7 +110,7 @@ protected
|
|
108
110
|
end
|
109
111
|
end
|
110
112
|
|
111
|
-
private
|
113
|
+
private
|
112
114
|
|
113
115
|
# @api private
|
114
116
|
def transport_from_options(options = {})
|
@@ -176,7 +178,7 @@ class PagerdutyIncident < Pagerduty
|
|
176
178
|
modify_incident("resolve", description, details)
|
177
179
|
end
|
178
180
|
|
179
|
-
private
|
181
|
+
private
|
180
182
|
|
181
183
|
def modify_incident(event_type, description, details)
|
182
184
|
options = { incident_key: incident_key }
|
@@ -1,12 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "json"
|
2
4
|
require "net/https"
|
3
5
|
|
4
6
|
class Pagerduty
|
5
7
|
# @api private
|
6
8
|
class HttpTransport
|
7
|
-
HOST = "events.pagerduty.com"
|
9
|
+
HOST = "events.pagerduty.com"
|
8
10
|
PORT = 443
|
9
|
-
PATH = "/generic/2010-04-15/create_event.json"
|
11
|
+
PATH = "/generic/2010-04-15/create_event.json"
|
10
12
|
|
11
13
|
def initialize(options = {})
|
12
14
|
@options = options
|
@@ -18,7 +20,7 @@ class Pagerduty
|
|
18
20
|
JSON.parse(response.body)
|
19
21
|
end
|
20
22
|
|
21
|
-
|
23
|
+
private
|
22
24
|
|
23
25
|
def post(payload)
|
24
26
|
post = Net::HTTP::Post.new(PATH)
|
data/lib/pagerduty/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagerduty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charlie Somerville
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-02-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -71,16 +71,16 @@ dependencies:
|
|
71
71
|
name: rubocop
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - "
|
74
|
+
- - "<"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
76
|
+
version: '0.77'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - "
|
81
|
+
- - "<"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '0'
|
83
|
+
version: '0.77'
|
84
84
|
description: Provides a lightweight interface for calling the PagerDuty Integration
|
85
85
|
API
|
86
86
|
email:
|
@@ -90,26 +90,20 @@ executables: []
|
|
90
90
|
extensions: []
|
91
91
|
extra_rdoc_files: []
|
92
92
|
files:
|
93
|
-
-
|
94
|
-
- ".rubocop.yml"
|
95
|
-
- ".travis.yml"
|
96
|
-
- Gemfile
|
93
|
+
- CHANGELOG.md
|
97
94
|
- LICENSE.txt
|
98
95
|
- README.md
|
99
|
-
- Rakefile
|
100
96
|
- lib/pagerduty.rb
|
101
97
|
- lib/pagerduty/http_transport.rb
|
102
98
|
- lib/pagerduty/version.rb
|
103
|
-
- pagerduty.gemspec
|
104
|
-
- script/setup.sh
|
105
|
-
- spec/pagerduty/http_transport_spec.rb
|
106
|
-
- spec/pagerduty_spec.rb
|
107
|
-
- spec/spec_helper.rb
|
108
|
-
- spec/support/warnings.rb
|
109
99
|
homepage: http://github.com/envato/pagerduty
|
110
100
|
licenses:
|
111
101
|
- MIT
|
112
|
-
metadata:
|
102
|
+
metadata:
|
103
|
+
bug_tracker_uri: https://github.com/envato/pagerduty/issues
|
104
|
+
changelog_uri: https://github.com/envato/pagerduty/blob/v2.1.3/CHANGELOG.md
|
105
|
+
documentation_uri: https://www.rubydoc.info/gems/pagerduty/2.1.3
|
106
|
+
source_code_uri: https://github.com/envato/pagerduty/tree/v2.1.3
|
113
107
|
post_install_message:
|
114
108
|
rdoc_options: []
|
115
109
|
require_paths:
|
@@ -125,13 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
119
|
- !ruby/object:Gem::Version
|
126
120
|
version: '0'
|
127
121
|
requirements: []
|
128
|
-
|
129
|
-
rubygems_version: 2.7.6
|
122
|
+
rubygems_version: 3.1.2
|
130
123
|
signing_key:
|
131
124
|
specification_version: 4
|
132
125
|
summary: Pagerduty Integration API client library
|
133
|
-
test_files:
|
134
|
-
- spec/pagerduty/http_transport_spec.rb
|
135
|
-
- spec/pagerduty_spec.rb
|
136
|
-
- spec/spec_helper.rb
|
137
|
-
- spec/support/warnings.rb
|
126
|
+
test_files: []
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
Exclude:
|
3
|
-
- .bundle/**/*
|
4
|
-
- bin/**/*
|
5
|
-
- vendor/**/*
|
6
|
-
|
7
|
-
Layout/AccessModifierIndentation:
|
8
|
-
EnforcedStyle: outdent
|
9
|
-
|
10
|
-
Metrics/BlockLength:
|
11
|
-
Enabled: true
|
12
|
-
Exclude:
|
13
|
-
- spec/**/*
|
14
|
-
|
15
|
-
Style/BlockDelimiters:
|
16
|
-
Exclude:
|
17
|
-
- spec/**/*
|
18
|
-
|
19
|
-
Style/Documentation:
|
20
|
-
Enabled: false
|
21
|
-
|
22
|
-
Style/GuardClause:
|
23
|
-
Enabled: false
|
24
|
-
|
25
|
-
Style/SpecialGlobalVars:
|
26
|
-
Enabled: false
|
27
|
-
|
28
|
-
Style/StringLiterals:
|
29
|
-
EnforcedStyle: double_quotes
|
30
|
-
|
31
|
-
Style/TrailingCommaInArguments:
|
32
|
-
EnforcedStyleForMultiline: comma
|
33
|
-
|
34
|
-
Style/TrailingCommaInArrayLiteral:
|
35
|
-
EnforcedStyleForMultiline: comma
|
36
|
-
|
37
|
-
Style/TrailingCommaInHashLiteral:
|
38
|
-
EnforcedStyleForMultiline: comma
|
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/pagerduty.gemspec
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
lib = File.expand_path("lib", __dir__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require "pagerduty/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |gem|
|
6
|
-
gem.name = "pagerduty"
|
7
|
-
gem.version = Pagerduty::VERSION
|
8
|
-
gem.authors = ["Charlie Somerville", "Orien Madgwick"]
|
9
|
-
gem.email = ["charlie@charliesomerville.com", "_@orien.io"]
|
10
|
-
gem.description =
|
11
|
-
"Provides a lightweight interface for calling the PagerDuty Integration API"
|
12
|
-
gem.summary = "Pagerduty Integration API client library"
|
13
|
-
gem.homepage = "http://github.com/envato/pagerduty"
|
14
|
-
gem.license = "MIT"
|
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_runtime_dependency "json", ">= 1.7.7"
|
22
|
-
gem.add_development_dependency "bundler"
|
23
|
-
gem.add_development_dependency "rake"
|
24
|
-
gem.add_development_dependency "rspec-given"
|
25
|
-
gem.add_development_dependency "rubocop"
|
26
|
-
end
|
data/script/setup.sh
DELETED
@@ -1,131 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Pagerduty::HttpTransport do
|
4
|
-
Given(:http_transport) { Pagerduty::HttpTransport.new(options) }
|
5
|
-
|
6
|
-
Given(:options) { {} }
|
7
|
-
Given(:http) { spy }
|
8
|
-
Given(:http_proxy) { spy(new: http) }
|
9
|
-
Given { allow(http).to receive(:request).and_return(standard_response) }
|
10
|
-
Given { allow(Net::HTTP).to receive(:Proxy).and_return(http_proxy) }
|
11
|
-
Given(:post) { spy }
|
12
|
-
Given { allow(Net::HTTP::Post).to receive(:new).and_return(post) }
|
13
|
-
|
14
|
-
describe "::send_payload" do
|
15
|
-
Given(:payload) {
|
16
|
-
{
|
17
|
-
event_type: "trigger",
|
18
|
-
service_key: "test-srvc-key",
|
19
|
-
description: "test-desc",
|
20
|
-
details: { key: "value" },
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|
24
|
-
When(:response) { http_transport.send_payload(payload) }
|
25
|
-
|
26
|
-
describe "provides the correct request" do
|
27
|
-
Then {
|
28
|
-
expect(post).to have_received(:body=).with(
|
29
|
-
'{"event_type":"trigger",'\
|
30
|
-
'"service_key":"test-srvc-key",'\
|
31
|
-
'"description":"test-desc",'\
|
32
|
-
'"details":{"key":"value"}}',
|
33
|
-
)
|
34
|
-
}
|
35
|
-
end
|
36
|
-
|
37
|
-
describe "handles all responses" do
|
38
|
-
context "PagerDuty successfully creates the incident" do
|
39
|
-
Given {
|
40
|
-
allow(http)
|
41
|
-
.to receive(:request)
|
42
|
-
.and_return(response_with_body(<<-JSON))
|
43
|
-
{
|
44
|
-
"status": "success",
|
45
|
-
"incident_key": "My Incident Key",
|
46
|
-
"message": "Event processed"
|
47
|
-
}
|
48
|
-
JSON
|
49
|
-
}
|
50
|
-
|
51
|
-
Then { expect(response).to include("status" => "success") }
|
52
|
-
Then {
|
53
|
-
expect(response).to include("incident_key" => "My Incident Key")
|
54
|
-
}
|
55
|
-
end
|
56
|
-
|
57
|
-
context "PagerDuty fails to create the incident" do
|
58
|
-
Given {
|
59
|
-
allow(http)
|
60
|
-
.to receive(:request)
|
61
|
-
.and_return(response_with_body(<<-JSON))
|
62
|
-
{
|
63
|
-
"status": "failure",
|
64
|
-
"message": "Event not processed"
|
65
|
-
}
|
66
|
-
JSON
|
67
|
-
}
|
68
|
-
Then { expect(response).to include("status" => "failure") }
|
69
|
-
Then { expect(response).to_not include("incident_key") }
|
70
|
-
end
|
71
|
-
|
72
|
-
context "PagerDuty responds with HTTP bad request" do
|
73
|
-
Given { allow(http).to receive(:request).and_return(bad_request) }
|
74
|
-
Then { expect(response).to have_raised Net::HTTPServerException }
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe "HTTPS use" do
|
79
|
-
Then { expect(http).to have_received(:use_ssl=).with(true) }
|
80
|
-
Then { expect(http).to_not have_received(:ca_path=) }
|
81
|
-
Then { expect(http).to_not have_received(:verify_depth=) }
|
82
|
-
Then {
|
83
|
-
expect(http)
|
84
|
-
.to have_received(:verify_mode=)
|
85
|
-
.with(OpenSSL::SSL::VERIFY_PEER)
|
86
|
-
}
|
87
|
-
end
|
88
|
-
|
89
|
-
describe "proxy use" do
|
90
|
-
Given(:options) {
|
91
|
-
{
|
92
|
-
proxy_host: "test-proxy-host",
|
93
|
-
proxy_port: "test-proxy-port",
|
94
|
-
proxy_username: "test-proxy-username",
|
95
|
-
proxy_password: "test-proxy-password",
|
96
|
-
}
|
97
|
-
}
|
98
|
-
Then {
|
99
|
-
expect(Net::HTTP)
|
100
|
-
.to have_received(:Proxy)
|
101
|
-
.with(
|
102
|
-
"test-proxy-host",
|
103
|
-
"test-proxy-port",
|
104
|
-
"test-proxy-username",
|
105
|
-
"test-proxy-password",
|
106
|
-
)
|
107
|
-
}
|
108
|
-
end
|
109
|
-
|
110
|
-
describe "timeouts" do
|
111
|
-
Then { expect(http).to have_received(:open_timeout=).with(60) }
|
112
|
-
Then { expect(http).to have_received(:read_timeout=).with(60) }
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
def standard_response
|
117
|
-
response_with_body(
|
118
|
-
'{ "status": "success", "incident_key": "My Incident Key" }',
|
119
|
-
)
|
120
|
-
end
|
121
|
-
|
122
|
-
def response_with_body(body)
|
123
|
-
response = Net::HTTPSuccess.new 1.1, "200", "OK"
|
124
|
-
allow(response).to receive(:body).and_return(body)
|
125
|
-
response
|
126
|
-
end
|
127
|
-
|
128
|
-
def bad_request
|
129
|
-
Net::HTTPBadRequest.new 1.1, "400", "Bad Request"
|
130
|
-
end
|
131
|
-
end
|
data/spec/pagerduty_spec.rb
DELETED
@@ -1,363 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Pagerduty do
|
4
|
-
Given(:pagerduty) { Pagerduty.new(service_key, options) }
|
5
|
-
|
6
|
-
Given(:service_key) { "a-test-service-key" }
|
7
|
-
Given(:options) { { transport: transport } }
|
8
|
-
Given(:transport) { spy }
|
9
|
-
|
10
|
-
describe "#trigger" do
|
11
|
-
describe "provides the correct request" do
|
12
|
-
Given {
|
13
|
-
allow(transport)
|
14
|
-
.to receive(:send_payload)
|
15
|
-
.and_return(standard_response)
|
16
|
-
}
|
17
|
-
|
18
|
-
context "no options" do
|
19
|
-
When(:incident) { pagerduty.trigger("a-test-description") }
|
20
|
-
Then {
|
21
|
-
expect(transport).to have_received(:send_payload).with(
|
22
|
-
service_key: "a-test-service-key",
|
23
|
-
event_type: "trigger",
|
24
|
-
description: "a-test-description",
|
25
|
-
)
|
26
|
-
}
|
27
|
-
end
|
28
|
-
|
29
|
-
context "all options" do
|
30
|
-
When(:incident) {
|
31
|
-
pagerduty.trigger(
|
32
|
-
"a-test-description",
|
33
|
-
incident_key: "a-test-incident-key",
|
34
|
-
client: "a-test-client",
|
35
|
-
client_url: "a-test-client-url",
|
36
|
-
details: { key: "value" },
|
37
|
-
)
|
38
|
-
}
|
39
|
-
Then {
|
40
|
-
expect(transport).to have_received(:send_payload).with(
|
41
|
-
service_key: "a-test-service-key",
|
42
|
-
event_type: "trigger",
|
43
|
-
description: "a-test-description",
|
44
|
-
incident_key: "a-test-incident-key",
|
45
|
-
client: "a-test-client",
|
46
|
-
client_url: "a-test-client-url",
|
47
|
-
details: { key: "value" },
|
48
|
-
)
|
49
|
-
}
|
50
|
-
end
|
51
|
-
|
52
|
-
context "with proxy" do
|
53
|
-
Given(:options) {
|
54
|
-
{
|
55
|
-
proxy_host: "test-proxy-host",
|
56
|
-
proxy_port: "test-proxy-port",
|
57
|
-
proxy_username: "test-proxy-username",
|
58
|
-
proxy_password: "test-proxy-password",
|
59
|
-
}
|
60
|
-
}
|
61
|
-
Given {
|
62
|
-
allow(Pagerduty::HttpTransport)
|
63
|
-
.to receive(:new)
|
64
|
-
.and_return(transport)
|
65
|
-
}
|
66
|
-
When(:incident) { pagerduty.trigger("a-test-description") }
|
67
|
-
Then {
|
68
|
-
expect(Pagerduty::HttpTransport).to have_received(:new).with(
|
69
|
-
proxy_host: "test-proxy-host",
|
70
|
-
proxy_port: "test-proxy-port",
|
71
|
-
proxy_username: "test-proxy-username",
|
72
|
-
proxy_password: "test-proxy-password",
|
73
|
-
)
|
74
|
-
}
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe "handles all responses" do
|
79
|
-
context "PagerDuty successfully creates the incident" do
|
80
|
-
Given {
|
81
|
-
allow(transport).to receive(:send_payload).and_return(
|
82
|
-
"status" => "success",
|
83
|
-
"incident_key" => "My Incident Key",
|
84
|
-
"message" => "Event processed",
|
85
|
-
)
|
86
|
-
}
|
87
|
-
When(:incident) { pagerduty.trigger("description") }
|
88
|
-
Then { expect(incident).to be_a PagerdutyIncident }
|
89
|
-
Then { incident.service_key == service_key }
|
90
|
-
Then { incident.incident_key == "My Incident Key" }
|
91
|
-
Then { incident.instance_variable_get("@transport") == transport }
|
92
|
-
end
|
93
|
-
|
94
|
-
context "PagerDuty fails to create the incident" do
|
95
|
-
Given {
|
96
|
-
allow(transport).to receive(:send_payload).and_return(
|
97
|
-
"status" => "failure",
|
98
|
-
"message" => "Event not processed",
|
99
|
-
)
|
100
|
-
}
|
101
|
-
When(:incident) { pagerduty.trigger("description") }
|
102
|
-
Then { expect(incident).to have_raised PagerdutyException }
|
103
|
-
end
|
104
|
-
|
105
|
-
context "PagerDuty responds with HTTP bad request" do
|
106
|
-
Given {
|
107
|
-
allow(transport)
|
108
|
-
.to receive(:send_payload)
|
109
|
-
.and_raise(Net::HTTPServerException.new(nil, nil))
|
110
|
-
}
|
111
|
-
When(:incident) { pagerduty.trigger("description") }
|
112
|
-
Then { expect(incident).to have_raised Net::HTTPServerException }
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
describe "#get_incident" do
|
118
|
-
When(:incident) { pagerduty.get_incident(incident_key) }
|
119
|
-
|
120
|
-
context "a valid incident_key" do
|
121
|
-
Given(:incident_key) { "a-test-incident-key" }
|
122
|
-
Then { expect(incident).to be_a PagerdutyIncident }
|
123
|
-
Then { incident.service_key == service_key }
|
124
|
-
Then { incident.incident_key == incident_key }
|
125
|
-
Then { incident.instance_variable_get("@transport") == transport }
|
126
|
-
end
|
127
|
-
|
128
|
-
context "a nil incident_key" do
|
129
|
-
Given(:incident_key) { nil }
|
130
|
-
Then { expect(incident).to have_failed ArgumentError }
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe PagerdutyIncident do
|
135
|
-
Given(:incident) {
|
136
|
-
PagerdutyIncident.new(service_key, incident_key, options)
|
137
|
-
}
|
138
|
-
Given(:incident_key) { "a-test-incident-key" }
|
139
|
-
|
140
|
-
describe "#acknowledge" do
|
141
|
-
describe "provides the correct request" do
|
142
|
-
Given {
|
143
|
-
allow(transport)
|
144
|
-
.to receive(:send_payload)
|
145
|
-
.and_return(standard_response)
|
146
|
-
}
|
147
|
-
|
148
|
-
context "no args" do
|
149
|
-
When(:acknowledge) { incident.acknowledge }
|
150
|
-
Then {
|
151
|
-
expect(transport).to have_received(:send_payload).with(
|
152
|
-
event_type: "acknowledge",
|
153
|
-
service_key: "a-test-service-key",
|
154
|
-
incident_key: "a-test-incident-key",
|
155
|
-
)
|
156
|
-
}
|
157
|
-
end
|
158
|
-
|
159
|
-
context "a description" do
|
160
|
-
When(:acknowledge) { incident.acknowledge("test-description") }
|
161
|
-
Then {
|
162
|
-
expect(transport).to have_received(:send_payload).with(
|
163
|
-
event_type: "acknowledge",
|
164
|
-
service_key: "a-test-service-key",
|
165
|
-
incident_key: "a-test-incident-key",
|
166
|
-
description: "test-description",
|
167
|
-
)
|
168
|
-
}
|
169
|
-
end
|
170
|
-
|
171
|
-
context "a description and details" do
|
172
|
-
When(:acknowledge) {
|
173
|
-
incident.acknowledge("test-description", my: "detail")
|
174
|
-
}
|
175
|
-
Then {
|
176
|
-
expect(transport).to have_received(:send_payload).with(
|
177
|
-
event_type: "acknowledge",
|
178
|
-
service_key: "a-test-service-key",
|
179
|
-
incident_key: "a-test-incident-key",
|
180
|
-
description: "test-description",
|
181
|
-
details: { my: "detail" },
|
182
|
-
)
|
183
|
-
}
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
describe "handles all responses" do
|
188
|
-
context "PagerDuty successfully acknowledges the incident" do
|
189
|
-
Given {
|
190
|
-
allow(transport).to receive(:send_payload).and_return(
|
191
|
-
"status" => "success",
|
192
|
-
"incident_key" => "a-test-incident-key",
|
193
|
-
"message" => "Event acknowledged",
|
194
|
-
)
|
195
|
-
}
|
196
|
-
When(:acknowledge) { incident.acknowledge }
|
197
|
-
Then { expect(acknowledge).to be incident }
|
198
|
-
end
|
199
|
-
|
200
|
-
context "PagerDuty fails to acknowledge the incident" do
|
201
|
-
Given {
|
202
|
-
allow(transport).to receive(:send_payload).and_return(
|
203
|
-
"status" => "failure",
|
204
|
-
"incident_key" => "a-test-incident-key",
|
205
|
-
"message" => "Event not acknowledged",
|
206
|
-
)
|
207
|
-
}
|
208
|
-
When(:acknowledge) { incident.acknowledge }
|
209
|
-
Then { expect(acknowledge).to have_failed PagerdutyException }
|
210
|
-
end
|
211
|
-
|
212
|
-
context "PagerDuty responds with HTTP bad request" do
|
213
|
-
Given {
|
214
|
-
allow(transport)
|
215
|
-
.to receive(:send_payload)
|
216
|
-
.and_raise(Net::HTTPServerException.new(nil, nil))
|
217
|
-
}
|
218
|
-
When(:acknowledge) { incident.acknowledge }
|
219
|
-
Then { expect(acknowledge).to have_failed Net::HTTPServerException }
|
220
|
-
end
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
describe "#resolve" do
|
225
|
-
describe "provides the correct request" do
|
226
|
-
Given {
|
227
|
-
allow(transport)
|
228
|
-
.to receive(:send_payload)
|
229
|
-
.and_return(standard_response)
|
230
|
-
}
|
231
|
-
|
232
|
-
context "no args" do
|
233
|
-
When(:resolve) { incident.resolve }
|
234
|
-
Then {
|
235
|
-
expect(transport).to have_received(:send_payload).with(
|
236
|
-
event_type: "resolve",
|
237
|
-
service_key: "a-test-service-key",
|
238
|
-
incident_key: "a-test-incident-key",
|
239
|
-
)
|
240
|
-
}
|
241
|
-
end
|
242
|
-
|
243
|
-
context "a description" do
|
244
|
-
When(:resolve) { incident.resolve("test-description") }
|
245
|
-
Then {
|
246
|
-
expect(transport).to have_received(:send_payload).with(
|
247
|
-
event_type: "resolve",
|
248
|
-
service_key: "a-test-service-key",
|
249
|
-
incident_key: "a-test-incident-key",
|
250
|
-
description: "test-description",
|
251
|
-
)
|
252
|
-
}
|
253
|
-
end
|
254
|
-
|
255
|
-
context "a description and details" do
|
256
|
-
When(:resolve) { incident.resolve("test-description", my: "detail") }
|
257
|
-
Then {
|
258
|
-
expect(transport).to have_received(:send_payload).with(
|
259
|
-
event_type: "resolve",
|
260
|
-
service_key: "a-test-service-key",
|
261
|
-
incident_key: "a-test-incident-key",
|
262
|
-
description: "test-description",
|
263
|
-
details: { my: "detail" },
|
264
|
-
)
|
265
|
-
}
|
266
|
-
end
|
267
|
-
end
|
268
|
-
|
269
|
-
describe "handles all responses" do
|
270
|
-
context "PagerDuty successfully resolves the incident" do
|
271
|
-
Given {
|
272
|
-
allow(transport).to receive(:send_payload).and_return(
|
273
|
-
"status" => "success",
|
274
|
-
"incident_key" => "a-test-incident-key",
|
275
|
-
"message" => "Event resolved",
|
276
|
-
)
|
277
|
-
}
|
278
|
-
When(:resolve) { incident.resolve }
|
279
|
-
Then { expect(resolve).to be incident }
|
280
|
-
end
|
281
|
-
|
282
|
-
context "PagerDuty fails to create the incident" do
|
283
|
-
Given {
|
284
|
-
allow(transport).to receive(:send_payload).and_return(
|
285
|
-
"status" => "failure",
|
286
|
-
"message" => "Event not resolved",
|
287
|
-
)
|
288
|
-
}
|
289
|
-
When(:resolve) { incident.resolve }
|
290
|
-
Then { expect(resolve).to have_failed PagerdutyException }
|
291
|
-
end
|
292
|
-
|
293
|
-
context "PagerDuty responds with HTTP bad request" do
|
294
|
-
Given {
|
295
|
-
allow(transport)
|
296
|
-
.to receive(:send_payload)
|
297
|
-
.and_raise(Net::HTTPServerException.new(nil, nil))
|
298
|
-
}
|
299
|
-
When(:resolve) { incident.resolve }
|
300
|
-
Then { expect(resolve).to have_failed Net::HTTPServerException }
|
301
|
-
end
|
302
|
-
end
|
303
|
-
end
|
304
|
-
|
305
|
-
describe "#trigger" do
|
306
|
-
describe "provides the correct request" do
|
307
|
-
Given {
|
308
|
-
allow(transport)
|
309
|
-
.to receive(:send_payload)
|
310
|
-
.and_return(standard_response)
|
311
|
-
}
|
312
|
-
|
313
|
-
context "no options" do
|
314
|
-
Given(:incident_key) { "instance incident_key" }
|
315
|
-
When(:trigger) { incident.trigger("description") }
|
316
|
-
Then {
|
317
|
-
expect(transport).to have_received(:send_payload).with(
|
318
|
-
incident_key: "instance incident_key",
|
319
|
-
service_key: "a-test-service-key",
|
320
|
-
event_type: "trigger",
|
321
|
-
description: "description",
|
322
|
-
)
|
323
|
-
}
|
324
|
-
end
|
325
|
-
|
326
|
-
context "with incident_key option" do
|
327
|
-
When(:trigger) {
|
328
|
-
incident.trigger(
|
329
|
-
"description",
|
330
|
-
incident_key: "method param incident_key",
|
331
|
-
)
|
332
|
-
}
|
333
|
-
Then {
|
334
|
-
expect(transport).to have_received(:send_payload).with(
|
335
|
-
incident_key: "method param incident_key",
|
336
|
-
service_key: "a-test-service-key",
|
337
|
-
event_type: "trigger",
|
338
|
-
description: "description",
|
339
|
-
)
|
340
|
-
}
|
341
|
-
end
|
342
|
-
end
|
343
|
-
end
|
344
|
-
end
|
345
|
-
|
346
|
-
def standard_response
|
347
|
-
{ "status" => "success", "incident_key" => "My Incident Key" }
|
348
|
-
end
|
349
|
-
|
350
|
-
describe PagerdutyException do
|
351
|
-
Given(:pagerduty_instance) { double }
|
352
|
-
Given(:api_response) { double }
|
353
|
-
Given(:message) { "a test error message" }
|
354
|
-
|
355
|
-
When(:pagerduty_exception) {
|
356
|
-
PagerdutyException.new(pagerduty_instance, api_response, message)
|
357
|
-
}
|
358
|
-
|
359
|
-
Then { pagerduty_exception.pagerduty_instance == pagerduty_instance }
|
360
|
-
Then { pagerduty_exception.api_response == api_response }
|
361
|
-
Then { pagerduty_exception.message == message }
|
362
|
-
end
|
363
|
-
end
|
data/spec/spec_helper.rb
DELETED