barsoom_utils 0.2.0.50 → 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: dcbd429ff07728635a6d0a85ccfde14b49fd3fcb5387cb2ba920c011f49de2be
4
- data.tar.gz: f731219849cb05d7ccfd39857ad6706b47acd6f1c337c1683bbb2702963e9fe1
3
+ metadata.gz: 2a1a6a455134d4c9d04a0ae1d08a1ea7275d586dc1c8b4e159927f01d0fa4d21
4
+ data.tar.gz: 1fad27905c02a851c4df5e9fbc3473278d92bd6713023984d12bff6389e21b87
5
5
  SHA512:
6
- metadata.gz: 0fda420e5f70e95df7ce6e0b52149447fe5db1d221a61f4996faf3228d174f582a580974553d96c76207f827edb5d448593d57ac8edce7170b271f72a5176d75
7
- data.tar.gz: 0c9dfd01bc16f0b746a6386b55fea51d5f6d526d8abf387d1ad01fcbc388cc677a089371fb2fe2df13d43c20aeae9c0a27d289d227d468f9380033a98904ef4b
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.50
1
+ 0.2.0.53
data/shared_rubocop.yml CHANGED
@@ -286,6 +286,7 @@ Layout/ClassStructure:
286
286
  Style/HashSyntax:
287
287
  Enabled: true
288
288
  EnforcedStyle: ruby19
289
+ EnforcedShorthandSyntax: always # https://docs.rubocop.org/rubocop/cops_style.html#enforcedshorthandsyntax_-always-stylehashsyntax
289
290
 
290
291
  # https://docs.rubocop.org/rubocop/cops_gemspec.html#gemspecduplicatedassignment
291
292
  Gemspec/DuplicatedAssignment:
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.50
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-03-31 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