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:
parent
c0f7973875
commit
13a4a6c9a6
3 changed files with 10 additions and 7 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue