Class: GoogleRecaptcha::Verification

Inherits:
Object
  • Object
show all
Defined in:
lib/google_recaptcha/verification.rb

Constant Summary collapse

VERIFICATION_URL =
"https://www.google.com/recaptcha/api/siteverify"

Class Method Summary collapse

Class Method Details

.verify_human(response, ipaddress) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/google_recaptcha/verification.rb', line 8

def self.verify_human(response, ipaddress)
  response = RestClient.post VERIFICATION_URL,
                  :secret => GoogleRecaptcha.configuration.secret_key,
                  :response => response,
                  :remoteip => ipaddress
  response = JSON.parse(response)
  puts response.inspect
  response['success']
end