def initialize(fname)
contents = IO.read(fname)
json = JSON.parse(contents)
[:report, :reported_at, :host].each do |field|
if !json.has_key?(field.to_s)
raise AbrtProxy::Error::SyntaxError, "Report #{fname} missing field #{field}"
end
end
report = json["report"]
hash = HostReport.duphash report
ar = AggregatedReport.new(json["report"], 1, hash, json["reported_at"])
@reports = [ar]
@by_hash = {}
@by_hash[hash] = ar unless hash.nil?
@files = [fname]
@host = json["host"]
@althosts = json["althosts"]
end