Class: TopologicalInventory::Providers::Common::Collector::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/topological_inventory/providers/common/collector/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeParser

Returns a new instance of Parser.



12
13
14
15
16
# File 'lib/topological_inventory/providers/common/collector/parser.rb', line 12

def initialize
  @collections = InventoryCollectionStorage.new

  self.resource_timestamp = Time.now.utc
end

Instance Attribute Details

#collectionsObject

Returns the value of attribute collections.



8
9
10
# File 'lib/topological_inventory/providers/common/collector/parser.rb', line 8

def collections
  @collections
end

#resource_timestampObject

Returns the value of attribute resource_timestamp.



8
9
10
# File 'lib/topological_inventory/providers/common/collector/parser.rb', line 8

def resource_timestamp
  @resource_timestamp
end

Instance Method Details

#lazy_find(collection, reference, ref: :manager_ref) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/topological_inventory/providers/common/collector/parser.rb', line 18

def lazy_find(collection, reference, ref: :manager_ref)
  return if reference.kind_of?(String) && reference.blank?

  # Don't make lazy link if all reference values are blank
  return if reference.kind_of?(Hash) && reference.values.select { |val| val.to_s.present? }.blank?

  TopologicalInventoryIngressApiClient::InventoryObjectLazy.new(
    :inventory_collection_name => collection,
    :reference                 => reference,
    :ref                       => ref,
  )
end