opsgenie-heartbeat 0.2.0 → 0.2.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: da1c834d20e5005f05c6d801a5bd4f9dac5863731ff2955e797a03df77d0d84d
4
- data.tar.gz: c289500bca6f19798e742f8a195fefc67b85836235e1f7f45fd8abfe645c24b8
3
+ metadata.gz: 3faffdf2193d9391d253f2657fbc288b0228092dbe4b6ec88179811eb5726338
4
+ data.tar.gz: 4022e80c8cbdb60c33a60fc826b42c11e9d1664526e6e17e4c7a900114695c89
5
5
  SHA512:
6
- metadata.gz: 3a37ca5d1f7f334b01168188a2b250f726dd043489b4a77dcc9d495990256c426fabdd83d37300fc1cd7e7b907b0609d652ba133d14d01c56ff845bfa8b64cac
7
- data.tar.gz: 34bdfde8fa03e238692ddc8b3cdfc0c77389637008a23e67dcaab13b177c37f4cf71787ef4cd901e74b1f2ffd5305d30bee9b50aa2b93d5260869693ade50654
6
+ metadata.gz: 5eaf4c9522b34071ac08ad7e17c966b8b2b9f33218ae61488cdfb5a9add019b5074762c843af53a3884d32b27b9538e99ad94fc7e41b63373d51cf4dbf5cdd34
7
+ data.tar.gz: c37a8695d605824fc6c6c1ade08b36ed5d771143d581d191d8c79c06d36079628829ec2219530da60f2845ebd20ea32e10998394a605049045b2763b4e08dbe8
@@ -1,3 +1,7 @@
1
+ ## Updates in version 0.2.1:
2
+ - fix ensure always trying to create heartbeat
3
+ - use get instead of post for pinging
4
+
1
5
  ## Updates in version 0.2.0:
2
6
 
3
7
  - Allow updating of heartbeats
@@ -14,8 +14,11 @@ module Opsgenie
14
14
  uri = URI.parse("https://api.opsgenie.com/v2/heartbeats/#{Rack::Utils.escape name}/ping")
15
15
  http = Net::HTTP.new(uri.host, uri.port)
16
16
  http.use_ssl = true
17
- data = {name: name}
18
- http.post(uri.path, data.to_json, {'Authorization': "GenieKey #{configuration.api_key}", "Content-Type": "application/json"})
17
+ response = http.get(uri.path, {'Authorization': "GenieKey #{configuration.api_key}"})
18
+ if !response.is_a?(Net::HTTPSuccess)
19
+ configuration.logger.info("Error creating or updating heartbeat: #{response}") if configuration.logger
20
+ end
21
+
19
22
  rescue => e
20
23
  resolve_exception e
21
24
  end
@@ -29,7 +32,7 @@ module Opsgenie
29
32
  uri = URI.parse(url_for_resource(:get, name))
30
33
  http = Net::HTTP.new(uri.host, uri.port)
31
34
  http.use_ssl = true
32
- response = http.get(uri.path)
35
+ response = http.get(uri.path, {'Authorization': "GenieKey #{configuration.api_key}"})
33
36
  unless response.is_a?(Net::HTTPSuccess)
34
37
  create(name: original_name, description: description, interval: interval, unit: unit, enabled: enabled, team: team)
35
38
  end
@@ -86,7 +89,12 @@ module Opsgenie
86
89
  enabled: enabled,
87
90
  ownerTeam: team
88
91
  }.reject {|_, value| value.nil?}
89
- http.public_send(verb, uri.path, doc.to_json, {'Authorization': "GenieKey #{configuration.api_key}", "Content-Type": "application/json"})
92
+ response = http.public_send(verb, uri.path, doc.to_json, {'Authorization': "GenieKey #{configuration.api_key}", "Content-Type": "application/json"})
93
+
94
+ if !response.is_a?(Net::HTTPSuccess)
95
+ configuration.logger.info("Error creating or updating heartbeat: #{response}") if configuration.logger
96
+ end
97
+
90
98
  rescue => e
91
99
  resolve_exception e
92
100
  end
@@ -1,5 +1,5 @@
1
1
  module Opsgenie
2
2
  module Heartbeat
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opsgenie-heartbeat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dressipi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-15 00:00:00.000000000 Z
11
+ date: 2018-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler