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/rackspace/models/identity/tenants.rb

29 lines
550 B
Ruby
Raw Normal View History

require 'fog/core/collection'
require 'fog/rackspace/models/identity/tenant'
module Fog
module Rackspace
class Identity
class Tenants < Fog::Collection
model Fog::Rackspace::Identity::Tenant
def all
load(retrieve_tenants)
end
def get(id)
data = retrieve_tenants.find{ |tenant| tenant['id'] == id }
data && new(data)
end
private
def retrieve_tenants
data = connection.list_tenants.body['tenants']
end
end
end
end
end