Class: Fog::Parsers::Compute::VcloudDirector::Metadata

Inherits:
VcloudDirectorParser show all
Defined in:
lib/fog/vcloud_director/parsers/compute/metadata.rb

Overview

buenas si no tanto ya hola adios

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"}

Instance Method Summary collapse

Methods inherited from VcloudDirectorParser

#extract_attributes

Instance Method Details

#end_element(name) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/fog/vcloud_director/parsers/compute/metadata.rb', line 47

def end_element(name)
  case name
  when 'Key'
    @key = value
  when 'Value'
    @val = value
  when 'MetadataEntry'
    @response[:metadata].merge!(Hash[@key, @val])
  end
end

#resetObject



32
33
34
# File 'lib/fog/vcloud_director/parsers/compute/metadata.rb', line 32

def reset
  @response = { :metadata => {} }
end

#start_element(name, attributes) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'lib/fog/vcloud_director/parsers/compute/metadata.rb', line 36

def start_element(name, attributes)
  super
  case name
  when 'Metadata'
     = extract_attributes(attributes)
    @response[:type] = [:type]
    @response[:href] = [:href]
    @response[:id] = @response[:href].split('/')[-2]
  end
end