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 site and secret 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.site_key  = '6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy'
  config.secret_key = '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx'
end

Constants

DEFAULTS

Attributes

api_server_url[W]
default_env[RW]
enterprise[RW]
enterprise_api_key[RW]
enterprise_project_id[RW]
handle_timeouts_gracefully[RW]
hostname[RW]
proxy[RW]
secret_key[RW]
site_key[RW]
skip_verify_env[RW]
verify_url[W]

Public Instance Methods

api_server_url() click to toggle source
# File lib/recaptcha/configuration.rb, line 76
def api_server_url
  @api_server_url || (enterprise ? DEFAULTS.fetch('enterprise_server_url') : DEFAULTS.fetch('free_server_url'))
end
enterprise_api_key!() click to toggle source
# File lib/recaptcha/configuration.rb, line 68
def enterprise_api_key!
  enterprise_api_key || raise(RecaptchaError, "No Enterprise API key specified.")
end
enterprise_project_id!() click to toggle source
# File lib/recaptcha/configuration.rb, line 72
def enterprise_project_id!
  enterprise_project_id || raise(RecaptchaError, "No Enterprise project ID specified.")
end
secret_key!() click to toggle source
# File lib/recaptcha/configuration.rb, line 60
def secret_key!
  secret_key || raise(RecaptchaError, "No secret key specified.")
end
site_key!() click to toggle source
# File lib/recaptcha/configuration.rb, line 64
def site_key!
  site_key || raise(RecaptchaError, "No site key specified.")
end
verify_url() click to toggle source
# File lib/recaptcha/configuration.rb, line 80
def verify_url
  @verify_url || (enterprise ? DEFAULTS.fetch('enterprise_verify_url') : DEFAULTS.fetch('free_verify_url'))
end