lib/inventory_refresh/inventory_object.rb
def assign_attributes(attributes)
      attributes.each do |k, v|
        # We don't want timestamps or resource versions to be overwritten here, since those are driving the conditions
        next if %i(resource_timestamps resource_timestamps_max resource_timestamp).include?(k)
        next if %i(resource_counters resource_counters_max resource_counter).include?(k)

        if data[:resource_timestamp] && attributes[:resource_timestamp]
          assign_only_newest(:resource_timestamp, :resource_timestamps, attributes, data, k, v)
        elsif data[:resource_counter] && attributes[:resource_counter]
          assign_only_newest(:resource_counter, :resource_counters, attributes, data, k, v)
        else
          public_send("#{k}=", v)
        end
      end

      if attributes[:resource_timestamp]
        assign_full_row_version_attr(:resource_timestamp, attributes, data)
      elsif attributes[:resource_counter]
        assign_full_row_version_attr(:resource_counter, attributes, data)
      end

      self
    end
def assign_attributes(attributes)
      attributes.each do |k, v|
        # We don't want timestamps or resource versions to be overwritten here, since those are driving the conditions
        next if %i(resource_timestamps resource_timestamps_max resource_timestamp).include?(k)
        next if %i(resource_counters resource_counters_max resource_counter).include?(k)

        if data[:resource_timestamp] && attributes[:resource_timestamp]
          assign_only_newest(:resource_timestamp, :resource_timestamps, attributes, data, k, v)
        elsif data[:resource_counter] && attributes[:resource_counter]
          assign_only_newest(:resource_counter, :resource_counters, attributes, data, k, v)
        else
          public_send("#{k}=", v)
        end
      end

      if attributes[:resource_timestamp]
        assign_full_row_version_attr(:resource_timestamp, attributes, data)
      elsif attributes[:resource_counter]
        assign_full_row_version_attr(:resource_counter, attributes, data)
      end

      self
    end
Given hash of attributes, we assign them to InventoryObject object using its public writers

 @param attributes [Hash] attributes we want to assign
 @return [InventoryRefresh::InventoryObject] self