Module: TwoCaptcha

Defined in:
lib/two_captcha.rb,
lib/two_captcha/http.rb,
lib/two_captcha/client.rb,
lib/two_captcha/errors.rb,
lib/two_captcha/version.rb,
lib/two_captcha/models/captcha.rb

Overview

The module TwoCaptcha contains all the code for the two_captcha gem. It acts as a safely namespace that isolates logic from TwoCaptcha from any project that uses it.

Defined Under Namespace

Classes: ArgumentError, BadDuplicates, BigCaptchaFilesize, Captcha, CaptchaImageBlocked, CaptchaUnsolvable, Client, EmptyAction, Error, GoogleKey, HTTP, ImageNotSupported, InvalidCaptcha, InvalidUserKey, IpBanned, IpNotAllowed, Model, NoSlotAvailable, ReportNotRecorded, SiteKey, SmallCaptchaFilesize, Timeout, WrongCaptchaId, WrongFileExtension, WrongIdFormat, WrongUserKey, ZeroBalance

Constant Summary collapse

RESPONSE_ERRORS =
{
  'ERROR_WRONG_USER_KEY'           => TwoCaptcha::WrongUserKey,
  'ERROR_KEY_DOES_NOT_EXIST'       => TwoCaptcha::InvalidUserKey,
  'ERROR_ZERO_BALANCE'             => TwoCaptcha::ZeroBalance,
  'ERROR_NO_SLOT_AVAILABLE'        => TwoCaptcha::NoSlotAvailable,
  'ERROR_ZERO_CAPTCHA_FILESIZE'    => TwoCaptcha::SmallCaptchaFilesize,
  'ERROR_TOO_BIG_CAPTCHA_FILESIZE' => TwoCaptcha::BigCaptchaFilesize,
  'ERROR_WRONG_FILE_EXTENSION'     => TwoCaptcha::WrongFileExtension,
  'ERROR_IMAGE_TYPE_NOT_SUPPORTED' => TwoCaptcha::ImageNotSupported,
  'ERROR_IP_NOT_ALLOWED'           => TwoCaptcha::IpNotAllowed,
  'IP_BANNED'                      => TwoCaptcha::IpBanned,
  'ERROR_WRONG_ID_FORMAT'          => TwoCaptcha::WrongIdFormat,
  'ERROR_CAPTCHA_UNSOLVABLE'       => TwoCaptcha::CaptchaUnsolvable,
  'ERROR_EMPTY_ACTION'             => TwoCaptcha::EmptyAction,
  'ERROR_GOOGLEKEY'                => TwoCaptcha::GoogleKey,
  'ERROR_CAPTCHAIMAGE_BLOCKED'     => TwoCaptcha::CaptchaImageBlocked,
  'ERROR_WRONG_CAPTCHA_ID'         => TwoCaptcha::WrongCaptchaId,
  'ERROR_BAD_DUPLICATES'           => TwoCaptcha::BadDuplicates,
  'REPORT_NOT_RECORDED'            => TwoCaptcha::ReportNotRecorded,
}
VERSION =
'1.8.0'
USER_AGENT =
"TwoCaptcha/Ruby v#{VERSION}"

Class Method Summary collapse

Class Method Details

.new(key, options = {}) ⇒ Object

Instantiate TwoCaptcha API client. This is a shortcut to TwoCaptcha::Client.new



14
15
16
# File 'lib/two_captcha.rb', line 14

def self.new(key, options = {})
  TwoCaptcha::Client.new(key, options)
end