Class: Recaptcha::Verify::VerifyResultV3
- Inherits:
-
VerifyResult
- Object
- VerifyResult
- Recaptcha::Verify::VerifyResultV3
- Defined in:
- lib/recaptcha/verify/verify_result.rb
Instance Attribute Summary
Attributes inherited from VerifyResult
Instance Method Summary collapse
- #action_valid? ⇒ Boolean
-
#initialize(verify_response, hostname, action) ⇒ VerifyResultV3
constructor
A new instance of VerifyResultV3.
- #valid? ⇒ Boolean
Methods inherited from VerifyResult
Constructor Details
#initialize(verify_response, hostname, action) ⇒ VerifyResultV3
53 54 55 56 |
# File 'lib/recaptcha/verify/verify_result.rb', line 53 def initialize(verify_response, hostname, action) super(verify_response, hostname) @expected_action = action end |
Instance Method Details
#action_valid? ⇒ Boolean
71 72 73 74 75 76 |
# File 'lib/recaptcha/verify/verify_result.rb', line 71 def action_valid? case @expected_action when nil, FalseClass then true else action == @expected_action end end |
#valid? ⇒ Boolean
61 62 63 64 65 66 67 68 69 |
# File 'lib/recaptcha/verify/verify_result.rb', line 61 def valid? super return false unless response.success? unless action_valid? @errors << "Action '#{action}' did not match '#{@expected_action}'" end @errors.none? end |