Class: Moose::Inventory::Operations::InventorySnapshotValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/moose_inventory/operations/inventory_snapshot_validator.rb

Overview

Normalizes and validates portable inventory snapshot input before import.

Instance Method Summary collapse

Constructor Details

#initialize(context:) ⇒ InventorySnapshotValidator

Returns a new instance of InventorySnapshotValidator.



66
67
68
# File 'lib/moose_inventory/operations/inventory_snapshot_validator.rb', line 66

def initialize(context:)
  @context = context
end

Instance Method Details

#call(snapshot:) ⇒ Object



70
71
72
73
74
# File 'lib/moose_inventory/operations/inventory_snapshot_validator.rb', line 70

def call(snapshot:)
  normalized = deep_stringify_keys(snapshot)
  validate_snapshot!(normalized)
  normalized
end