Sha256: 775fb5107845943164bf27984b572adff49cf160b13708d7cd337485d3a50e9d
Contents?: true
Size: 718 Bytes
Versions: 1
Compression:
Stored size: 718 Bytes
Contents
class ExvoAuth::Autonomous::Provider < ExvoAuth::Autonomous::Base def initialize(params = {}) super validate_params!(:consumer_id, :access_token) end def scopes @@cache.fetch(params) do scopes! end end def scopes! response = httparty.get("/apps/provider/authorizations/#{URI.escape(params[:consumer_id])}.json", :base_uri => params[:site], :basic_auth => { :username => params[:client_id], :password => params[:client_secret] }, :query => { :access_token => params[:access_token] } ) if scope = response["scope"] @@cache.write(params, scope.split) else [] # only cache positive responses end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
exvo-auth-0.7.1 | lib/exvo_auth/autonomous/provider.rb |