module GovauStatus
Constants
- STYLE_TITLE
Public Instance Methods
Source
# File lib/govau_status.rb, line 17 def check_ptv(devid:, key:, fetch: nil) path = "/v3/route_types" url = GovauPtv.build_url(path, devid: devid, key: key) payload = GovauPtv.fetch_json(url, fetch: fetch) types = Array(payload["route_types"]) if types.any? { ready: true, detail: "PTV API reachable" } else { ready: false, detail: "PTV API unreachable" } end rescue StandardError { ready: false, detail: "PTV API unreachable" } end
Source
# File lib/govau_status.rb, line 31 def format_status(ptv_configured:, ptv_check:) lines = [ IrcFormat.report_header(tag: "GOVAU", title: "Service status", style: STYLE_TITLE) ] if ptv_configured lines << "PTV credentials configured ยท #{ptv_check[:detail]}" else lines << "PTV credentials not configured" end lines << "CKAN data.gov.au search available (no API key required)" lines << IrcFormat.report_footer("PTV Timetable API", "data.gov.au") lines.join("\n") end