Class: Recaptcha::Configuration
- Inherits:
-
Object
- Object
- Recaptcha::Configuration
- Defined in:
- lib/recaptcha/configuration.rb
Overview
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
Instance Attribute Summary collapse
-
#api_server_url ⇒ Object
Returns the value of attribute api_server_url.
-
#handle_timeouts_gracefully ⇒ Object
Returns the value of attribute handle_timeouts_gracefully.
-
#hostname ⇒ Object
Returns the value of attribute hostname.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#secret_key ⇒ Object
Returns the value of attribute secret_key.
-
#site_key ⇒ Object
Returns the value of attribute site_key.
-
#skip_verify_env ⇒ Object
Returns the value of attribute skip_verify_env.
-
#verify_url ⇒ Object
Returns the value of attribute verify_url.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
:nodoc:.
- #secret_key! ⇒ Object
- #site_key! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
:nodoc:
34 35 36 37 38 39 40 |
# File 'lib/recaptcha/configuration.rb', line 34 def initialize #:nodoc: @skip_verify_env = %w[test cucumber] @handle_timeouts_gracefully = HANDLE_TIMEOUTS_GRACEFULLY @secret_key = ENV['RECAPTCHA_SECRET_KEY'] @site_key = ENV['RECAPTCHA_SITE_KEY'] end |
Instance Attribute Details
#api_server_url ⇒ Object
Returns the value of attribute api_server_url.
31 32 33 |
# File 'lib/recaptcha/configuration.rb', line 31 def api_server_url @api_server_url end |
#handle_timeouts_gracefully ⇒ Object
Returns the value of attribute handle_timeouts_gracefully.
31 32 33 |
# File 'lib/recaptcha/configuration.rb', line 31 def handle_timeouts_gracefully @handle_timeouts_gracefully end |
#hostname ⇒ Object
Returns the value of attribute hostname.
31 32 33 |
# File 'lib/recaptcha/configuration.rb', line 31 def hostname @hostname end |
#proxy ⇒ Object
Returns the value of attribute proxy.
31 32 33 |
# File 'lib/recaptcha/configuration.rb', line 31 def proxy @proxy end |
#secret_key ⇒ Object
Returns the value of attribute secret_key.
31 32 33 |
# File 'lib/recaptcha/configuration.rb', line 31 def secret_key @secret_key end |
#site_key ⇒ Object
Returns the value of attribute site_key.
31 32 33 |
# File 'lib/recaptcha/configuration.rb', line 31 def site_key @site_key end |
#skip_verify_env ⇒ Object
Returns the value of attribute skip_verify_env.
31 32 33 |
# File 'lib/recaptcha/configuration.rb', line 31 def skip_verify_env @skip_verify_env end |
#verify_url ⇒ Object
Returns the value of attribute verify_url.
31 32 33 |
# File 'lib/recaptcha/configuration.rb', line 31 def verify_url @verify_url end |
Instance Method Details
#secret_key! ⇒ Object
42 43 44 |
# File 'lib/recaptcha/configuration.rb', line 42 def secret_key! secret_key || raise(RecaptchaError, "No secret key specified.") end |
#site_key! ⇒ Object
46 47 48 |
# File 'lib/recaptcha/configuration.rb', line 46 def site_key! site_key || raise(RecaptchaError, "No site key specified.") end |