Sha256: 7e2ddb2d02b3c74289ce5ad5a54d99a70bdc91860d0f285b176f16f342169c2d

Contents?: true

Size: 703 Bytes

Versions: 5

Compression:

Stored size: 703 Bytes

Contents

require_relative './base'

# Nexaas ID Client for resources not owned by an Identity
#
# [API]
#   Documentation:
#
# @example Inviting a new user:
#   client = NexaasID::Client::Application.new
#   client.sign_up.create(invited: 'john.doe@example.com')
#
class NexaasID::Client::Application < NexaasID::Client::Base
  def initialize(config = nil)
    super(config)
    @tokens = {}
  end

  protected

  def api_token
    token(:invite)
  end

  private

  attr_reader :tokens

  def token(scope = nil)
    token = tokens[scope]
    return token unless token.nil? || token.expired?
    tokens[scope] = NexaasID::Client::ExceptionWrapper.new(client.client_credentials.get_token(scope: scope))
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nexaas_id-client-0.7.4 lib/nexaas_id/client/application.rb
nexaas_id-client-0.7.3 lib/nexaas_id/client/application.rb
nexaas_id-client-0.7.2 lib/nexaas_id/client/application.rb
nexaas_id-client-0.7.1 lib/nexaas_id/client/application.rb
nexaas_id-client-0.7.0 lib/nexaas_id/client/application.rb