s-eto-hub's picture
Commit de nettoyage des binaires
097eaf0
Raw History Blame Contribute Delete
3.49 kB
# frozen_string_literal: true
module Firecrawl
module Models
class Monitor
attr_reader :id, :name, :status, :schedule, :next_run_at, :last_run_at,
:current_check_id, :targets, :webhook, :notification,
:retention_days, :estimated_credits_per_month,
:last_check_summary, :goal, :judge_enabled,
:created_at, :updated_at
def initialize(data)
@id = data["id"]
@name = data["name"]
@status = data["status"]
@schedule = data["schedule"]
@next_run_at = data["nextRunAt"]
@last_run_at = data["lastRunAt"]
@current_check_id = data["currentCheckId"]
@targets = data["targets"] || []
@webhook = data["webhook"]
@notification = data["notification"]
@retention_days = data["retentionDays"]
@estimated_credits_per_month = data["estimatedCreditsPerMonth"]
@last_check_summary = data["lastCheckSummary"]
@goal = data["goal"]
@judge_enabled = data["judgeEnabled"] || false
@created_at = data["createdAt"]
@updated_at = data["updatedAt"]
end
end
class MonitorCheck
attr_reader :id, :monitor_id, :status, :trigger, :scheduled_for,
:started_at, :finished_at, :estimated_credits,
:reserved_credits, :actual_credits, :billing_status,
:summary, :target_results, :notification_status, :error,
:created_at, :updated_at
def initialize(data)
@id = data["id"]
@monitor_id = data["monitorId"]
@status = data["status"]
@trigger = data["trigger"]
@scheduled_for = data["scheduledFor"]
@started_at = data["startedAt"]
@finished_at = data["finishedAt"]
@estimated_credits = data["estimatedCredits"]
@reserved_credits = data["reservedCredits"]
@actual_credits = data["actualCredits"]
@billing_status = data["billingStatus"]
@summary = data["summary"] || {}
@target_results = data["targetResults"]
@notification_status = data["notificationStatus"]
@error = data["error"]
@created_at = data["createdAt"]
@updated_at = data["updatedAt"]
end
end
# A monitor check with paginated page results inlined.
#
# Each entry in {#pages} is a {Hash} with the standard monitor page
# fields (id, targetId, url, status, previousScrapeId,
# currentScrapeId, statusCode, error, metadata, createdAt) plus:
#
# * +"diff"+ – when the page changed. A hash with +"text"+ (markdown
# unified diff) and/or +"json"+ (parseDiff AST for markdown
# monitors, or a per-field +{ "previous", "current" }+ map for
# JSON-extraction monitors).
# * +"snapshot"+ – present on JSON / mixed-mode monitors. A hash
# with a +"json"+ key holding the current JSON extraction at this
# run.
# * +"judgment"+ – present when the monitor has a +goal+ set and
# judging is enabled. A hash with +"meaningful"+ (Boolean),
# +"confidence"+ (+"high"+ / +"medium"+ / +"low"+), +"reason"+
# (String), and +"fields"+ (Array of String) describing which
# fields the judge weighed.
class MonitorCheckDetail < MonitorCheck
attr_accessor :pages, :next_url
def initialize(data)
super
@pages = data["pages"] || []
@next_url = data["next"]
end
end
end
end