Class: AiRootShield::DeviceLogParser

Inherits:
Object
  • Object
show all
Defined in:
lib/ai_root_shield/device_log_parser.rb

Overview

Parses device logs and extracts relevant security information

Class Method Summary collapse

Class Method Details

.parse(file_path) ⇒ Hash

Parse device logs from JSON file

Parameters:

  • file_path (String) —

    Path to the device logs JSON file

Returns:

  • (Hash) —

    Parsed device data



12
13
14
15
16
17
18
19
# File 'lib/ai_root_shield/device_log_parser.rb', line 12

def parse(file_path)
  raise Error, "Device logs file not found: #{file_path}" unless File.exist?(file_path)

  raw_data = JSON.parse(File.read(file_path))
  normalize_device_data(raw_data)
rescue JSON::ParserError => e
  raise Error, "Invalid JSON format in device logs: #{e.message}"
end