class ViewModel::ActiveRecord::ReferencedCollectionUpdate::Parser

def append_action_schema

def append_action_schema
  UpdateData::Schemas::REFERENCED_APPEND_ACTION
end

def functional_update_schema

def functional_update_schema
  UpdateData::Schemas::REFERENCED_COLLECTION_UPDATE
end

def functional_update_type

def functional_update_type
  Functional
end

def parse_contents(values)

def parse_contents(values)
  invalid_entries = values.reject { |h| ref_hash?(h) }
  if invalid_entries.present?
    raise ViewModel::DeserializationError::InvalidSyntax.new(
      "Appended/Updated entities must be specified as '#{ViewModel::REFERENCE_ATTRIBUTE}' style hashes." \
      "Invalid entries: #{invalid_entries}",
      blame_reference)
  end
  values.map do |x|
    ref = ViewModel.extract_reference_metadata(x)
    unless valid_reference_keys.include?(ref)
      raise ViewModel::DeserializationError::InvalidSharedReference.new(ref, blame_reference)
    end
    ref
  end
end

def ref_hash?(value)

def ref_hash?(value)
  value.size == 1 && value.has_key?(ViewModel::REFERENCE_ATTRIBUTE)
end

def remove_action_schema

def remove_action_schema
  UpdateData::Schemas::REFERENCED_REMOVE_ACTION
end

def replace_update_type

def replace_update_type
  Replace
end

def update_action_schema

def update_action_schema
  UpdateData::Schemas::REFERENCED_UPDATE_ACTION
end