40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/cimi/models/volume_configuration.rb', line 40
def self.create_from_xml(body, context)
xml = XmlSimple.xml_in(body)
xml['property'] ||= []
new_config = current_db.add_volume_configuration(
:name => xml['name'].first,
:description => xml['description'].first,
:format => xml['format'].first,
:capacity => xml['capacity'].first,
:ent_properties => JSON::dump((xml['property'] || {}).inject({}){ |r, p| r[p['key']]=p['content']; r })
)
from_db(new_config, context)
end
|