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/requests/identity/list_credentials.rb
Brad Gignac 6dee2184e8 [rackspace|identity] Better checking around hash/array responses.
Instead of simply checking for the existence of a key in Identity API
responses, this checks the type of the expected response. This should
be a less fragile way of handling hash/array responses.
2012-06-27 11:15:16 -04:00

22 lines
527 B
Ruby

module Fog
module Rackspace
class Identity
class Real
def list_credentials(user_id)
response = request(
:expects => [200, 203],
:method => 'GET',
:path => "users/#{user_id}/OS-KSADM/credentials"
)
unless response.body['credentials'].is_a?(Array)
response.body['credentials'] = [response.body['credential']]
response.body.delete('credential')
end
response
end
end
end
end
end