soap4r en keyvaluepair

I'm making a soap connection to an external program that will give me informatieoon in keyvalue pairs like this manner

<keyValuePairs> <key>email</key> <value>daniel@bla.com</value> </keyValuePairs> <keyValuePairs> <key>optin1</key> <value>true</value> </keyValuePairs>

I want to map it on my object that has the same keys I'm doing it like this           @contactInfo.keyValuePairs.each do |kvp|               @knowington.update_attribute(kvp.key,kvp.value)           end

The big drawback is that it will update the object for every key is there a better way to deal with this ???

I'm making a soap connection to an external program that will give me informatieoon in keyvalue pairs like this manner

<keyValuePairs> <key>email</key> <value>daniel@bla.com</value> </keyValuePairs> <keyValuePairs> <key>optin1</key> <value>true</value> </keyValuePairs>

I want to map it on my object that has the same keys I'm doing it like this          @contactInfo.keyValuePairs.each do |kvp|              @knowington.update_attribute(kvp.key,kvp.value)          end

The big drawback is that it will update the object for every key is there a better way to deal with this ???

Off the top of my head, build up a hash and use update_attributes or do @knowington[kvp.key] = kvp.key and then save at the end or call the accessor methods and then save

Fred