Module: Brainzz::AccessTokenService

Extended by:
AccessTokenService
Included in:
AccessTokenService
Defined in:
lib/brainzz/services/access_token_service.rb

Constant Summary collapse

@@mutex =
Mutex.new

Instance Method Summary collapse

Instance Method Details

#retrieve_token_for(content_owner) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/brainzz/services/access_token_service.rb', line 7

def retrieve_token_for(content_owner)
  @@mutex.synchronize do
    @tokens ||= {}

    params = params_for(content_owner)

    key = params[:refresh_token]

    get_token_for key, params

    @tokens[key].token if @tokens[key]
  end
end