Sha256: 8271f04cf72c72cf59b72c1080f0c8bf24b92c1af542cd5e82805ee4d1191d30
Contents?: true
Size: 1.04 KB
Versions: 7
Compression:
Stored size: 1.04 KB
Contents
require 'json/ext' module Hieracles module Formats # format intended to be used for an api server class Json < Hieracles::Format def info(_) @node.info.merge(alerts).to_json end def facts(_) @node.facts.merge(alerts).to_json end def files(_) { 'files' => @node.files }.merge(alerts).to_json end def paths(_) { 'paths' => @node.paths }.merge(alerts).to_json end def modules(_) @node.modules.merge(alerts).to_json end def params(args) @node.params(true).merge(alerts).to_json end def allparams(args) @node.params(false).merge(alerts).to_json end def build_list(hash, notifications, filter) { 'notifications' => notifications, 'payload' => hash }.to_json end private def alerts if @node.notifications.count > 0 { 'alerts' => @node.notifications.map(&:to_hash) } else {} end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems