class DwollaV2::TokenManager
Public Class Methods
new(client)
click to toggle source
# File lib/dwolla_v2/token_manager.rb, line 3 def initialize(client) @client = client @wrapped_token = nil @mutex = Mutex.new end
Public Instance Methods
get_token()
click to toggle source
# File lib/dwolla_v2/token_manager.rb, line 9 def get_token @mutex.synchronize do current_token = @wrapped_token || fetch_new_token() fresh_token = current_token.is_expired? ? fetch_new_token() : current_token @wrapped_token = fresh_token unless @wrapped_token == fresh_token fresh_token.token end end
Private Instance Methods
fetch_new_token()
click to toggle source
# File lib/dwolla_v2/token_manager.rb, line 20 def fetch_new_token TokenWrapper.new(@client.auths.client) end