class Attio::Internal::Record
def normalize_values(values)
def normalize_values(values) values.map do |key, value| # Check if this is a simple array attribute if SIMPLE_ARRAY_ATTRIBUTES.include?(key.to_s) && value.is_a?(Array) # For email_addresses and domains, keep strings as-is [key, value] elsif SIMPLE_VALUE_ATTRIBUTES.include?(key.to_s) && !value.is_a?(Hash) && !value.is_a?(Array) # For simple string attributes, send directly [key, value] elsif OBJECT_ARRAY_ATTRIBUTES.include?(key.to_s) && value.is_a?(Array) # For arrays of objects like phone_numbers, etc., keep as-is [key, value] elsif key.to_s == "name" # Special handling for name - keep as-is whether string or array # Company names are strings, Person names are arrays of objects [key, value] else normalized_value = case value when Array value.map { |v| normalize_single_value(v) } else normalize_single_value(value) end [key, normalized_value] end end.to_h end