lib/topological_inventory/orchestrator/targeted_update/api_load_has_one.rb
# API request
#
# Loading has_one associations (API calls reduced to one request/tenant)
# Sources db have defined has_many, but practically has_one is used (i.e. Source has_one Endpoint)
API request
Loading has_one associations (API calls reduced to one request/tenant)
Sources db have defined has_many, but practically has_one is used
API request Loading has_one associations ( API calls reduced to one request / tenant ) Sources db have defined has_many but practically has_one is used
def api_load_has_one_send(dest_model, foreign_key, dest_ids, dest_targets)
          dest_ids.each_pair do |external_tenant, ids|
            @api.send("each_#{dest_model}",
                      external_tenant,
                      :filter_key   => foreign_key,
                      :filter_value => ids.compact.uniq) do |data|
              api_object = hash_to_api_object(data)
              dest_targets[data[foreign_key].to_i].to_a.each do |target|
                target[dest_model] = api_object unless target.nil?
              end
            end
          end
        end
def api_load_has_one_send ( dest_model , foreign_key , dest_ids , dest_targets ) dest_ids . each_pair do | external_tenant , ids | @api . send ( "each_#{dest_model}" , external_tenant , :filter_key => foreign_key , :filter_value => ids . compact . uniq ) do | data | api_object = hash_to_api_object ( data ) dest_targets [ data [ foreign_key ] . to_i ] . to_a . each do | target | target [ dest_model ] = api_object unless target . nil? end end end end
API request
Loading has_one associations (API calls reduced to one request/tenant)
Sources db have defined has_many, but practically has_one is used (i.e.
API request Loading has_one associations ( API calls reduced to one request / tenant ) Sources db have defined has_many but practically has_one is used ( i . e .
dest_model
foreign_key
dest_ids
dest_targets