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

adapting organization to the new parser

This commit is contained in:
Rodrigo Estebanez 2013-06-19 17:06:44 +02:00
parent c0f7973875
commit 13a4a6c9a6
3 changed files with 10 additions and 7 deletions

View file

@ -8,10 +8,10 @@ module Fog
identity :id
attribute :name
attribute :name, :aliases => :FullName
attribute :type
attribute :href
attribute :description, :aliases => 'Description'
attribute :description, :aliases => :Description
def vdcs
requires :id

View file

@ -10,13 +10,16 @@ module Fog
def all
data = service.get_organizations.body
load(data['OrgList'])
org = data[:Org]
org[:id] = org[:href].split('/').last
load([org])
end
def get(organization_id)
if organization_id
self.class.new(:service => service).all.detect {|org| org.id == organization_id}
end
data = service.get_organization(organization_id).body
data.delete(:Link)
data[:id] = data[:href].split('/').last
new(data)
end
end
end

View file

@ -27,7 +27,7 @@ module Fog
:expects => 200,
:headers => { 'Accept' => 'application/*+xml;version=1.5' },
:method => 'GET',
:parser => Fog::Parsers::Compute::Vcloudng::GetOrganization.new,
:parser => Fog::ToHashDocument.new,
:path => "org/#{organization_id}"
})
end