class Recaptcha::Configuration

This class enables detailed configuration of the recaptcha services.

By calling

Recaptcha.configuration # => instance of Recaptcha::Configuration

or

Recaptcha.configure do |config|
  config # => instance of Recaptcha::Configuration
end

you are able to perform configuration updates.

Your are able to customize all attributes listed below. All values have sensitive default and will very likely not need to be changed.

Please note that the public and private key for the reCAPTCHA API Access have no useful default value. The keys may be set via the Shell enviroment or using this configuration. Settings within this configuration always take precedence.

Setting the keys with this Configuration

Recaptcha.configure do |config|
  config.public_key  = '6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy'
  config.private_key = '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx'
end

Attributes

disable_ssl_verification[RW]
handle_timeouts_gracefully[RW]
hostname[RW]
private_key[RW]
proxy[RW]
public_key[RW]
skip_verify_env[RW]
use_ssl_by_default[RW]

Public Instance Methods

api_server_url(ssl: nil) click to toggle source
# File lib/recaptcha/configuration.rb, line 50
def api_server_url(ssl: nil)
  ssl = use_ssl_by_default if ssl.nil?
  key = (ssl ? 'secure_server_url' : 'server_url')
  CONFIG.fetch(key)
end
api_version() click to toggle source
# File lib/recaptcha/configuration.rb, line 68
def api_version
  warn 'getting api_version is deprecated and will be removed shortly, only v2 is supported'
  'v2'
end
api_version=(v) click to toggle source
# File lib/recaptcha/configuration.rb, line 60
def api_version=(v)
  if v == 'v2'
    warn 'setting api_version is deprecated and will be removed shortly, only v2 is supported'
  else
    raise ArgumentError, "only v2 is supported, not #{v.inspect}"
  end
end
private_key!() click to toggle source
# File lib/recaptcha/configuration.rb, line 42
def private_key!
  private_key || raise(RecaptchaError, "No private key specified.")
end
public_key!() click to toggle source
# File lib/recaptcha/configuration.rb, line 46
def public_key!
  public_key || raise(RecaptchaError, "No public key specified.")
end
verify_url() click to toggle source
# File lib/recaptcha/configuration.rb, line 56
def verify_url
  CONFIG.fetch('verify_url')
end