Sha256: cce71cc8cfc45294c2c4f649d12f1cb8900a84abbcdab802434aebc328ca2945
Contents?: true
Size: 705 Bytes
Versions: 12
Compression:
Stored size: 705 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 "Unauthorized" end end end
Version data entries
12 entries across 12 versions & 1 rubygems