Class: ExvoAuth::Autonomous::Provider

Inherits:
Base
  • Object
show all
Defined in:
lib/exvo_auth/autonomous/provider.rb

Instance Attribute Summary

Attributes inherited from Base

#params

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Provider

Returns a new instance of Provider.



2
3
4
5
# File 'lib/exvo_auth/autonomous/provider.rb', line 2

def initialize(params = {})
  super
  validate_params!(:app_id, :access_token)
end

Instance Method Details

#scopesObject



7
8
9
10
11
# File 'lib/exvo_auth/autonomous/provider.rb', line 7

def scopes
  @@cache.fetch(params) do
    scopes!
  end
end

#scopes!Object



13
14
15
16
17
18
19
20
21
22
23
# 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