class Insights::API::Common::User
Attributes
identity[R]
Public Class Methods
new(identity)
click to toggle source
# File lib/insights/api/common/user.rb, line 7 def initialize(identity) @identity = identity end
Public Instance Methods
tenant()
click to toggle source
# File lib/insights/api/common/user.rb, line 26 def tenant ActiveSupport::Deprecation.warn("Please switch to request.tenant, request.user.tenant will be removed in a future release.") find_tenant_key end
Private Instance Methods
find_tenant_key()
click to toggle source
# File lib/insights/api/common/user.rb, line 41 def find_tenant_key result = identity.dig('identity', 'account_number') raise IdentityError, "Tenant key doesn't exist" if result.nil? result end
find_user_key(key)
click to toggle source
# File lib/insights/api/common/user.rb, line 35 def find_user_key(key) result = identity.dig('identity', 'user', key.to_s) raise IdentityError, "#{key} doesn't exist" if result.nil? result end