def prepare(method, request_uri, params = {})
      method = method.downcase.to_s

      if TheBigDB.api_key.is_a?(String) and !TheBigDB.api_key.empty?
        params.merge!("api_key" => TheBigDB.api_key)
      end

      # we add the API version to the URL, with a trailing slash and the rest of the request
      request_uri = "/v#{TheBigDB.api_version}" + (request_uri.start_with?("/") ? request_uri : "/#{request_uri}")

      if method == "get"
        encoded_params = TheBigDB::Helpers::serialize_query_params(params)
        @http_request = Net::HTTP::Get.new(request_uri + "?" + encoded_params)
      elsif method == "post"
        @http_request = Net::HTTP::Post.new(request_uri)
        @http_request.set_form_data(TheBigDB::Helpers::flatten_params_keys(params))
      else
        raise ArgumentError, "The request method must be 'get' or 'post'"
      end

      @http_request["user-agent"] = "TheBigDB RubyWrapper/#{TheBigDB::VERSION::STRING}"

      client_user_agent = {
        "publisher" => "thebigdb",
        "version" => TheBigDB::VERSION::STRING,
        "language" => "ruby",
        "language_version" => "#{RUBY_VERSION} p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE})",
      }

      @http_request["X-TheBigDB-Client-User-Agent"] = JSON(client_user_agent)

      self
    end
def prepare(method, request_uri, params = {})
      method = method.downcase.to_s

      if TheBigDB.api_key.is_a?(String) and !TheBigDB.api_key.empty?
        params.merge!("api_key" => TheBigDB.api_key)
      end

      # we add the API version to the URL, with a trailing slash and the rest of the request
      request_uri = "/v#{TheBigDB.api_version}" + (request_uri.start_with?("/") ? request_uri : "/#{request_uri}")

      if method == "get"
        encoded_params = TheBigDB::Helpers::serialize_query_params(params)
        @http_request = Net::HTTP::Get.new(request_uri + "?" + encoded_params)
      elsif method == "post"
        @http_request = Net::HTTP::Post.new(request_uri)
        @http_request.set_form_data(TheBigDB::Helpers::flatten_params_keys(params))
      else
        raise ArgumentError, "The request method must be 'get' or 'post'"
      end

      @http_request["user-agent"] = "TheBigDB RubyWrapper/#{TheBigDB::VERSION::STRING}"

      client_user_agent = {
        "publisher" => "thebigdb",
        "version" => TheBigDB::VERSION::STRING,
        "language" => "ruby",
        "language_version" => "#{RUBY_VERSION} p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE})",
      }

      @http_request["X-TheBigDB-Client-User-Agent"] = JSON(client_user_agent)

      self
    end
Prepares the basic @http object with the current values of the module (host, port, ...)
 Prepares the @http_request object with the actual content of the request