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/openstack/requests/identity/get_role.rb
2012-04-30 10:34:59 +08:00

28 lines
671 B
Ruby

module Fog
module Identity
class OpenStack
class Real
def get_role(id)
request(
:expects => [200, 204],
:method => 'GET',
:path => "/OS-KSADM/roles/#{id}"
)
end
end
class Mock
def get_role(id)
response = Excon::Response.new
if data = self.data[:roles][id]
response.status = 200
response.body = { 'role' => data }
response
else
raise Fog::Identity::OpenStack::NotFound
end
end
end # class Mock
end # class OpenStack
end # module Identity
end # module Fog