aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/gems/recaptcha-0.3.1/lib/recaptcha/configuration.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2011-03-09 14:58:30 +0000
committerSeb Bacon <seb.bacon@gmail.com>2011-03-09 14:58:30 +0000
commitb4585af18e9c3a033f6cfe27213f0575af795a66 (patch)
tree996efa1487ac0d8cb7e4f53ee6478ad625b9d27d /vendor/gems/recaptcha-0.3.1/lib/recaptcha/configuration.rb
parent224b8a4ba3a24af91068505c7907724448a4096d (diff)
parent4cc2cf2a6d935adfd263ea4fd7791a6d84f704da (diff)
merge from master (post-CSRF changes)
Diffstat (limited to 'vendor/gems/recaptcha-0.3.1/lib/recaptcha/configuration.rb')
-rw-r--r--vendor/gems/recaptcha-0.3.1/lib/recaptcha/configuration.rb52
1 files changed, 52 insertions, 0 deletions
diff --git a/vendor/gems/recaptcha-0.3.1/lib/recaptcha/configuration.rb b/vendor/gems/recaptcha-0.3.1/lib/recaptcha/configuration.rb
new file mode 100644
index 000000000..210470a5b
--- /dev/null
+++ b/vendor/gems/recaptcha-0.3.1/lib/recaptcha/configuration.rb
@@ -0,0 +1,52 @@
+module Recaptcha
+ # 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
+ #
+ class Configuration
+ attr_accessor :nonssl_api_server_url,
+ :ssl_api_server_url,
+ :verify_url,
+ :skip_verify_env,
+ :private_key,
+ :public_key
+
+ def initialize #:nodoc:
+ @nonssl_api_server_url = RECAPTCHA_API_SERVER_URL
+ @ssl_api_server_url = RECAPTCHA_API_SECURE_SERVER_URL
+ @verify_url = RECAPTCHA_VERIFY_URL
+ @skip_verify_env = SKIP_VERIFY_ENV
+
+ @private_key = ENV['RECAPTCHA_PRIVATE_KEY']
+ @public_key = ENV['RECAPTCHA_PUBLIC_KEY']
+ end
+
+ def api_server_url(ssl = false) #:nodoc:
+ ssl ? ssl_api_server_url : nonssl_api_server_url
+ end
+ end
+end