# # # # # # # # # buenas si # no tanto ya # # # # # # hola # adios # # # # # {:metadata=>{"buenas si"=>"no tanto ya", "hola"=>"adios"}, # :type=>"application/vnd.vmware.vcloud.metadata+xml", # :href=> # "https://example.com/api/vApp/vm-18545e82-d919-4071-ae7e-d1300d9d8112/metadata", # :id=>"vm-18545e82-d919-4071-ae7e-d1300d9d8112"} # module Fog module Parsers module Compute module VcloudDirector class Metadata < VcloudDirectorParser def reset @response = { :metadata => {} } end def start_element(name, attributes) super case name when 'Metadata' metadata = extract_attributes(attributes) @response[:type] = metadata[:type] @response[:href] = metadata[:href] @response[:id] = @response[:href].split('/')[-2] end end def end_element(name) case name when 'Key' @key = value when 'Value' @val = value when 'MetadataEntry' @response[:metadata].merge!(Hash[@key, @val]) end end end end end end end