Class: YandexCaptcha::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/yandex_captcha/configuration.rb

Overview

This class enables detailed configuration of the Yandex CleanWeb services.

By calling

YandexCaptcha.configuration # => instance of YandexCaptcha::Configuration

or

YandexCaptcha.configure do |config|
  config # => instance of YandexCaptcha::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 Yandex CleanWeb 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

YandexCaptcha.configure do |config|
  config.api_key  = 'cw.1.1.gsdjdgskjhsdgjkgsdjsdjgkskhsgjkgsjhdkgsdghskd.sdgjhgsdsgdkjgdshkgds'
  config.captcha_type  = 'elite'
  config.api_server_url = 'http://cleanweb-api.yandex.ru/1.0'
  config.skip_verify_env = ["test", "cucumber"]
  config.handle_timeouts_gracefull = true'
  config.current_env = "test"
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

:nodoc:



42
43
44
45
46
47
48
49
# File 'lib/yandex_captcha/configuration.rb', line 42

def initialize #:nodoc:
  @api_server_url             = API_URL
  @captcha_type               = CAPTCHA_TYPE
  @api_key                    = ENV['CAPTCHA_KEY']
  @skip_verify_env            = SKIP_VERIFY_ENV
  @handle_timeouts_gracefully = HANDLE_TIMEOUTS_GRACEFULLY
  @current_env                = ENV['RACK_ENV'] || ENV['RAILS_ENV']
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



35
36
37
# File 'lib/yandex_captcha/configuration.rb', line 35

def api_key
  @api_key
end

#api_server_urlObject

Returns the value of attribute api_server_url.



35
36
37
# File 'lib/yandex_captcha/configuration.rb', line 35

def api_server_url
  @api_server_url
end

#captcha_typeObject

Returns the value of attribute captcha_type.



35
36
37
# File 'lib/yandex_captcha/configuration.rb', line 35

def captcha_type
  @captcha_type
end

#current_envObject

Returns the value of attribute current_env.



35
36
37
# File 'lib/yandex_captcha/configuration.rb', line 35

def current_env
  @current_env
end

#handle_timeouts_gracefullyObject

Returns the value of attribute handle_timeouts_gracefully.



35
36
37
# File 'lib/yandex_captcha/configuration.rb', line 35

def handle_timeouts_gracefully
  @handle_timeouts_gracefully
end

#skip_verify_envObject

Returns the value of attribute skip_verify_env.



35
36
37
# File 'lib/yandex_captcha/configuration.rb', line 35

def skip_verify_env
  @skip_verify_env
end