Sha256: 644f27d880089c1f7afcc101426f59e04ee8b4e86795a9dfa3e13639b72f4b9d
Contents?: true
Size: 646 Bytes
Versions: 11
Compression:
Stored size: 646 Bytes
Contents
require 'uri' require 'net/http' require 'json' module PointlessFeedback class Captcha def self.pass?(captcha_response) new(captcha_response).pass? end def initialize(captcha_response) @captcha_response = captcha_response end def pass? JSON.parse(response.body)["success"] == true end private def response @response ||= Typhoeus.post(url, body: body) end def url "https://www.google.com/recaptcha/api/siteverify" end def body { secret: PointlessFeedback.google_captcha_secret_key, response: @captcha_response } end end end
Version data entries
11 entries across 11 versions & 1 rubygems