Sha256: eb78de8b9e67a18eb1cc0a03b993390a34af4d114f09278e9414478f80785c5c

Contents?: true

Size: 626 Bytes

Versions: 3

Compression:

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
exvo-auth-0.7.13 lib/exvo_auth/autonomous/consumer.rb
exvo-auth-0.7.12 lib/exvo_auth/autonomous/consumer.rb
exvo-auth-0.7.11 lib/exvo_auth/autonomous/consumer.rb