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/roles.rb
2013-01-07 21:01:20 +00:00

32 lines
626 B
Ruby

require 'fog/core/collection'
require 'fog/rackspace/models/identity/role'
module Fog
module Rackspace
class Identity
class Roles < Fog::Collection
model Fog::Rackspace::Identity::Role
attr_accessor :user
def all
requires :user
load(retrieve_roles)
end
def get(id)
requires :user
data = retrieve_roles.find{ |role| role['id'] == id }
data && new(data)
end
private
def retrieve_roles
data = service.list_user_roles(user.identity).body['roles']
end
end
end
end
end