def generate_auth_url(path, params, accepts_client_id)
      # Deterministic ordering through sorting by key.
      # Useful for tests, and in the future, any caching.
      if params.kind_of?(Hash)
        params = params.sort
      else
        params = params.dup
      end

      if accepts_client_id and @client_id and @client_secret
        params << ["client", @client_id]

        path = [path, GoogleMapsService::Url.urlencode_params(params)].join("?")
        sig = GoogleMapsService::Url.sign_hmac(@client_secret, path)
        return path + "&signature=" + sig
      end

      if @key
        params << ["key", @key]
        return path + "?" + GoogleMapsService::Url.urlencode_params(params)
      end

      raise ArgumentError, "Must provide API key for this API. It does not accept enterprise credentials."
    end
def generate_auth_url(path, params, accepts_client_id)
      # Deterministic ordering through sorting by key.
      # Useful for tests, and in the future, any caching.
      if params.kind_of?(Hash)
        params = params.sort
      else
        params = params.dup
      end

      if accepts_client_id and @client_id and @client_secret
        params << ["client", @client_id]

        path = [path, GoogleMapsService::Url.urlencode_params(params)].join("?")
        sig = GoogleMapsService::Url.sign_hmac(@client_secret, path)
        return path + "&signature=" + sig
      end

      if @key
        params << ["key", @key]
        return path + "?" + GoogleMapsService::Url.urlencode_params(params)
      end

      raise ArgumentError, "Must provide API key for this API. It does not accept enterprise credentials."
    end
Returns the path and query string portion of the request URL,
 first adding any necessary parameters.

 @param [String] path The path portion of the URL.
 @param [Hash] params URL parameters.
 @param [Boolean] accepts_client_id Sign the request using API {#keys} instead of {#client_id}.

 @return [String]