Sha256: d32c8c29c1c3b0dc795c3158ba683b1448f0c40a92b2c197c9824de6b252ec18
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
class ExvoAuth::Autonomous::Consumer < ExvoAuth::Autonomous::Base def initialize(params = {}) super validate_params!(:provider_id) end def get(*args) http.get(*args) end def post(*args) http.post(*args) end def put(*args) http.put(*args) end def delete(*args) http.delete(*args) end def head(*args) http.head(*args) end def options(*args) http.options(*args) end protected # Url and Token set on each request so expired authorization will cause re-authorization. def http basement.base_uri(authorization["url"]) basement.basic_auth(params[:client_id], authorization["access_token"]) basement end def basement @basement ||= Class.new do include HTTParty end end def authorization @@cache.fetch(params) do authorization! end end def authorization! response = auth.get("/apps/consumer/authorizations/#{URI.escape(params[:provider_id])}.json") @@cache.write(params, response["authorization"]) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
exvo-auth-0.7.3 | lib/exvo_auth/autonomous/consumer.rb |
exvo-auth-0.7.2 | lib/exvo_auth/autonomous/consumer.rb |