Sha256: 09a3fdb40405d07932ac97a881f44e4cbd9bae4aae18963053423db99db11493
Contents?: true
Size: 794 Bytes
Versions: 1
Compression:
Stored size: 794 Bytes
Contents
class ExvoAuth::Autonomous::Consumer < ExvoAuth::Autonomous::Base include ExvoAuth::Autonomous::Http def initialize(params = {}) super validate_params!(:provider_id) end def base_uri authorization["url"] end def username ExvoAuth::Config.client_id end def password authorization["access_token"] end def authorization @@cache.fetch(params) do authorization! end end def authorization! response = auth.get("/apps/consumer/authorizations/#{URI.escape(params[:provider_id])}.json") if response["authorization"] @@cache.write(params, response["authorization"]) else raise "Authorization not found. You need an auhorization to contact provider app (#{ params[:provider_id] })" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
exvo-auth-0.9.8 | lib/exvo_auth/autonomous/consumer.rb |