class ExvoAuth::Autonomous::Provider

Public Class Methods

new(params = {}) click to toggle source
Calls superclass method ExvoAuth::Autonomous::Base::new
# File lib/exvo_auth/autonomous/provider.rb, line 2
def initialize(params = {})
  super
  validate_params!(:app_id, :access_token)
end

Public Instance Methods

scopes() click to toggle source
# File lib/exvo_auth/autonomous/provider.rb, line 7
def scopes
  @@cache.fetch(params) do
    scopes!
  end
end
scopes!() click to toggle source
# File lib/exvo_auth/autonomous/provider.rb, line 13
def scopes!
  response = auth.get("/apps/provider/authorizations/#{URI.escape(params[:app_id])}.json",
    :query => { :access_token => params[:access_token] }
  )

  if scope = response["scope"] 
    @@cache.write(params, scope.split)
  else
    [] # only cache positive responses
  end
end