Class: ActsAsTextcaptcha::TextcaptchaConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/acts_as_textcaptcha/textcaptcha_config.rb

Constant Summary collapse

YAML =
"development: &common_settings\n  api_key: 'TEXTCAPTCHA_API_IDENT' # see https://textcaptcha.com for details\n  # api_endpoint: nil        # Optional API URL to fetch questions and answers from\n  # raise_errors: false      # Optional flag, if true errors will be raised if the API endpoint fails\n  # cache_expiry_minutes: 10 # Optional minutes for captcha answers to persist in the cache (default 10 minutes)\n\n  questions:\n      - question: 'Is ice hot or cold?'\n        answers: 'cold'\n      - question: 'what color is an orange?'\n        answers: 'orange'\n      - question: 'what is two plus 3?'\n        answers: '5,five'\n      - question: 'what is 5 times two?'\n        answers: '10,ten'\n      - question: 'How many colors in the list, green, brown, foot and blue?'\n        answers: '3,three'\n      - question: 'what is Georges name?'\n        answers: 'george'\n      - question: '11 minus 1?'\n        answers: '10,ten'\n      - question: 'is boiling water hot or cold?'\n        answers: 'hot'\n      - question: 'what color is my blue shirt today?'\n        answers: 'blue'\n      - question: 'what is 16 plus 4?'\n        answers: '20,twenty'\n\ntest:\n  <<: *common_settings\n  api_key: 'TEST_TEXTCAPTCHA_API_IDENT'\n\nproduction:\n  <<: *common_settings\n"

Class Method Summary collapse

Class Method Details

.create(path: "./config/textcaptcha.yml") ⇒ Object



42
43
44
45
# File 'lib/acts_as_textcaptcha/textcaptcha_config.rb', line 42

def self.create(path: "./config/textcaptcha.yml")
  FileUtils.mkdir_p(File.dirname(path))
  File.write(path, YAML)
end