def request(q, target, options = {})
      request_hash = { :key => @key, :q => q, :target => target }
      request_hash[:source] = options[:from] if options[:from]
      return request_hash if options[:debug] == :request

      response = self.class.post(API_URL, { :body => request_hash })
      return response.parsed_response if options[:debug] == :response
      return { :request => request_hash, :response => response.parsed_response } if options[:debug] == :all

      raise response.parsed_response["error"]["message"] if response.parsed_response["error"] && response.parsed_response["error"]["message"]

      translations = response.parsed_response["data"]["translations"]

      if translations.size > 1
        translations.map { |translation| CGI.unescapeHTML translation["translatedText"] }
      else
        CGI.unescapeHTML(translations[0]["translatedText"])
      end
    end
def request(q, target, options = {})
      request_hash = { :key => @key, :q => q, :target => target }
      request_hash[:source] = options[:from] if options[:from]
      return request_hash if options[:debug] == :request

      response = self.class.post(API_URL, { :body => request_hash })
      return response.parsed_response if options[:debug] == :response
      return { :request => request_hash, :response => response.parsed_response } if options[:debug] == :all

      raise response.parsed_response["error"]["message"] if response.parsed_response["error"] && response.parsed_response["error"]["message"]

      translations = response.parsed_response["data"]["translations"]

      if translations.size > 1
        translations.map { |translation| CGI.unescapeHTML translation["translatedText"] }
      else
        CGI.unescapeHTML(translations[0]["translatedText"])
      end
    end
Initializes a new {ToLang::Connector} and stores a Google Translate API key.

 @return [ToLang::Connector] The new {ToLang::Connector} instance.
 Makes a request to the Google Translate API.

 @param [String, Array] q A string or array of strings to translate.
 @param [String] target The language code for the language to translate to.
 @param [Hash] options A hash of options.
 @option options [String] :from The language code for the language of @q@.
 @option options [Symbol] :debug Debug output to return instead of the translated string. Must be one of @:request@, @:response@, or @:all@.

 @raise [RuntimeError] If Google Translate returns any errors.
 @return [String, Array, Hash] The translated string, an array of the translated strings, or debugging output, as requested.