-
- # The follow block does not need to be executed because they are dealt with
- # in create_with_history, update_from and delete_with_history
- if create
- relation.timestamp = Time.now.getutc
- relation.visible = true
- relation.version = 0
- else
- if pt['timestamp']
- relation.timestamp = Time.parse(pt['timestamp'])
- end
- relation.version = pt['version']
+
+ unless create
+ raise OSM::APIBadXMLError.new("relation", pt, "ID is required when updating") if pt['id'].nil?
+ relation.id = pt['id'].to_i
+ # .to_i will return 0 if there is no number that can be parsed.
+ # We want to make sure that there is no id with zero anyway
+ raise OSM::APIBadUserInput.new("ID of relation cannot be zero when updating.") if relation.id == 0