Sha256: e0a770b85c00ac72550753558530fb3e47beed9506b9e441a471afdcc540d00b

Contents?: true

Size: 618 Bytes

Versions: 7

Compression:

Stored size: 618 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
    params[: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")
    
    @@cache.write(params, response["authorization"])
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
exvo-auth-0.7.10 lib/exvo_auth/autonomous/consumer.rb
exvo-auth-0.7.9 lib/exvo_auth/autonomous/consumer.rb
exvo-auth-0.7.8 lib/exvo_auth/autonomous/consumer.rb
exvo-auth-0.7.7 lib/exvo_auth/autonomous/consumer.rb
exvo-auth-0.7.6 lib/exvo_auth/autonomous/consumer.rb
exvo-auth-0.7.5 lib/exvo_auth/autonomous/consumer.rb
exvo-auth-0.7.4 lib/exvo_auth/autonomous/consumer.rb