class ProxyAuth::Token
Service token
Attributes
token[RW]
Public Class Methods
new()
click to toggle source
# File lib/proxy_auth/token.rb, line 10 def initialize register_service end
Public Instance Methods
register_service()
click to toggle source
# File lib/proxy_auth/token.rb, line 14 def register_service Thread.new do set_token end end
valid?(token)
click to toggle source
# File lib/proxy_auth/token.rb, line 20 def valid?(token) @token == token end
Private Instance Methods
set_token()
click to toggle source
# File lib/proxy_auth/token.rb, line 26 def set_token connection = Connection.new 3.times do @token ||= connection.service_token @token && break || sleep(5) end end