Currently the schema only handles a single primary key.
def primary_key_for(entity_name)
metadata.xpath("//EntityType[@Name='{entity_name}']/Key/PropertyRef").first.attributes['Name'].value
end
The OData specification supports composite keys, i.e.,
<EntityType Name="RetailTransaction">
<Key>
<PropertyRef Name="dataAreaId" />
<PropertyRef Name="TransactionNumber" />
<PropertyRef Name="OperatingUnitNumber" />
<PropertyRef Name="Terminal" />
</Key>
...
</EntityType>
Not entirely sure of the best approach of handling this just yet, but starting with checking if all keys defined for the Entity in the schema are present before asserting whether the Entity is new or not is probably a good place to start.