class Hieracles::Formats::Json

format intended to be used for an api server

Public Instance Methods

allparams(args) click to toggle source
# File lib/hieracles/formats/json.rb, line 32
def allparams(args)
  @node.params(false).merge(alerts).to_json
end
build_list(hash, notifications, filter) click to toggle source
# File lib/hieracles/formats/json.rb, line 36
def build_list(hash, notifications, filter)
  {
    'notifications' => notifications,
    'payload' => hash
  }.to_json
end
facts(_) click to toggle source
# File lib/hieracles/formats/json.rb, line 12
def facts(_)
  @node.facts.merge(alerts).to_json
end
files(_) click to toggle source
# File lib/hieracles/formats/json.rb, line 16
def files(_)
  { 'files' => @node.files }.merge(alerts).to_json
end
info(_) click to toggle source
# File lib/hieracles/formats/json.rb, line 8
def info(_)
  @node.info.merge(alerts).to_json
end
modules(_) click to toggle source
# File lib/hieracles/formats/json.rb, line 24
def modules(_)
  @node.modules.merge(alerts).to_json
end
params(args) click to toggle source
# File lib/hieracles/formats/json.rb, line 28
def params(args)
  @node.params(true).merge(alerts).to_json
end
paths(_) click to toggle source
# File lib/hieracles/formats/json.rb, line 20
def paths(_)
  { 'paths' => @node.paths }.merge(alerts).to_json
end

Private Instance Methods

alerts() click to toggle source
# File lib/hieracles/formats/json.rb, line 45
def alerts
  if @node.notifications.count > 0
    { 'alerts' => @node.notifications.map(&:to_hash) }
  else
    {}
  end
end