mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[Brightbox] Change code to return Single user
This commit is contained in:
parent
7a4c0440a4
commit
2b8e54c826
2 changed files with 8 additions and 7 deletions
|
@ -14,14 +14,12 @@ module Fog
|
|||
load(data)
|
||||
end
|
||||
|
||||
def get(identifier)
|
||||
return nil if identifier.nil? || identifier == ""
|
||||
def get(identifier = nil)
|
||||
data = connection.get_user(identifier)
|
||||
new(data)
|
||||
rescue Excon::Errors::NotFound
|
||||
nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -3,12 +3,15 @@ module Fog
|
|||
class Brightbox
|
||||
class Real
|
||||
|
||||
def get_user(identifier)
|
||||
return nil if identifier.nil? || identifier == ""
|
||||
request("get", "/1.0/users/#{identifier}", [200])
|
||||
def get_user(identifier = nil)
|
||||
if identifier.nil? || identifier.empty?
|
||||
request("get", "/1.0/user", [200])
|
||||
else
|
||||
request("get", "/1.0/users/#{identifier}", [200])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue