Class: Clerk::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/clerk/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/clerk/configuration.rb', line 14

def initialize
  @excluded_routes = []
  @publishable_key = ENV["CLERK_PUBLISHABLE_KEY"]
  @secret_key = ENV["CLERK_SECRET_KEY"]

  # Default to Rails.cache or ActiveSupport::Cache::MemoryStore, if available, otherwise nil
  @cache_store = if defined?(::Rails)
    ::Rails.cache
  elsif defined?(::ActiveSupport::Cache::MemoryStore)
    ::ActiveSupport::Cache::MemoryStore.new
  end

  ClerkHttpClient.configure do |config|
    unless secret_key.nil? || secret_key.empty?
      config.access_token = @secret_key
    end
  end
end

Instance Attribute Details

#cache_storeObject

Returns the value of attribute cache_store.



7
8
9
# File 'lib/clerk/configuration.rb', line 7

def cache_store
  @cache_store
end

#debugObject

Returns the value of attribute debug.



8
9
10
# File 'lib/clerk/configuration.rb', line 8

def debug
  @debug
end

#excluded_routesObject

Returns the value of attribute excluded_routes.



10
11
12
# File 'lib/clerk/configuration.rb', line 10

def excluded_routes
  @excluded_routes
end

#loggerObject

Returns the value of attribute logger.



9
10
11
# File 'lib/clerk/configuration.rb', line 9

def logger
  @logger
end

#publishable_keyObject

Returns the value of attribute publishable_key.



11
12
13
# File 'lib/clerk/configuration.rb', line 11

def publishable_key
  @publishable_key
end

#secret_keyObject

Returns the value of attribute secret_key.



12
13
14
# File 'lib/clerk/configuration.rb', line 12

def secret_key
  @secret_key
end

Class Method Details

.defaultObject



33
34
35
# File 'lib/clerk/configuration.rb', line 33

def self.default
  @@default ||= new
end

Instance Method Details

#update(options) ⇒ Object



37
38
39
40
41
# File 'lib/clerk/configuration.rb', line 37

def update(options)
  options.each do |key, value|
    send(:"#{key}=", value)
  end
end