Module: Recaptcha
- Defined in:
- lib/recaptcha.rb,
lib/recaptcha/verify.rb,
lib/recaptcha/version.rb,
lib/recaptcha/client_helper.rb,
lib/recaptcha/configuration.rb
Defined Under Namespace
Modules: ClientHelper, Verify Classes: Configuration, RecaptchaError, VerifyError
Constant Summary collapse
- CONFIG =
{ 'v1' => { 'server_url' => '//www.google.com/recaptcha/api', 'secure_server_url' => 'https://www.google.com/recaptcha/api', 'verify_url' => 'http://www.google.com/recaptcha/api/verify' }, 'v2' => { 'server_url' => '//www.google.com/recaptcha/api.js', 'secure_server_url' => 'https://www.google.com/recaptcha/api.js', 'verify_url' => 'https://www.google.com/recaptcha/api/siteverify' } }
- RECAPTCHA_API_VERSION =
'v2'
- USE_SSL_BY_DEFAULT =
false
- HANDLE_TIMEOUTS_GRACEFULLY =
true
- SKIP_VERIFY_ENV =
['test', 'cucumber']
- VERSION =
"0.4.1"
Class Method Summary collapse
-
.configuration ⇒ Object
Gives access to the current Configuration.
-
.configure {|config| ... } ⇒ Object
Allows easy setting of multiple configuration options.
- .with_configuration(config) ⇒ Object
Class Method Details
.configuration ⇒ Object
Gives access to the current Configuration.
27 28 29 |
# File 'lib/recaptcha.rb', line 27 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. ++
37 38 39 40 |
# File 'lib/recaptcha.rb', line 37 def self.configure config = configuration yield(config) end |
.with_configuration(config) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/recaptcha.rb', line 42 def self.with_configuration(config) original_config = {} config.each do |key, value| original_config[key] = configuration.send(key) configuration.send("#{key}=", value) end result = yield if block_given? original_config.each { |key, value| configuration.send("#{key}=", value) } result end |