watchfor 0.10.0 → 0.11.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: 4922ce5a8ab3f8757d67110dd6705ec23cd07190e2ce12fb8e3a76b0bef72cd7
4
- data.tar.gz: 53ae8a93fb27b7e96ca47cd7383fbbbc1207c1cadc597316429b6b4f43232521
3
+ metadata.gz: 30416669c4f7bb2b6361e750e035cd588c36911d9a1dea6d4805dd82c90edc0d
4
+ data.tar.gz: fbca77d7ef766ebf9b8579a3247935919bc877e966f1fed665d09d79f5437124
5
5
  SHA512:
6
- metadata.gz: a6fcfeb516a7621f6aa6b8dc18eb0492b928052158aee32cd51319344d06e210006527303927f5453f1b0106fcfe4dafeb10f18ea3b1584670b6532b8049f714
7
- data.tar.gz: 37a2e3ad2df077d130609042d0c61cb2aabb8bacb1d9f56c2fff503f819f09d5847f5d6e33334c3267342d91f504f5e3811888c336e447a91341d6cf8386510d
6
+ metadata.gz: c9a3425976be45501efba88d5d777552ad53230ce6db50b30f6e91c26da3d06003b1e6ba3ef0b518350782dc9b0e55a82e17b6368a6fe23d13cdafe3377df53b
7
+ data.tar.gz: 87e6389322c82c4cbb9b79ec25a808a9db0c0c4c9e8c4cccd26bd9ad58dc812d2ade6210a3ecd705c418b3d4b9d0c9dc4142198f7608f2b047f2817530ae8347
data/README.md CHANGED
@@ -43,6 +43,11 @@ wf.monitors.reset(mon["id"])
43
43
  # Page integrity: after a deploy, accept what the newest check saw as the new baseline
44
44
  wf.monitors.accept_baseline(integrity_monitor_id)
45
45
 
46
+ # Browser checks: try a Playwright script once (nothing saved), then read the result
47
+ run = wf.playwright.test_run(script: script, target: "https://shop.example.com")
48
+ wf.playwright.get_test_run(run["id"]) # status: queued | running | done | error
49
+ wf.variables.put("LOGIN_PASSWORD", value: password, secret: true)
50
+
46
51
  # Older checks: pass next_cursor back as cursor (keep the same hours/success)
47
52
  page = wf.monitors.checks(mon["id"], hours: 24, limit: 100)
48
53
  wf.monitors.checks(mon["id"], hours: 24, limit: 100, cursor: page["next_cursor"]) if page["next_cursor"]
@@ -27,7 +27,7 @@ module Watchfor
27
27
  class Client
28
28
  attr_reader :monitors, :alert_rules, :incidents, :hosts, :status_pages, :on_call, :notification_channels,
29
29
  :maintenance_windows, :contacts, :contact_groups,
30
- :diagnostics
30
+ :diagnostics, :playwright, :variables
31
31
 
32
32
  def initialize(api_key:, base_url: DEFAULT_BASE_URL, timeout: 30)
33
33
  raise ArgumentError, "api_key is required" if api_key.nil? || api_key.empty?
@@ -46,6 +46,8 @@ module Watchfor
46
46
  @contacts = Contacts.new(self)
47
47
  @contact_groups = ContactGroups.new(self)
48
48
  @diagnostics = Diagnostics.new(self)
49
+ @playwright = Playwright.new(self)
50
+ @variables = Variables.new(self)
49
51
  end
50
52
 
51
53
  # Core request. +query+ and +body+ are optional hashes.
@@ -141,6 +143,14 @@ module Watchfor
141
143
  end
142
144
  # One check in full detail (redacted).
143
145
  def check_detail(id, run_id) = @c.request("GET", "/monitors/#{id}/checks/#{run_id}")
146
+ # Browser checks: runs, newest first (status: "failed" | "flaky").
147
+ def runs(id, status: nil, limit: nil, cursor: nil)
148
+ @c.request("GET", "/monitors/#{id}/runs", query: { status: status, limit: limit, cursor: cursor })
149
+ end
150
+ # Browser checks: one run — steps, errors, Web Vitals, screenshots, trace link.
151
+ def run(id, run_id) = @c.request("GET", "/monitors/#{id}/runs/#{run_id}")
152
+ def script_versions(id) = @c.request("GET", "/monitors/#{id}/script/versions")
153
+ def script_version(id, version) = @c.request("GET", "/monitors/#{id}/script/versions/#{version}")
144
154
  # Page integrity monitors: the accepted baseline of every watched page.
145
155
  def baseline(id) = @c.request("GET", "/monitors/#{id}/baseline")
146
156
  # Page integrity monitors: accept what the newest check saw as the new
@@ -152,6 +162,23 @@ module Watchfor
152
162
  end
153
163
  end
154
164
 
165
+ # Browser checks: run a Playwright script once without saving it.
166
+ class Playwright < Namespace
167
+ def test_run(body) = @c.request("POST", "/playwright/test-runs", body: body)
168
+ def get_test_run(id) = @c.request("GET", "/playwright/test-runs/#{id}")
169
+ end
170
+
171
+ # Org variables and secrets (process.env.NAME); secrets are write-only.
172
+ class Variables < Namespace
173
+ def list = @c.request("GET", "/variables")
174
+ def put(name, value: nil, secret: false)
175
+ body = { secret: secret }
176
+ body[:value] = value unless value.nil?
177
+ @c.request("PUT", "/variables/#{name}", body: body)
178
+ end
179
+ def delete(name) = @c.request("DELETE", "/variables/#{name}")
180
+ end
181
+
155
182
  class AlertRules < Namespace
156
183
  def list(monitor_id) = @c.request("GET", "/monitors/#{monitor_id}/alert-rules")
157
184
  def get(monitor_id, rule_id) = @c.request("GET", "/monitors/#{monitor_id}/alert-rules/#{rule_id}")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Watchfor
4
- VERSION = "0.10.0"
4
+ VERSION = "0.11.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watchfor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - WatchFor
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-09-25 00:00:00.000000000 Z
11
+ date: 2026-10-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Zero-dependency Ruby client for the WatchFor REST API (monitors, alert
14
14
  rules, incidents, maintenance windows) plus a `watchfor` CLI.