lib/two_captcha/client.rb
def decode!(options = {})
      started_at = Time.now

      raw64 = load_captcha(options)
      fail(TwoCaptcha::InvalidCaptcha) if raw64.to_s.empty?

      decoded_captcha = upload(options.merge(raw64: raw64))

      # pool untill the answer is ready
      while decoded_captcha.text.to_s.empty?
        sleep(polling)
        decoded_captcha = captcha(decoded_captcha.id)
        fail TwoCaptcha::Timeout if (Time.now - started_at) > timeout
      end

      decoded_captcha
    end
def decode!(options = {})
      started_at = Time.now

      raw64 = load_captcha(options)
      fail(TwoCaptcha::InvalidCaptcha) if raw64.to_s.empty?

      decoded_captcha = upload(options.merge(raw64: raw64))

      # pool untill the answer is ready
      while decoded_captcha.text.to_s.empty?
        sleep(polling)
        decoded_captcha = captcha(decoded_captcha.id)
        fail TwoCaptcha::Timeout if (Time.now - started_at) > timeout
      end

      decoded_captcha
    end
Decode the text from an image (i.e. solve a captcha).

 @param [Hash] options Options hash.
 @option options [String]  :url   URL of the image to be decoded.
 @option options [String]  :path  File path of the image to be decoded.
 @option options [File]    :file  File instance with image to be decoded.
 @option options [String]  :raw   Binary content of the image to be
                                  decoded.
 @option options [String]  :raw64 Binary content encoded in base64 of the
                                  image to be decoded.
 @option options [Integer] :phrase         (0) https://2captcha.com/setting
 @option options [Integer] :regsense       (0) https://2captcha.com/setting
 @option options [Integer] :numeric        (0) https://2captcha.com/setting
 @option options [Integer] :calc           (0) https://2captcha.com/setting
 @option options [Integer] :min_len        (0) https://2captcha.com/setting
 @option options [Integer] :max_len        (0) https://2captcha.com/setting
 @option options [Integer] :language       (0) https://2captcha.com/setting
 @option options [Integer] :header_acao    (0) https://2captcha.com/setting
 @option options [Integer] :id_constructor (0) 23 if new reCAPTCHA.
 @option options [Integer] :coordinatescaptcha (0) 1 if clickable captcha.

 @return [TwoCaptcha::Captcha] The captcha (with solution) if an error is
                               not raised.