Sha256: 38660ef6c8c7462a63d3ad4b93b24ae3eafd283f1b0bc3c975503e9360055c02

Contents?: true

Size: 661 Bytes

Versions: 7

Compression:

Stored size: 661 Bytes

Contents

class ExvoAuth::Autonomous::Base
  attr_reader :params
  @@cache = ExvoAuth::Autonomous::Cache.new
  
  def initialize(params = {})
    params[:site]          ||= ExvoAuth::Config.host
    params[:client_id]     ||= ExvoAuth::Config.client_id
    params[:client_secret] ||= ExvoAuth::Config.client_secret
    @params = params
    
    validate_params!(:site, :client_id, :client_secret)
  end
  
  protected
  
  def validate_params!(*keys)
    missing = keys - params.keys
    raise(ArgumentError, "Please configure following keys: #{missing.join(", ")}") if missing.any?
  end
  
  # Makes testing easy
  def auth
    ExvoAuth::Autonomous::Auth.new
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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