watchfor 0.9.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: 52bdfe4d4d6aa5580e89ea85b1966b865d33b3c945ed165b570f2284bc04b5f7
4
- data.tar.gz: e6ca07b3a474a8601d85e652418c6c0d3dc06cf8439d91a1e326dae3525b0145
3
+ metadata.gz: 30416669c4f7bb2b6361e750e035cd588c36911d9a1dea6d4805dd82c90edc0d
4
+ data.tar.gz: fbca77d7ef766ebf9b8579a3247935919bc877e966f1fed665d09d79f5437124
5
5
  SHA512:
6
- metadata.gz: 0d68188b431c8e304b7a7b807207d37cb7f5e16e5b3f896ab330994d1bc1cdd200338745fc0ca1a8a0bcffd082ae6bb48da2d7d8e279cc1254829c6bfdc11b5d
7
- data.tar.gz: 6bfd789a1c7933cb7bd856a3784d93fced814961df91102aac1bcfd4b48a39126102aa69eeba3f81753b2dd6828f3daec07c329d13435acb4fecfdef846dc17a
6
+ metadata.gz: c9a3425976be45501efba88d5d777552ad53230ce6db50b30f6e91c26da3d06003b1e6ba3ef0b518350782dc9b0e55a82e17b6368a6fe23d13cdafe3377df53b
7
+ data.tar.gz: 87e6389322c82c4cbb9b79ec25a808a9db0c0c4c9e8c4cccd26bd9ad58dc812d2ade6210a3ecd705c418b3d4b9d0c9dc4142198f7608f2b047f2817530ae8347
data/README.md CHANGED
@@ -40,6 +40,14 @@ wf.incidents.exclude(19351, reason: "Probe-side DNS hiccup")
40
40
  # Irreversible: wipe a monitor's checks and incidents; uptime restarts "since reset"
41
41
  wf.monitors.reset(mon["id"])
42
42
 
43
+ # Page integrity: after a deploy, accept what the newest check saw as the new baseline
44
+ wf.monitors.accept_baseline(integrity_monitor_id)
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
+
43
51
  # Older checks: pass next_cursor back as cursor (keep the same hours/success)
44
52
  page = wf.monitors.checks(mon["id"], hours: 24, limit: 100)
45
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.
@@ -136,10 +138,45 @@ module Watchfor
136
138
  # Recent probe results, newest first. Page with the response's next_cursor -> cursor:
137
139
  # (keep the same hours/success); "locations" is the per-location breakdown for the whole window.
138
140
  def checks(id, hours: nil, limit: nil, success: nil, cursor: nil, **query)
139
- def check_detail(id, run_id) = @c.request("GET", "/monitors/#{id}/checks/#{run_id}")
140
141
  @c.request("GET", "/monitors/#{id}/checks",
141
142
  query: { hours: hours, limit: limit, success: success, cursor: cursor, **query })
142
143
  end
144
+ # One check in full detail (redacted).
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}")
154
+ # Page integrity monitors: the accepted baseline of every watched page.
155
+ def baseline(id) = @c.request("GET", "/monitors/#{id}/baseline")
156
+ # Page integrity monitors: accept what the newest check saw as the new
157
+ # baseline — all pages, or only `pages:`. Call it from a deploy pipeline
158
+ # a minute after the release; unfetched pages come back in "skipped".
159
+ def accept_baseline(id, pages: nil, idempotency_key: nil)
160
+ @c.request("POST", "/monitors/#{id}/baseline",
161
+ body: pages ? { pages: pages } : {}, idempotency_key: idempotency_key)
162
+ end
163
+ end
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}")
143
180
  end
144
181
 
145
182
  class AlertRules < Namespace
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Watchfor
4
- VERSION = "0.9.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.9.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-22 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.