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/users.rb

36 lines
809 B
Ruby

require 'fog/core/collection'
require 'fog/rackspace/models/identity/user'
module Fog
module Rackspace
class Identity
class Users < Fog::Collection
model Fog::Rackspace::Identity::User
def all
data = service.list_users.body['users']
load(data)
end
def get(user_id)
data = service.get_user_by_id(user_id).body['user']
new(data)
rescue Excon::Errors::NotFound
nil
rescue Excon::Errors::Unauthorized
nil
end
def get_by_name(user_name)
data = service.get_user_by_name(user_name).body['user']
new(data)
rescue Excon::Errors::NotFound
nil
rescue Excon::Errors::Unauthorized
nil
end
end
end
end
end