class DomoscioRails::AuthorizationToken::Manager
Public Class Methods
get_token()
click to toggle source
# File lib/domoscio_rails/authorization_token.rb, line 15 def get_token # token = storage.get # if token.nil? || token['timestamp'].nil? || token['timestamp'] <= Time.now # token = DomoscioRails.request(:post, '/api/oauth/token', {}, {}, {}, Proc.new do |req| # cfg = DomoscioRails.configuration # req.basic_auth cfg.client_id, cfg.client_passphrase # req.body = 'grant_type=client_credentials' # end) # token['timestamp'] = Time.now + token['expires_in'].to_i # storage.store token # end token = DomoscioRails.configuration.client_passphrase token end
storage()
click to toggle source
# File lib/domoscio_rails/authorization_token.rb, line 7 def storage @@storage ||= StaticStorage.new end
storage=(storage)
click to toggle source
# File lib/domoscio_rails/authorization_token.rb, line 11 def storage= (storage) @@storage = storage end