Class: GlobusClient::Identity
- Inherits:
-
Object
- Object
- GlobusClient::Identity
- Defined in:
- lib/globus_client/identity.rb
Overview
Lookup of a Globus identity ID
Instance Method Summary collapse
-
#get_identity(user_id) ⇒ Hash
Id and status of Globus identity.
-
#get_identity_id(user_id) ⇒ String
UUID for Globus identity.
-
#initialize(client) ⇒ Identity
constructor
A new instance of Identity.
-
#valid?(user_id) ⇒ Boolean
Whether the account has a valid status.
Constructor Details
#initialize(client) ⇒ Identity
Returns a new instance of Identity.
6 7 8 |
# File 'lib/globus_client/identity.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#get_identity(user_id) ⇒ Hash
Returns id and status of Globus identity.
12 13 14 15 16 17 18 19 20 |
# File 'lib/globus_client/identity.rb', line 12 def get_identity(user_id) response = client.get( base_url: client.config.auth_url, path: '/v2/api/identities', params: { usernames: user_id } ) response['identities'].find { |id| id['username'] == user_id } end |
#get_identity_id(user_id) ⇒ String
Returns UUID for Globus identity.
30 31 32 |
# File 'lib/globus_client/identity.rb', line 30 def get_identity_id(user_id) get_identity(user_id)['id'] end |
#valid?(user_id) ⇒ Boolean
Returns whether the account has a valid status.
24 25 26 |
# File 'lib/globus_client/identity.rb', line 24 def valid?(user_id) %w[used private unused].include?(get_identity(user_id)['status']) end |