1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/vcloud/parser.rb
Edward Muller 6e156d0cfb Internet Service(s) w/tests
moving towards adding internet services

add_internet_service

require builder

delete internet service

internet_service(s) model/collections on public_ip

internet_services on a vdc

testing for internet services
2010-06-06 04:47:34 +08:00

42 lines
1 KiB
Ruby

module Fog
module Parsers
module Vcloud
def self.de_camel(str)
str.gsub(/(.)([A-Z])/,'\1_\2').downcase
end
class Base < Fog::Parsers::Base
private
def generate_link(attributes)
link = Struct::VcloudLink.new
until attributes.empty?
link[attributes.shift.downcase] = attributes.shift
end
if link.href
link.href = URI.parse(link.href)
end
link
end
def handle_root(attributes)
root = {}
until attributes.empty?
if attributes.first.is_a?(Array)
attribute = attributes.shift
root[attribute.first.downcase] = attribute.last
else
root[attributes.shift.downcase] = attributes.shift
end
end
@response.href = URI.parse(root['href'])
@response.name = root['name']
@response.type = root['type']
@response.xmlns = root['xmlns']
end
end
end
end
end