RucaptchaApi

CAPTCHAFORUM

Administrator
31e59ef141[1].png

This gem facilitates interaction with https://rucaptcha.com/api-rucaptcha API.

Installation
gem 'rucaptcha_api'

Fast usage
/example.rb

Explained usage
require 'rucaptcha_api'
rucaptcha_key = '5d01e7jk4d9c64a784b25d38840d1407' - for example. get your own 'captcha KEY' from https://rucaptcha.com/setting page after you registered.
api = RucaptchaApi.new rucaptcha_key
path_to_captcha = File.expand_path 'var/captchas/1.png' - absolute path to image of your captcha (only accepts jpg,jpeg,gif,png)
captcha_id = api.send_captcha_for_solving path_to_captcha, params: {phrase: 1} - you send captcha for solving, and you get its id as a resonse so that you can later look up its solution when it's ready. params here are optional, and you can find possible params in API docs https://rucaptcha.com/api-rucaptcha

after you sent your captcha for solving and got captcha_id, you can find solved captcha with: solved_captcha = api.get_solved_captcha captcha_id # => Yi7yu8 (in case it's not ready yet, this method will automatically wait for 5 seconds and then resend the request for solved captcha).

in case your captcha wasn't properly solved, you can complain on it with api.complain captcha_id.

Methods to get statistics
api.balance # => 95.03 - Find out the account balance. The balance is indicated in Russian rubles.

api.captcha_cost captcha_id - Request for the status and cost of recognizing this captcha. The price is indicated in rubles.

api.stats_for date: '2013-11-27' # => string with xml - get account usage statistics in XML for the specified date.

RucaptchaApi.rucaptcha_stats # => {waiting: ..., ...} - waiting: number of employees waiting for captcha. load: the percentage of workers loaded. minbid: current bid for captcha recognition. In rubles. averageRecognitionTime: average time (in seconds) for which captchas are currently being solved

Documentation https://github.com/lakesare/rucaptcha_api