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

      # don't load image data for Token API
      raw64 = nil
      unless options[:type] == 4
        raw64 = load_captcha(options)
        raise DeathByCaptcha::InvalidCaptcha if raw64.to_s.empty?
      end

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

      while decoded_captcha.text.to_s.empty?
        sleep(self.polling)
        decoded_captcha = self.captcha(decoded_captcha.id)
        raise DeathByCaptcha::Timeout if (Time.now - started_at) > self.timeout
      end

      raise DeathByCaptcha::IncorrectSolution if !decoded_captcha.is_correct

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

      # don't load image data for Token API
      raw64 = nil
      unless options[:type] == 4
        raw64 = load_captcha(options)
        raise DeathByCaptcha::InvalidCaptcha if raw64.to_s.empty?
      end

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

      while decoded_captcha.text.to_s.empty?
        sleep(self.polling)
        decoded_captcha = self.captcha(decoded_captcha.id)
        raise DeathByCaptcha::Timeout if (Time.now - started_at) > self.timeout
      end

      raise DeathByCaptcha::IncorrectSolution if !decoded_captcha.is_correct

      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.

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