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

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

Instance Attribute Summary

Attributes inherited from Base

#response

Instance Method Summary collapse

Methods inherited from VcloudDirectorParser

#extract_attributes

Methods inherited from Base

#attr_value, #characters, #end_element_namespace, #initialize, #start_element_namespace, #value

Constructor Details

This class inherits a constructor from Fog::Parsers::Base

Instance Method Details

#end_element(name) ⇒ Object



50
51
52
53
54
55
56
57
58
59
# File 'lib/fog/vcloud_director/parsers/compute/metadata.rb', line 50

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



35
36
37
# File 'lib/fog/vcloud_director/parsers/compute/metadata.rb', line 35

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

#start_element(name, attributes) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/fog/vcloud_director/parsers/compute/metadata.rb', line 39

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