From b037c3a86f3f456f1e4e9005045948f9900672a8 Mon Sep 17 00:00:00 2001 From: Josh Lane Date: Tue, 19 May 2015 12:35:22 -0700 Subject: [PATCH] IAM::Users#current --- lib/fog/aws/models/iam/users.rb | 4 ++++ tests/models/iam/users_tests.rb | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/fog/aws/models/iam/users.rb b/lib/fog/aws/models/iam/users.rb index 93d295d74..08c01dcaf 100644 --- a/lib/fog/aws/models/iam/users.rb +++ b/lib/fog/aws/models/iam/users.rb @@ -16,6 +16,10 @@ module Fog load(data['Users']) # data is an array of attribute hashes end + def current + new(service.get_user.body['User']) + end + def get(identity) data = service.get_user(identity).body['User'] new(data) # data is an attribute hash diff --git a/tests/models/iam/users_tests.rb b/tests/models/iam/users_tests.rb index f44fb515a..a506e3ed2 100644 --- a/tests/models/iam/users_tests.rb +++ b/tests/models/iam/users_tests.rb @@ -38,6 +38,10 @@ Shindo.tests("Fog::Compute[:iam] | users", ['aws','iam']) do @iam.users.get(@user_one_name).id == @user_one_name end + tests('#current').succeeds do + @iam.users.current + end + tests('#get',"returns nil if the user doesn't exists").succeeds do @iam.users.get('non-exists') == nil end