Tests ADN / test (push) Canceled after 0s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: GEMMA <noreply@gemma.dtic>
57 lines
1.6 KiB
Ruby
57 lines
1.6 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
# lib_checkins.rb — Reporte proactivo de estado de individuos F1 (P216)
|
|
# ==============================================================================
|
|
# Complementa lib_tokens.rb (identidad) con un registro simple de "qué contó cada
|
|
# individuo de sí mismo la última vez" — mismo espíritu que Registro.disponible
|
|
# para keys: NEXXA solo guarda lo que le reportan, nunca sale a diagnosticar
|
|
# nada por su cuenta. Quien consulta (GEMMA, vía bandeja.rb) decide qué hacer
|
|
# con la antigüedad del último reporte.
|
|
# ==============================================================================
|
|
|
|
require 'json'
|
|
require 'time'
|
|
require_relative 'lib_estado'
|
|
|
|
module Nexxa
|
|
module Checkins
|
|
STATE_FILE = Estado.ruta('checkins')
|
|
|
|
# Estado vía Nexxa::Estado (P335/Fase 17)
|
|
def self.leer
|
|
Estado.leer('checkins', STATE_FILE, {})
|
|
end
|
|
|
|
def self.guardar(state)
|
|
Estado.guardar('checkins', STATE_FILE, state)
|
|
end
|
|
|
|
def self.mutar(&)
|
|
Estado.mutar('checkins', STATE_FILE, {}, &)
|
|
end
|
|
|
|
# El individuo llega autenticado (individuo_autenticado(req) en server.rb,
|
|
# vía Nexxa::Tokens.verificar) — nunca confiar en un id que venga en el
|
|
# body, el token YA identifica quién reporta.
|
|
def self.registrar(individuo, estado:, detalle: nil)
|
|
mutar do |state|
|
|
state[individuo] = {
|
|
'estado' => estado.to_s,
|
|
'detalle' => detalle,
|
|
'ultimo_reporte' => Time.now.utc.iso8601
|
|
}
|
|
state
|
|
end
|
|
state[individuo]
|
|
end
|
|
|
|
def self.estado(individuo)
|
|
leer[individuo]
|
|
end
|
|
|
|
def self.listar
|
|
leer
|
|
end
|
|
end
|
|
end
|