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_director/models/compute/networks.rb

33 lines
810 B
Ruby
Raw Normal View History

require 'fog/core/collection'
2013-08-27 05:19:54 -04:00
require 'fog/vcloud_director/models/compute/network'
module Fog
module Compute
2013-08-27 05:19:54 -04:00
class VcloudDirector
2013-07-09 09:01:06 -04:00
class Networks < Collection
2013-08-27 05:19:54 -04:00
model Fog::Compute::VcloudDirector::Network
attribute :organization
2013-07-09 09:01:06 -04:00
private
def get_by_id(item_id)
item = service.get_network(item_id).body
service.add_id_from_href!(item)
item
end
2013-07-09 09:01:06 -04:00
def item_list
data = service.get_organization(organization.id).body
items = data[:Link].select { |link| link[:type] == "application/vnd.vmware.vcloud.orgNetwork+xml" }
items.each{|item| service.add_id_from_href!(item) }
items
end
2013-07-09 09:01:06 -04:00
end
end
end
end