lib/nexaas_id/client/application.rb in nexaas_id-client-0.6.0 vs lib/nexaas_id/client/application.rb in nexaas_id-client-0.7.0
- old
+ new
@@ -1,32 +1,30 @@
+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
-
- def initialize
+class NexaasID::Client::Application < NexaasID::Client::Base
+ def initialize(config = nil)
+ super(config)
@tokens = {}
end
- # Provides a SignUp resource.
- # @return [NexaasID::Resources::SignUp] the signup resource.
- def sign_up
- NexaasID::Resources::SignUp.new(token(:invite))
+ protected
+
+ def api_token
+ token(:invite)
end
private
attr_reader :tokens
-
- def client
- @client ||= NexaasID::Client::OAuth.build
- end
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))