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.



8
9
10
# File 'lib/moose_inventory/operations/inventory_snapshot_validator.rb', line 8

def initialize(context:)
  @context = context
end

Instance Method Details

#call(snapshot:) ⇒ Object



12
13
14
15
16
# File 'lib/moose_inventory/operations/inventory_snapshot_validator.rb', line 12

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