def rest_api(type, path, options = {})
      raise InvalidRequest, 'Must specify path' unless path
      raise InvalidRequest, 'Must specify type' unless type
      @logger.debug "Making :#{type} rest call to #{@host}#{path}"

      uri = URI.parse(URI.escape("#{@host}#{path}"))
      http = @disable_proxy ? Net::HTTP.new(uri.host, uri.port, nil, nil) : Net::HTTP.new(uri.host, uri.port)
      http.use_ssl = true if uri.scheme == 'https'
      http.verify_mode = OpenSSL::SSL::VERIFY_NONE unless @ssl_enabled

      request = build_request(type, uri, options)
      response = http.request(request)
      @logger.debug "  Response: Code=#{response.code}. Headers=#{response.to_hash}\n  Body=#{response.body}"
      response
    rescue OpenSSL::SSL::SSLError => e
      msg = 'SSL verification failed for the request. Please either:'
      msg += "\n  1. Install the necessary certificate(s) into your cert store"
      msg += ". Using cert store: #{ENV['SSL_CERT_FILE']}" if ENV['SSL_CERT_FILE']
      msg += "\n  2. Set the :ssl_enabled option to false for your iLO client (not recommended)"
      @logger.error msg
      raise e
    rescue SocketError => e
      e.message.prepend("Failed to connect to iLO host #{@host}!\n")
      raise e
    end
def rest_api(type, path, options = {})
      raise InvalidRequest, 'Must specify path' unless path
      raise InvalidRequest, 'Must specify type' unless type
      @logger.debug "Making :#{type} rest call to #{@host}#{path}"

      uri = URI.parse(URI.escape("#{@host}#{path}"))
      http = @disable_proxy ? Net::HTTP.new(uri.host, uri.port, nil, nil) : Net::HTTP.new(uri.host, uri.port)
      http.use_ssl = true if uri.scheme == 'https'
      http.verify_mode = OpenSSL::SSL::VERIFY_NONE unless @ssl_enabled

      request = build_request(type, uri, options)
      response = http.request(request)
      @logger.debug "  Response: Code=#{response.code}. Headers=#{response.to_hash}\n  Body=#{response.body}"
      response
    rescue OpenSSL::SSL::SSLError => e
      msg = 'SSL verification failed for the request. Please either:'
      msg += "\n  1. Install the necessary certificate(s) into your cert store"
      msg += ". Using cert store: #{ENV['SSL_CERT_FILE']}" if ENV['SSL_CERT_FILE']
      msg += "\n  2. Set the :ssl_enabled option to false for your iLO client (not recommended)"
      @logger.error msg
      raise e
    rescue SocketError => e
      e.message.prepend("Failed to connect to iLO host #{@host}!\n")
      raise e
    end
Make a restful API request to the iLO
 @param [Symbol] type the rest method/type Options are :get, :post, :put, :patch, and :delete
 @param [String] path the path for the request. Usually starts with "/rest/"
 @param [Hash] options the options for the request
 @option options [String] :body Hash to be converted into json and set as the request body
 @option options [String] :Content-Type ('application/json') Set to nil or :none to have this option removed
 @raise [InvalidRequest] if the request is invalid
 @raise [SocketError] if a connection could not be made
 @raise [OpenSSL::SSL::SSLError] if SSL validation of the iLO's certificate failed
 @return [NetHTTPResponse] The response object