Ruby

The following tutorial will show you how to integrate Trustcaptcha into Ruby.

Vorbereitung

Folgende Vorbereitungen sollten Sie treffen, bevor Sie mit der Implementierung von Trustcaptcha in Ihrem Ruby Backend anfangen.

Requirements

  • An account with Trustcaptcha and an existing CAPTCHA.
  • A backend, into which Trustcaptcha is to be integrated.

Knowledge (recommended)

  • Basic knowledge of the respective programming language.
  • Understanding of the basic functionality of Trustcaptcha as well as the backend process.

Add Dependency

To use the Trustcaptcha library, you must first insert the corresponding dependencies into your project.

RubyGems

Install the Trustcaptcha library using RubyGems.

Use Library

Below you will find out how you can use the library.

Fetch Result

You can retrieve the verification result using the get_verification_result() method of the CaptchaManager class from our servers. For this, you must provide your secret-keyue and the verification token.

Use Result

Once you have successfully retrieved the verification result, you can plan your next steps based on it. A concrete overview of all the information contained in the verification result and their respective meanings can be found in The Backend.

Example with Sinatra

modules.documentation.backend.ruby.example.subHeadline
With a POST request to /api/example, the verification token is transmitted within the request body. Subsequently, the result is retrieved from the server. If the verification has not been passed or the bot score is above 0.5, a warning will be given as an example. Finally, the entire result is returned to the client.
The entire example including source code can be found on Github.