Sha256: dfcacbebb48ae041cdf62d19fa7fef9741a9ada35f03cab70f8a3a3e28a254c1
Contents?: true
Size: 779 Bytes
Versions: 16
Compression:
Stored size: 779 Bytes
Contents
class ExvoAuth::Autonomous::Consumer < ExvoAuth::Autonomous::Base include ExvoAuth::Autonomous::Http def initialize(params = {}) super validate_params!(:app_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[:app_id])}.json") if response["authorization"] @@cache.write(params, response["authorization"]) else raise "Authorization not found. You need an auhorization to contact provider app (#{ params[:app_id] })" end end end
Version data entries
16 entries across 16 versions & 1 rubygems