bugwatch-ruby 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5bfce1e168aea51e8e32c863fbe5cf0c8fb6818b3769beaa8cf3d6258074ca5e
4
- data.tar.gz: e371b7debb6555bfbad2c82440df057d70a2e69267b2c252bbd8973206721dd0
3
+ metadata.gz: 5d0be9627dc1693332f0a201853dbca22da0e1f5a1e98ea7253ef5749c94f245
4
+ data.tar.gz: d896401132b2ba5eb708fac049711184a12a0cc0001831121e9a11bccee16ebc
5
5
  SHA512:
6
- metadata.gz: ff5482ec3e65aecd1309ddc6b68bff66c19cbaef30b86ea936681b4db7e05d60f83016129ef702aace4c74efa72618a313f9d861c9dfb0a6c841be8e6607e463
7
- data.tar.gz: 62e271e5fa126376f47bce1dd378bda5c3012599613ede8144d475621736f02079da71b9b23bcd6daa768c292dfcd7ffc02174328c6da265aba835a5828eb69d
6
+ metadata.gz: c1212d03ecfe11f84acb0f6ef8a1dda3e97b3896bbd878fba89bd1f933b6275afabd2d51a7bd49a934cd25652e8641a37d070c9a034d3d72be410152c4a0aefd
7
+ data.tar.gz: 79c7558fc9c17f8540e51638a0958f520faaef012cf524d0433c87d801dcc3bf4d4abdcad740d8f77d481fbe54fd4b8906c37b5395364bf26cb16e212e8f3f67
@@ -1,3 +1,3 @@
1
1
  module Bugwatch
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/bugwatch.rb CHANGED
@@ -49,6 +49,61 @@ module Bugwatch
49
49
  BreadcrumbCollector.add(message, type: type, metadata: metadata)
50
50
  end
51
51
 
52
+ def check_in(slug)
53
+ return unless configuration.api_key
54
+ return unless configuration.endpoint
55
+
56
+ Thread.new do
57
+ uri = URI.parse("#{configuration.endpoint.chomp("/")}/api/v1/monitors/#{slug}/check_in")
58
+
59
+ http = Net::HTTP.new(uri.host, uri.port)
60
+ http.use_ssl = uri.scheme == "https"
61
+ http.open_timeout = 3
62
+ http.read_timeout = 3
63
+ http.write_timeout = 3
64
+
65
+ request = Net::HTTP::Post.new(uri.path)
66
+ request["X-Api-Key"] = configuration.api_key
67
+ request["X-BugWatch-Ruby"] = Bugwatch::VERSION
68
+
69
+ http.request(request)
70
+ rescue StandardError
71
+ # Fire-and-forget: never affect the host app
72
+ end
73
+ end
74
+
75
+ def track_deploy(version:, environment: nil, description: nil, deployed_by: nil)
76
+ return unless configuration.api_key
77
+ return unless configuration.endpoint
78
+
79
+ env = environment || configuration.release_stage
80
+
81
+ Thread.new do
82
+ uri = URI.parse("#{configuration.endpoint.chomp("/")}/api/v1/deploys")
83
+
84
+ http = Net::HTTP.new(uri.host, uri.port)
85
+ http.use_ssl = uri.scheme == "https"
86
+ http.open_timeout = 3
87
+ http.read_timeout = 3
88
+ http.write_timeout = 3
89
+
90
+ request = Net::HTTP::Post.new(uri.path)
91
+ request["Content-Type"] = "application/json"
92
+ request["X-Api-Key"] = configuration.api_key
93
+ request["X-BugWatch-Ruby"] = Bugwatch::VERSION
94
+
95
+ payload = { version: version, environment: env, deployed_at: Time.now.iso8601 }
96
+ payload[:description] = description if description
97
+ payload[:deployed_by] = deployed_by if deployed_by
98
+
99
+ request.body = JSON.generate(payload)
100
+
101
+ http.request(request)
102
+ rescue StandardError
103
+ # Fire-and-forget: never affect the host app
104
+ end
105
+ end
106
+
52
107
  def transaction_buffer
53
108
  @transaction_buffer ||= TransactionBuffer.new(config: configuration)
54
109
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugwatch-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - BugWatch
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-04-12 00:00:00.000000000 Z
10
+ date: 2026-04-13 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: railties