1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[terremark] fix some parsers

This commit is contained in:
geemus 2010-12-07 16:37:43 -08:00
parent f3b41e77da
commit 3fc3df03d8
3 changed files with 31 additions and 6 deletions

View file

@ -15,8 +15,13 @@ module Fog
when 'Link'
link = {}
until attributes.empty?
link[attributes.shift] = attributes.shift
end
if attributes.first.is_a?(Array)
attribute = attributes.shift
link[attribute.first] = attribute.last
else
link[attributes.shift] = attributes.shift
end
end
@response['Links'] << link
when 'Org'
org = {}

View file

@ -14,7 +14,12 @@ module Fog
if name == 'Org'
organization = {}
until attributes.empty?
organization[attributes.shift] = attributes.shift
if attributes.first.is_a?(Array)
attribute = attributes.shift
organization[attribute.first] = attribute.last
else
organization[attributes.shift] = attributes.shift
end
end
@response['OrgList'] << organization
end

View file

@ -37,7 +37,12 @@ module Fog
when 'Link'
link = {}
until attributes.empty?
link[attributes.shift] = attributes.shift
if attributes.first.is_a?(Array)
attribute = attributes.shift
link[attribute.first] = attribute.last
else
link[attributes.shift] = attributes.shift
end
end
@response['links'] << link
when 'Memory'
@ -45,13 +50,23 @@ module Fog
when 'Network'
network = {}
until attributes.empty?
network[attributes.shift] = attributes.shift
if attributes.first.is_a?(Array)
attribute = attributes.shift
network[attribute.first] = attribute.last
else
network[attributes.shift] = attributes.shift
end
end
@response['AvailableNetworks'] << network
when 'ResourceEntity'
resource_entity = {}
until attributes.empty?
resource_entity[attributes.shift] = attributes.shift
if attributes.first.is_a?(Array)
attribute = attributes.shift
resource_entity[attribute.first] = attribute.last
else
resource_entity[attributes.shift] = attributes.shift
end
end
@response['ResourceEntities'] << resource_entity
when 'StorageCapacity'