Class: Cloudflare::Turnstile::Rails::Configuration
- Inherits:
-
Object
- Object
- Cloudflare::Turnstile::Rails::Configuration
- Defined in:
- lib/cloudflare/turnstile/rails/configuration.rb
Instance Attribute Summary collapse
-
#auto_populate_response_in_test_env ⇒ Object
Returns the value of attribute auto_populate_response_in_test_env.
-
#onload ⇒ Object
Returns the value of attribute onload.
-
#render ⇒ Object
Returns the value of attribute render.
-
#script_url ⇒ Object
Dynamically build the URL every time, so that config.render and config.onload applied after init take effect.
-
#secret_key ⇒ Object
Returns the value of attribute secret_key.
-
#site_key ⇒ Object
Returns the value of attribute site_key.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
8 9 10 11 12 13 14 15 |
# File 'lib/cloudflare/turnstile/rails/configuration.rb', line 8 def initialize @script_url = Cloudflare::SCRIPT_URL @site_key = nil @secret_key = nil @render = nil @onload = nil @auto_populate_response_in_test_env = true end |
Instance Attribute Details
#auto_populate_response_in_test_env ⇒ Object
Returns the value of attribute auto_populate_response_in_test_env.
6 7 8 |
# File 'lib/cloudflare/turnstile/rails/configuration.rb', line 6 def auto_populate_response_in_test_env @auto_populate_response_in_test_env end |
#onload ⇒ Object
Returns the value of attribute onload.
6 7 8 |
# File 'lib/cloudflare/turnstile/rails/configuration.rb', line 6 def onload @onload end |
#render ⇒ Object
Returns the value of attribute render.
6 7 8 |
# File 'lib/cloudflare/turnstile/rails/configuration.rb', line 6 def render @render end |
#script_url ⇒ Object
Dynamically build the URL every time, so that config.render and config.onload applied after init take effect.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cloudflare/turnstile/rails/configuration.rb', line 19 def script_url return @script_url unless @script_url == Cloudflare::SCRIPT_URL # Otherwise, append render/onload if present: params = [] params << "render=#{CGI.escape(@render)}" unless @render.nil? params << "onload=#{CGI.escape(@onload)}" unless @onload.nil? params.empty? ? Cloudflare::SCRIPT_URL : "#{Cloudflare::SCRIPT_URL}?#{params.join('&')}" end |
#secret_key ⇒ Object
Returns the value of attribute secret_key.
6 7 8 |
# File 'lib/cloudflare/turnstile/rails/configuration.rb', line 6 def secret_key @secret_key end |
#site_key ⇒ Object
Returns the value of attribute site_key.
6 7 8 |
# File 'lib/cloudflare/turnstile/rails/configuration.rb', line 6 def site_key @site_key end |