pagerduty 3.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10e8332a28ba06cbed648d66d0ee4c367e9f179fe30ae4903846ab789070e596
4
- data.tar.gz: 56d30e6a7276dceff80df33748def18474204b58c4835d2fd2c59cccace8df2f
3
+ metadata.gz: a795d82c3660da5c30081c2e4753524edfad166388db9ec0c149604945ff2219
4
+ data.tar.gz: a50d6952570001c10ec07e2a262ad7b727a1539bc56d85675551ce7a281899f0
5
5
  SHA512:
6
- metadata.gz: 4fc9193a4582aae06a8bbd6c886b99086142c7e9a57a4f09230e7152931f227d04c84007190629a9772a4c4e3a1d4a2f8a8f5fcb023f271c287f27c89f15c69d
7
- data.tar.gz: a10af69c0ea9fb5b8cb88bcde086e9abbba12fdade60e08255d2192e75450994527256d0bb47947bb05463871affc427874868c689ba9a87ececf671ec25a257
6
+ metadata.gz: f24dede2659fa0c7dda59193e384c96d1045ed827de7b65944cfdeb851a8880797f8f7909b8a06fafbc05fa615ec7d03a573026d3d394c2bf5edf7417108ce86
7
+ data.tar.gz: b26a1dd98ddaff9efc3f84226e6da693ffd10bc8593044a05f2a42fc6c650bdb18ae95d1bc78bcd204aa763b80496d8e7051b75a6564462a52585a7ac45451e3
data/CHANGELOG.md CHANGED
@@ -10,7 +10,79 @@ The format is based on [Keep a Changelog], and this project adheres to
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
- [Unreleased]: https://github.com/envato/pagerduty/compare/v3.0.0...HEAD
13
+ [Unreleased]: https://github.com/envato/pagerduty/compare/v4.0.1...HEAD
14
+
15
+ ## [4.0.1] - 2024-02-17
16
+
17
+ ### Added
18
+
19
+ - Test on Ruby 3.2, and 3.3 in the CI build ([#84], [#85]).
20
+
21
+ ### Changed
22
+
23
+ - Updated authorship details ([#82]).
24
+ - Bump the Rubocop development dependency to version 1 ([#86]).
25
+
26
+ [4.0.1]: https://github.com/envato/pagerduty/compare/v4.0.0...v4.0.1
27
+ [#82]: https://github.com/envato/pagerduty/pull/82
28
+ [#84]: https://github.com/envato/pagerduty/pull/84
29
+ [#85]: https://github.com/envato/pagerduty/pull/85
30
+ [#86]: https://github.com/envato/pagerduty/pull/86
31
+
32
+ ## [4.0.0] - 2022-02-14
33
+
34
+ ### Removed
35
+
36
+ - Remove support for Ruby versions lower than 2.3 ([#78]).
37
+
38
+ - Removed the deprecated way of creating a Pagerduty instance ([#79]).
39
+
40
+ ```diff
41
+ - pagerduty = Pagerduty.new("<integration-key>")
42
+ + pagerduty = Pagerduty.build(integration_key: "<integration-key>", api_version: 1)
43
+ pagerduty.trigger("<incident description>")
44
+ incident.acknowledge
45
+ incident.resolve
46
+ ```
47
+
48
+ - Removed the deprecated `get_incident` and `service_key` methods from the
49
+ `Pagerduty::EventsApiV1::Incident` class ([#79]). `incident` provides a replacement
50
+ for the `get_incident` method. The `service_key` method has no replacement.
51
+
52
+ ```diff
53
+ pagerduty = Pagerduty.build(integration_key: "<integration-key>", api_version: 1)
54
+ - incident = pagerduty.get_incident("<incident-key>")
55
+ + incident = pagerduty.incident("<incident-key>")
56
+ incident.trigger("<incident description>")
57
+ incident.acknowledge
58
+ incident.resolve
59
+ ```
60
+
61
+ - Removed the `PagerdutyIncident` class. Instead, use the
62
+ `Pagerduty::EventsApiV1::Incident` class ([#79]).
63
+
64
+ ### Added
65
+
66
+ - Test on Ruby 3.0 and 3.1 in CI build ([#74], [#80]).
67
+
68
+ ### Changed
69
+
70
+ - The explicit `json` gem runtime dependency has been removed ([#78]).
71
+ - Use GitHub Actions for CI build instead of TravisCI ([#73]).
72
+ - The default git branch has been renamed to `main` ([#77]).
73
+
74
+ ### Fixed
75
+
76
+ - Resolved `Net::HTTPServerException` deprecation warning in test suite([#75]).
77
+
78
+ [4.0.0]: https://github.com/envato/pagerduty/compare/v3.0.0...v4.0.0
79
+ [#73]: https://github.com/envato/pagerduty/pull/73
80
+ [#74]: https://github.com/envato/pagerduty/pull/74
81
+ [#75]: https://github.com/envato/pagerduty/pull/75
82
+ [#77]: https://github.com/envato/pagerduty/pull/77
83
+ [#78]: https://github.com/envato/pagerduty/pull/78
84
+ [#79]: https://github.com/envato/pagerduty/pull/79
85
+ [#80]: https://github.com/envato/pagerduty/pull/80
14
86
 
15
87
  ## [3.0.0] - 2020-04-20
16
88
 
@@ -123,7 +195,7 @@ The format is based on [Keep a Changelog], and this project adheres to
123
195
  ```
124
196
 
125
197
  [3.0.0]: https://github.com/envato/pagerduty/compare/v2.1.3...v3.0.0
126
- [events-v2-docs]: https://v2.developer.pagerduty.com/docs/send-an-event-events-api-v2
198
+ [events-v2-docs]: https://developer.pagerduty.com/docs/ZG9jOjExMDI5NTgw-events-api-v2-overview
127
199
  [#64]: https://github.com/envato/pagerduty/pull/64
128
200
  [#66]: https://github.com/envato/pagerduty/pull/66
129
201
  [#67]: https://github.com/envato/pagerduty/pull/67
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 Envato, Charlie Somerville & Orien Madgwick
1
+ Copyright (c) 2010 Envato, Hailey Somerville & Orien Madgwick
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # pagerduty
2
2
 
3
- [![License MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/envato/pagerduty/blob/master/LICENSE.txt)
3
+ [![License MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/envato/pagerduty/blob/HEAD/LICENSE.txt)
4
4
  [![Gem Version](https://img.shields.io/gem/v/pagerduty.svg?maxAge=2592000)](https://rubygems.org/gems/pagerduty)
5
5
  [![Gem Downloads](https://img.shields.io/gem/dt/pagerduty.svg?maxAge=2592000)](https://rubygems.org/gems/pagerduty)
6
- [![Build Status](https://travis-ci.org/envato/pagerduty.svg?branch=master)](https://travis-ci.org/envato/pagerduty)
6
+ [![Build Status](https://github.com/envato/pagerduty/workflows/build/badge.svg?branch=main)](https://github.com/envato/pagerduty/actions?query=workflow%3Abuild+branch%3Amain)
7
7
 
8
8
  Provides a lightweight Ruby interface for calling the [PagerDuty Events
9
9
  API][events-v2-docs].
10
10
 
11
- [events-v2-docs]: https://v2.developer.pagerduty.com/docs/send-an-event-events-api-v2
11
+ [events-v2-docs]: https://developer.pagerduty.com/docs/ZG9jOjExMDI5NTgw-events-api-v2-overview
12
12
 
13
13
  ## Installation
14
14
 
@@ -28,6 +28,13 @@ Or install it yourself as:
28
28
 
29
29
  ## Usage
30
30
 
31
+ First, obtain an Events API integration key from PagerDuty. Follow the
32
+ [instructions][integration-key-documentation] in PagerDuty's documentation to
33
+ procure one.
34
+
35
+ [integration-key-documentation]: https://support.pagerduty.com/docs/services-and-integrations#create-a-generic-events-api-integration
36
+
37
+
31
38
  ### Events API V2
32
39
 
33
40
  ```ruby
@@ -207,30 +214,13 @@ begin
207
214
  source: "source",
208
215
  severity: "critical"
209
216
  )
210
- rescue Net::HTTPServerException => error
217
+ rescue Net::HTTPClientException => error
211
218
  error.response.code #=> "400"
212
219
  error.response.message #=> "Bad Request"
213
220
  error.response.body #=> "{\"status\":\"invalid event\",\"message\":\"Event object is invalid\",\"errors\":[\"Service key is the wrong length (should be 32 characters)\"]}"
214
221
  end
215
222
  ```
216
223
 
217
- ### Legacy Interface
218
-
219
- The older Ruby interface from version 2 of the gem is still available.
220
- However, this is deprecated and will be removed in the next major release.
221
-
222
- ```ruby
223
- # Instantiate a Pagerduty with your specific service key
224
- pagerduty = Pagerduty.new("<my-integration-key>")
225
-
226
- # Trigger an incident
227
- incident = pagerduty.trigger("incident description")
228
-
229
- # Acknowledge and resolve the incident
230
- incident.acknowledge
231
- incident.resolve
232
- ```
233
-
234
224
  ## Contributing
235
225
 
236
226
  1. Fork it ( https://github.com/envato/pagerduty/fork )
@@ -176,9 +176,7 @@ module Pagerduty
176
176
  # @param (see Pagerduty::EventsApiV1#trigger)
177
177
  # @option (see Pagerduty::EventsApiV1#trigger)
178
178
  def trigger(description, options = {})
179
- if options.key?(:incident_key)
180
- raise ArgumentError, "incident_key provided"
181
- end
179
+ raise ArgumentError, "incident_key provided" if options.key?(:incident_key)
182
180
 
183
181
  options = options.merge(description: description)
184
182
  options[:incident_key] = @incident_key unless @incident_key.nil?
@@ -268,9 +266,7 @@ module Pagerduty
268
266
  event_type: event_type,
269
267
  )
270
268
  response = @transport.send_payload(args)
271
- unless response["status"] == "success"
272
- raise PagerdutyException.new(self, response, response["message"])
273
- end
269
+ raise PagerdutyException.new(self, response, response["message"]) unless response["status"] == "success"
274
270
 
275
271
  response
276
272
  end
@@ -5,8 +5,8 @@ require "time"
5
5
  module Pagerduty
6
6
  # Trigger incidents via the PagerDuty Events API version 2.
7
7
  #
8
- # @see https://v2.developer.pagerduty.com/docs/events-api-v2 PagerDuty Events
9
- # API V2 documentation
8
+ # @see https://developer.pagerduty.com/docs/ZG9jOjExMDI5NTgw-events-api-v2-overview
9
+ # PagerDuty Events API V2 documentation
10
10
  #
11
11
  # @see Pagerduty.build
12
12
  #
@@ -269,9 +269,7 @@ module Pagerduty
269
269
  event_action: event_action,
270
270
  )
271
271
  response = @transport.send_payload(payload)
272
- unless response["status"] == "success"
273
- raise PagerdutyException.new(self, response, response["message"])
274
- end
272
+ raise PagerdutyException.new(self, response, response["message"]) unless response["status"] == "success"
275
273
 
276
274
  response
277
275
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pagerduty
4
- VERSION = "3.0.0"
4
+ VERSION = "4.0.1"
5
5
  end
data/lib/pagerduty.rb CHANGED
@@ -4,7 +4,6 @@ require "pagerduty/version"
4
4
  require "pagerduty/http_transport"
5
5
  require "pagerduty/events_api_v1"
6
6
  require "pagerduty/events_api_v2"
7
- require "pagerduty/legacy"
8
7
 
9
8
  class PagerdutyException < StandardError
10
9
  attr_reader :pagerduty_instance, :api_response
@@ -65,9 +64,7 @@ module Pagerduty
65
64
  # provided. Or if the provided api_version is unsupported.
66
65
  #
67
66
  def self.build(config)
68
- unless config.key?(:integration_key)
69
- raise ArgumentError, "integration_key not provided"
70
- end
67
+ raise ArgumentError, "integration_key not provided" unless config.key?(:integration_key)
71
68
  raise ArgumentError, "incident_key provided" if config.key?(:incident_key)
72
69
 
73
70
  version = config.fetch(:api_version) do
metadata CHANGED
@@ -1,90 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagerduty
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - Charlie Somerville
7
+ - Hailey Somerville
8
8
  - Orien Madgwick
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-04-20 00:00:00.000000000 Z
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
- - !ruby/object:Gem::Dependency
29
- name: bundler
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
- - !ruby/object:Gem::Dependency
43
- name: rake
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: '0'
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: '0'
56
- - !ruby/object:Gem::Dependency
57
- name: rspec-given
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: '0'
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- - !ruby/object:Gem::Dependency
71
- name: rubocop
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - "<"
75
- - !ruby/object:Gem::Version
76
- version: '0.77'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - "<"
82
- - !ruby/object:Gem::Version
83
- version: '0.77'
84
- description: Provides a lightweight interface for calling the PagerDuty Integration
85
- API
12
+ date: 2024-02-17 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Provides a lightweight interface for calling the PagerDuty Events API
86
15
  email:
87
- - charlie@charliesomerville.com
16
+ - hailey@hailey.lol
88
17
  - _@orien.io
89
18
  executables: []
90
19
  extensions: []
@@ -97,17 +26,17 @@ files:
97
26
  - lib/pagerduty/events_api_v1.rb
98
27
  - lib/pagerduty/events_api_v2.rb
99
28
  - lib/pagerduty/http_transport.rb
100
- - lib/pagerduty/legacy.rb
101
29
  - lib/pagerduty/version.rb
102
- homepage: http://github.com/envato/pagerduty
30
+ homepage: https://github.com/envato/pagerduty
103
31
  licenses:
104
32
  - MIT
105
33
  metadata:
106
34
  bug_tracker_uri: https://github.com/envato/pagerduty/issues
107
- changelog_uri: https://github.com/envato/pagerduty/blob/v3.0.0/CHANGELOG.md
108
- documentation_uri: https://www.rubydoc.info/gems/pagerduty/3.0.0
109
- source_code_uri: https://github.com/envato/pagerduty/tree/v3.0.0
110
- post_install_message:
35
+ changelog_uri: https://github.com/envato/pagerduty/blob/v4.0.1/CHANGELOG.md
36
+ documentation_uri: https://www.rubydoc.info/gems/pagerduty/4.0.1
37
+ homepage_uri: https://github.com/envato/pagerduty
38
+ source_code_uri: https://github.com/envato/pagerduty/tree/v4.0.1
39
+ post_install_message:
111
40
  rdoc_options: []
112
41
  require_paths:
113
42
  - lib
@@ -115,15 +44,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
44
  requirements:
116
45
  - - ">="
117
46
  - !ruby/object:Gem::Version
118
- version: '0'
47
+ version: '2.3'
119
48
  required_rubygems_version: !ruby/object:Gem::Requirement
120
49
  requirements:
121
50
  - - ">="
122
51
  - !ruby/object:Gem::Version
123
52
  version: '0'
124
53
  requirements: []
125
- rubygems_version: 3.1.2
126
- signing_key:
54
+ rubygems_version: 3.5.6
55
+ signing_key:
127
56
  specification_version: 4
128
- summary: Pagerduty Integration API client library
57
+ summary: PagerDuty Events API client library
129
58
  test_files: []
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This file contains patches to provide backwards compatibility with version 2
4
- # of the pagerduty gem. On the release of the next major version (4.0) it will
5
- # be deleted, thus breaking backwards compatibility.
6
-
7
- PagerdutyIncident = Pagerduty::EventsApiV1::Incident
8
-
9
- Pagerduty::EventsApiV1::Incident.class_eval do
10
- def service_key
11
- @integration_key
12
- end
13
- end
14
-
15
- Pagerduty::EventsApiV1.class_eval do
16
- alias_method :get_incident, :incident
17
-
18
- def service_key
19
- @config[:integration_key]
20
- end
21
- end
22
-
23
- Pagerduty.class_eval do
24
- def self.new(service_key, options = {})
25
- build(
26
- integration_key: service_key,
27
- api_version: 1,
28
- http_proxy: {
29
- host: options[:proxy_host],
30
- port: options[:proxy_port],
31
- username: options[:proxy_username],
32
- password: options[:proxy_password],
33
- },
34
- )
35
- end
36
- end