pagerduty 2.1.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +476 -0
- data/README.md +161 -59
- data/lib/pagerduty/events_api_v1.rb +279 -0
- data/lib/pagerduty/events_api_v2.rb +280 -0
- data/lib/pagerduty/http_transport.rb +16 -14
- data/lib/pagerduty/version.rb +4 -2
- data/lib/pagerduty.rb +62 -163
- metadata +24 -48
- 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 -32
- data/script/setup.sh +0 -8
- data/spec/pagerduty/http_transport_spec.rb +0 -132
- data/spec/pagerduty_spec.rb +0 -364
- data/spec/spec_helper.rb +0 -14
- data/spec/support/warnings.rb +0 -13
metadata
CHANGED
@@ -1,30 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagerduty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charlie Somerville
|
8
8
|
- Orien Madgwick
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-02-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: json
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: 1.7.7
|
21
|
-
type: :runtime
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: 1.7.7
|
28
14
|
- !ruby/object:Gem::Dependency
|
29
15
|
name: bundler
|
30
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,18 +57,17 @@ dependencies:
|
|
71
57
|
name: rubocop
|
72
58
|
requirement: !ruby/object:Gem::Requirement
|
73
59
|
requirements:
|
74
|
-
- - "
|
60
|
+
- - "<"
|
75
61
|
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
62
|
+
version: '0.77'
|
77
63
|
type: :development
|
78
64
|
prerelease: false
|
79
65
|
version_requirements: !ruby/object:Gem::Requirement
|
80
66
|
requirements:
|
81
|
-
- - "
|
67
|
+
- - "<"
|
82
68
|
- !ruby/object:Gem::Version
|
83
|
-
version: '0'
|
84
|
-
description: Provides a lightweight interface for calling the PagerDuty
|
85
|
-
API
|
69
|
+
version: '0.77'
|
70
|
+
description: Provides a lightweight interface for calling the PagerDuty Events API
|
86
71
|
email:
|
87
72
|
- charlie@charliesomerville.com
|
88
73
|
- _@orien.io
|
@@ -90,28 +75,24 @@ executables: []
|
|
90
75
|
extensions: []
|
91
76
|
extra_rdoc_files: []
|
92
77
|
files:
|
93
|
-
-
|
94
|
-
- ".rubocop.yml"
|
95
|
-
- ".travis.yml"
|
96
|
-
- Gemfile
|
78
|
+
- CHANGELOG.md
|
97
79
|
- LICENSE.txt
|
98
80
|
- README.md
|
99
|
-
- Rakefile
|
100
81
|
- lib/pagerduty.rb
|
82
|
+
- lib/pagerduty/events_api_v1.rb
|
83
|
+
- lib/pagerduty/events_api_v2.rb
|
101
84
|
- lib/pagerduty/http_transport.rb
|
102
85
|
- lib/pagerduty/version.rb
|
103
|
-
|
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
|
-
homepage: http://github.com/envato/pagerduty
|
86
|
+
homepage: https://github.com/envato/pagerduty
|
110
87
|
licenses:
|
111
88
|
- MIT
|
112
|
-
metadata:
|
113
|
-
|
114
|
-
|
89
|
+
metadata:
|
90
|
+
bug_tracker_uri: https://github.com/envato/pagerduty/issues
|
91
|
+
changelog_uri: https://github.com/envato/pagerduty/blob/v4.0.0/CHANGELOG.md
|
92
|
+
documentation_uri: https://www.rubydoc.info/gems/pagerduty/4.0.0
|
93
|
+
homepage_uri: https://github.com/envato/pagerduty
|
94
|
+
source_code_uri: https://github.com/envato/pagerduty/tree/v4.0.0
|
95
|
+
post_install_message:
|
115
96
|
rdoc_options: []
|
116
97
|
require_paths:
|
117
98
|
- lib
|
@@ -119,20 +100,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
100
|
requirements:
|
120
101
|
- - ">="
|
121
102
|
- !ruby/object:Gem::Version
|
122
|
-
version: '
|
103
|
+
version: '2.3'
|
123
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
105
|
requirements:
|
125
106
|
- - ">="
|
126
107
|
- !ruby/object:Gem::Version
|
127
108
|
version: '0'
|
128
109
|
requirements: []
|
129
|
-
|
130
|
-
|
131
|
-
signing_key:
|
110
|
+
rubygems_version: 3.3.7
|
111
|
+
signing_key:
|
132
112
|
specification_version: 4
|
133
|
-
summary:
|
134
|
-
test_files:
|
135
|
-
- spec/pagerduty/http_transport_spec.rb
|
136
|
-
- spec/pagerduty_spec.rb
|
137
|
-
- spec/spec_helper.rb
|
138
|
-
- spec/support/warnings.rb
|
113
|
+
summary: PagerDuty Events API client library
|
114
|
+
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,32 +0,0 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path("lib", __dir__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require "pagerduty/version"
|
5
|
-
|
6
|
-
Gem::Specification.new do |gem|
|
7
|
-
gem.name = "pagerduty"
|
8
|
-
gem.version = Pagerduty::VERSION
|
9
|
-
gem.authors = ["Charlie Somerville", "Orien Madgwick"]
|
10
|
-
gem.email = ["charlie@charliesomerville.com", "_@orien.io"]
|
11
|
-
gem.description =
|
12
|
-
"Provides a lightweight interface for calling the PagerDuty Integration API"
|
13
|
-
gem.summary = "Pagerduty Integration API client library"
|
14
|
-
gem.homepage = "http://github.com/envato/pagerduty"
|
15
|
-
gem.license = "MIT"
|
16
|
-
|
17
|
-
gem.post_install_message = %(
|
18
|
-
If upgrading to pagerduty 2.0.0 please note the API changes:
|
19
|
-
https://github.com/envato/pagerduty#upgrading-to-version-200
|
20
|
-
)
|
21
|
-
|
22
|
-
gem.files = `git ls-files`.split($/)
|
23
|
-
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
24
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
25
|
-
gem.require_paths = ["lib"]
|
26
|
-
|
27
|
-
gem.add_runtime_dependency "json", ">= 1.7.7"
|
28
|
-
gem.add_development_dependency "bundler"
|
29
|
-
gem.add_development_dependency "rake"
|
30
|
-
gem.add_development_dependency "rspec-given"
|
31
|
-
gem.add_development_dependency "rubocop"
|
32
|
-
end
|
data/script/setup.sh
DELETED
@@ -1,132 +0,0 @@
|
|
1
|
-
|
2
|
-
require "spec_helper"
|
3
|
-
|
4
|
-
describe Pagerduty::HttpTransport do
|
5
|
-
Given(:http_transport) { Pagerduty::HttpTransport.new(options) }
|
6
|
-
|
7
|
-
Given(:options) { {} }
|
8
|
-
Given(:http) { spy }
|
9
|
-
Given(:http_proxy) { spy(new: http) }
|
10
|
-
Given { allow(http).to receive(:request).and_return(standard_response) }
|
11
|
-
Given { allow(Net::HTTP).to receive(:Proxy).and_return(http_proxy) }
|
12
|
-
Given(:post) { spy }
|
13
|
-
Given { allow(Net::HTTP::Post).to receive(:new).and_return(post) }
|
14
|
-
|
15
|
-
describe "::send_payload" do
|
16
|
-
Given(:payload) {
|
17
|
-
{
|
18
|
-
event_type: "trigger",
|
19
|
-
service_key: "test-srvc-key",
|
20
|
-
description: "test-desc",
|
21
|
-
details: { key: "value" },
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
When(:response) { http_transport.send_payload(payload) }
|
26
|
-
|
27
|
-
describe "provides the correct request" do
|
28
|
-
Then {
|
29
|
-
expect(post).to have_received(:body=).with(
|
30
|
-
'{"event_type":"trigger",'\
|
31
|
-
'"service_key":"test-srvc-key",'\
|
32
|
-
'"description":"test-desc",'\
|
33
|
-
'"details":{"key":"value"}}',
|
34
|
-
)
|
35
|
-
}
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "handles all responses" do
|
39
|
-
context "PagerDuty successfully creates the incident" do
|
40
|
-
Given {
|
41
|
-
allow(http)
|
42
|
-
.to receive(:request)
|
43
|
-
.and_return(response_with_body(<<-JSON))
|
44
|
-
{
|
45
|
-
"status": "success",
|
46
|
-
"incident_key": "My Incident Key",
|
47
|
-
"message": "Event processed"
|
48
|
-
}
|
49
|
-
JSON
|
50
|
-
}
|
51
|
-
|
52
|
-
Then { expect(response).to include("status" => "success") }
|
53
|
-
Then {
|
54
|
-
expect(response).to include("incident_key" => "My Incident Key")
|
55
|
-
}
|
56
|
-
end
|
57
|
-
|
58
|
-
context "PagerDuty fails to create the incident" do
|
59
|
-
Given {
|
60
|
-
allow(http)
|
61
|
-
.to receive(:request)
|
62
|
-
.and_return(response_with_body(<<-JSON))
|
63
|
-
{
|
64
|
-
"status": "failure",
|
65
|
-
"message": "Event not processed"
|
66
|
-
}
|
67
|
-
JSON
|
68
|
-
}
|
69
|
-
Then { expect(response).to include("status" => "failure") }
|
70
|
-
Then { expect(response).to_not include("incident_key") }
|
71
|
-
end
|
72
|
-
|
73
|
-
context "PagerDuty responds with HTTP bad request" do
|
74
|
-
Given { allow(http).to receive(:request).and_return(bad_request) }
|
75
|
-
Then { expect(response).to have_raised Net::HTTPServerException }
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
describe "HTTPS use" do
|
80
|
-
Then { expect(http).to have_received(:use_ssl=).with(true) }
|
81
|
-
Then { expect(http).to_not have_received(:ca_path=) }
|
82
|
-
Then { expect(http).to_not have_received(:verify_depth=) }
|
83
|
-
Then {
|
84
|
-
expect(http)
|
85
|
-
.to have_received(:verify_mode=)
|
86
|
-
.with(OpenSSL::SSL::VERIFY_PEER)
|
87
|
-
}
|
88
|
-
end
|
89
|
-
|
90
|
-
describe "proxy use" do
|
91
|
-
Given(:options) {
|
92
|
-
{
|
93
|
-
proxy_host: "test-proxy-host",
|
94
|
-
proxy_port: "test-proxy-port",
|
95
|
-
proxy_username: "test-proxy-username",
|
96
|
-
proxy_password: "test-proxy-password",
|
97
|
-
}
|
98
|
-
}
|
99
|
-
Then {
|
100
|
-
expect(Net::HTTP)
|
101
|
-
.to have_received(:Proxy)
|
102
|
-
.with(
|
103
|
-
"test-proxy-host",
|
104
|
-
"test-proxy-port",
|
105
|
-
"test-proxy-username",
|
106
|
-
"test-proxy-password",
|
107
|
-
)
|
108
|
-
}
|
109
|
-
end
|
110
|
-
|
111
|
-
describe "timeouts" do
|
112
|
-
Then { expect(http).to have_received(:open_timeout=).with(60) }
|
113
|
-
Then { expect(http).to have_received(:read_timeout=).with(60) }
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
def standard_response
|
118
|
-
response_with_body(
|
119
|
-
'{ "status": "success", "incident_key": "My Incident Key" }',
|
120
|
-
)
|
121
|
-
end
|
122
|
-
|
123
|
-
def response_with_body(body)
|
124
|
-
response = Net::HTTPSuccess.new 1.1, "200", "OK"
|
125
|
-
allow(response).to receive(:body).and_return(body)
|
126
|
-
response
|
127
|
-
end
|
128
|
-
|
129
|
-
def bad_request
|
130
|
-
Net::HTTPBadRequest.new 1.1, "400", "Bad Request"
|
131
|
-
end
|
132
|
-
end
|