Module: Baloo::Convenience

Defined in:
lib/baloo/convenience.rb

Instance Method Summary collapse

Instance Method Details

#client_credentials(id = Baloo.app_id, secret = Baloo.app_secret) ⇒ Object Also known as: app_token

get an app access token



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/baloo/convenience.rb', line 5

def client_credentials(id = Baloo.app_id, secret = Baloo.app_secret)
  @stored_client_credentials ||= {}
  unless @stored_client_credentials[id]
    params = {
    :client_id => id,
    :client_secret => secret,
    :grant_type => 'client_credentials'
    }
    @stored_client_credentials[id] = get('oauth/access_token', :query => params).split("=")[1]
  end

  @stored_client_credentials[id]
end