Method: Justa::TokenManager#initialize
- Defined in:
- lib/justa/token_manager.rb
#initialize ⇒ TokenManager
Initializes TokenManager
This class builds authentication array with a mutex to share tokens
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/justa/token_manager.rb', line 14 def initialize tokens = nil if Justa.credentials case Justa.credentials when Array tokens = Justa.credentials when Hash tokens = [Justa.credentials] end else tokens = [{ username: Justa.username, password: Justa.password, client_id: Justa.client_id, client_secret: Justa.client_secret, integrator_id: Justa.integrator_id, document: Justa.document, key: :default, default: true }] end @mutex = Mutex.new @authenticators = nil setup_autenticators tokens end |