def build_rest_url(args)
      @server_host = args[:server]
      @port = args[:port].to_i

      if args[:server_path]
        # remove leading & trailing slashes in serverpath if any
        @server_path = args[:server_path].sub %r{^/*(.*?)/*$}, Regexp.last_match(1)
        # re-add single trailing slash
        @server_path << '/'
      end

      # we're using ssl if:
      #  1) args[:use_ssl] is anything but false
      # or
      #  2) the port is a known ssl port.
      args[:use_ssl] = args[:use_ssl] != false || SSL_PORTS.include?(@port)

      @protocol = 'http'
      @protocol << 's' if args[:use_ssl]
      # and here's the URL
      "#{@protocol}://#{@server_host}:#{@port}/#{@server_path}#{RSRC_BASE}"
    end
def build_rest_url(args)
      @server_host = args[:server]
      @port = args[:port].to_i

      if args[:server_path]
        # remove leading & trailing slashes in serverpath if any
        @server_path = args[:server_path].sub %r{^/*(.*?)/*$}, Regexp.last_match(1)
        # re-add single trailing slash
        @server_path << '/'
      end

      # we're using ssl if:
      #  1) args[:use_ssl] is anything but false
      # or
      #  2) the port is a known ssl port.
      args[:use_ssl] = args[:use_ssl] != false || SSL_PORTS.include?(@port)

      @protocol = 'http'
      @protocol << 's' if args[:use_ssl]
      # and here's the URL
      "#{@protocol}://#{@server_host}:#{@port}/#{@server_path}#{RSRC_BASE}"
    end
Build the base URL for the API connection

 @param args[Hash] The args for #connect

 @return [String] The URI encoded URL