barsoom_utils 0.2.0.52 → 0.2.0.53

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e5650ed2fa6376369224481daf22422e6b3d31e43c8ef329b9c124963e20d7e
4
- data.tar.gz: 223889cb8fb7fed5bba9e2e789393caf7c3366d2482d91099fab9947309909d6
3
+ metadata.gz: 2a1a6a455134d4c9d04a0ae1d08a1ea7275d586dc1c8b4e159927f01d0fa4d21
4
+ data.tar.gz: 1fad27905c02a851c4df5e9fbc3473278d92bd6713023984d12bff6389e21b87
5
5
  SHA512:
6
- metadata.gz: 3ec9e6f8b0f1a349efa4898f325bd4d0f03ca1938e4cc5ae6127f0a07b3151333c791606dbea4e1a799b90428532f0e5aa036bf922bc5ff9fee950f576b00aa8
7
- data.tar.gz: 888daf15072cb2e9573b2cd08cf159ddd0de7abfa6388a5b0a21e311e51f2a1a47f1f96f7700081b428f6d7bc9cc17b8ab75c8910fcf0c363f4f8bd98b01b40f
6
+ metadata.gz: 6873a517cb877c76d554dbd882fbaba6c4d83cad68140e917ca1fa2a3ba2ca802ac105632b008f068203d4320ff68794d13da2acd22411c5280ec22a7c2da978
7
+ data.tar.gz: 8a1c658324e7c2b5b598ad7a9bf57f6a9858025871ee304294b456f113656a4edbf9b4edcc3592633645968e69658426a2360c9d16112fa88b20413a36e9eb16
data/README.md CHANGED
@@ -27,7 +27,6 @@ List of utils:
27
27
  require "barsoom_utils/exception_notifier" # Notify devs about an exception without necessarily letting it appear to the user as a 500 error.
28
28
  require "barsoom_utils/spec/debug_helpers" # Add show_page helper for capybara feature specs
29
29
  require "barsoom_utils/feature_toggle" # Convenient way of hiding/showing a feature.
30
- require "barsoom_utils/ping_health_check" # Report running of background jobs to healthchecks.io. NOTE: You need to set the env ENABLE_HEALTH_CHECKS=true to enable reporting (only set it in production).
31
30
  ```
32
31
 
33
32
  We also have some shared configuration. To use our Rubocop configuration, add this to the beginning of your `.rubocop.yml`.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0.52
1
+ 0.2.0.53
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barsoom_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.52
4
+ version: 0.2.0.53
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Skogberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-01 00:00:00.000000000 Z
11
+ date: 2025-05-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -31,7 +31,6 @@ files:
31
31
  - lib/barsoom_utils.rb
32
32
  - lib/barsoom_utils/exception_notifier.rb
33
33
  - lib/barsoom_utils/feature_toggle.rb
34
- - lib/barsoom_utils/ping_health_check.rb
35
34
  - lib/barsoom_utils/spec/debug_helpers.rb
36
35
  - lib/barsoom_utils/version.rb
37
36
  - script/test
@@ -39,7 +38,6 @@ files:
39
38
  - shared_rubocop_rails.yml
40
39
  - spec/exception_notifier_spec.rb
41
40
  - spec/feature_toggle_spec.rb
42
- - spec/ping_health_check_spec.rb
43
41
  - spec/spec/debug_helpers_spec.rb
44
42
  - spec/spec_helper.rb
45
43
  homepage: https://dev.auctionet.com/
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
- require "httparty"
3
- require "attr_extras"
4
- require "barsoom_utils/exception_notifier"
5
-
6
- module BarsoomUtils
7
- class PingHealthCheck
8
- method_object :id
9
-
10
- def call
11
- return unless ENV["ENABLE_HEALTH_CHECKS"]
12
-
13
- response = ping_healthcheck
14
-
15
- if response.code != 200
16
- # "The presence of the cf-request-id header in the response confirms
17
- # the request was proxied through Cloudflare"
18
- # https://support.cloudflare.com/hc/en-us/articles/203118044-Gathering-information-for-troubleshooting-sites
19
- raise "Bad response, cf-request-id header: #{response.headers["cf-request-id"]}, response body: #{response.inspect}"
20
- else
21
- response
22
- end
23
- rescue => ex
24
- BarsoomUtils::ExceptionNotifier.message("Couldn't report to healthchecks.io, maybe the service is down?", "Check: #{id}, Error: #{ex.inspect}")
25
- end
26
-
27
- private
28
-
29
- def ping_healthcheck
30
- HTTParty.get("https://hc-ping.com/#{id}")
31
- end
32
- end
33
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
- require "barsoom_utils/ping_health_check"
3
-
4
- RSpec.describe BarsoomUtils::PingHealthCheck, ".call" do
5
- around do |example|
6
- ENV["ENABLE_HEALTH_CHECKS"] = "true"
7
- example.run
8
- ENV["ENABLE_HEALTH_CHECKS"] = nil
9
- end
10
-
11
- it "does nothing on a 200 OK response" do
12
- expect(HTTParty).to receive(:get).with("https://hc-ping.com/foo").and_return(double(:response, code: 200, headers: {}))
13
-
14
- BarsoomUtils::PingHealthCheck.call("foo")
15
- end
16
-
17
- it "includes CloudFlare request ID header information in failure message" do
18
- expect(HTTParty).to receive(:get).with("https://hc-ping.com/foo").and_return(double(:response, code: 503, headers: { "cf-request-id" => "023aa754ae0000517ab8829200000001" }))
19
- expect(BarsoomUtils::ExceptionNotifier).to receive(:message).with(anything, /cf-request-id header: 023aa754ae0000517ab8829200000001/)
20
-
21
- BarsoomUtils::PingHealthCheck.call("foo")
22
- end
23
-
24
- it "silently reports an error to devs if it fails with a bad response code" do
25
- expect(HTTParty).to receive(:get).with("https://hc-ping.com/foo").and_return(double(:response, code: 404, headers: {}))
26
- expect(BarsoomUtils::ExceptionNotifier).to receive(:message).with(anything, /foo/)
27
-
28
- BarsoomUtils::PingHealthCheck.call("foo")
29
- end
30
-
31
- it "silently reports an error to devs if it fails with an exception" do
32
- expect(HTTParty).to receive(:get).with("https://hc-ping.com/foo").and_raise("fail")
33
- expect(BarsoomUtils::ExceptionNotifier).to receive(:message).with(anything, /foo/)
34
-
35
- BarsoomUtils::PingHealthCheck.call("foo")
36
- end
37
- end