def request(path, params = {})
        raise Error, 'Invalid HTTP Client' unless http_client
        wait_before_new_request

        uri = @base_uri.merge(path)
        uri.query = http_build_query(params) unless params.empty?

        begin
          @last_request = Time.now  # see #wait_before_new_request
          @last_request_uri = uri   # useful for debug
          response = make_request(uri)
        rescue => e # catch EOFError, SocketError and more
          raise HTTPError, e.message
        end

        case response
          when Net::HTTPSuccess
            response
          when Net::HTTPUnauthorized        # 401
            raise HTTPError, 'Invalid username or password'
          when Net::HTTPServiceUnavailable  # 503
            raise HTTPError, 'You have been throttled.' +
              'Please ensure you are waiting at least one second before each request.'
          else
            raise HTTPError, "HTTP #{response.code}: #{response.message}"
        end
      end
def request(path, params = {})
        raise Error, 'Invalid HTTP Client' unless http_client
        wait_before_new_request

        uri = @base_uri.merge(path)
        uri.query = http_build_query(params) unless params.empty?

        begin
          @last_request = Time.now  # see #wait_before_new_request
          @last_request_uri = uri   # useful for debug
          response = make_request(uri)
        rescue => e # catch EOFError, SocketError and more
          raise HTTPError, e.message
        end

        case response
          when Net::HTTPSuccess
            response
          when Net::HTTPUnauthorized        # 401
            raise HTTPError, 'Invalid username or password'
          when Net::HTTPServiceUnavailable  # 503
            raise HTTPError, 'You have been throttled.' +
              'Please ensure you are waiting at least one second before each request.'
          else
            raise HTTPError, "HTTP #{response.code}: #{response.message}"
        end
      end
Sends an HTTP GET request to +path+ and appends given +params+.

 This method is 100% compliant with Delicious API reference.
 It waits at least 1 second between each HTTP request and
 provides an identifiable user agent by default,
 or the custom user agent set by +user_agent+ option
 when this instance has been created.

   request('/v1/api/path', :foo => 1, :bar => 2)
   # => sends a GET request to /v1/api/path?foo=1&bar=2