Module: Recaptcha
- Defined in:
- lib/recaptcha.rb,
lib/recaptcha/verify.rb,
lib/recaptcha/railtie.rb,
lib/recaptcha/version.rb,
lib/recaptcha/client_helper.rb,
lib/recaptcha/configuration.rb,
lib/recaptcha/verify/verify_result.rb,
lib/recaptcha/verify/verify_response.rb
Defined Under Namespace
Modules: ClientHelper, Verify Classes: Configuration, Railtie, RecaptchaError
Constant Summary collapse
- CONFIG =
{ 'server_url' => 'https://www.google.com/recaptcha/api.js', 'verify_url' => 'https://www.google.com/recaptcha/api/siteverify' }.freeze
- USE_SSL_BY_DEFAULT =
false
- HANDLE_TIMEOUTS_GRACEFULLY =
true
- DEFAULT_TIMEOUT =
3
- VERSION =
'4.14.0'
Class Method Summary collapse
-
.configuration ⇒ Object
Gives access to the current Configuration.
-
.configure {|config| ... } ⇒ Object
Allows easy setting of multiple configuration options.
- .i18n(key, default) ⇒ Object
- .with_configuration(config) ⇒ Object
Class Method Details
.configuration ⇒ Object
Gives access to the current Configuration.
18 19 20 |
# File 'lib/recaptcha.rb', line 18 def self.configuration @configuration ||= Configuration.new end |
.configure {|config| ... } ⇒ Object
Allows easy setting of multiple configuration options. See Configuration
for all available options.
The temp assignment is only used to get a nicer rdoc. Feel free to remove this hack. ++
28 29 30 31 |
# File 'lib/recaptcha.rb', line 28 def self.configure config = configuration yield(config) end |
.i18n(key, default) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/recaptcha.rb', line 46 def self.i18n(key, default) if defined?(I18n) I18n.translate(key, default: default) else default end end |
.with_configuration(config) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/recaptcha.rb', line 33 def self.with_configuration(config) original_config = {} config.each do |key, value| original_config[key] = configuration.send(key) configuration.send("#{key}=", value) end yield if block_given? ensure original_config.each { |key, value| configuration.send("#{key}=", value) } end |