Class: WinRM::ResponseHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/winrm/http/response_handler.rb

Overview

Handles the raw WinRM HTTP response. Returns the body as an XML doc or raises the appropriate WinRM error if the response is an error.

Instance Method Summary collapse

Constructor Details

#initialize(response_body, status_code) ⇒ ResponseHandler

Returns a new instance of ResponseHandler.

Parameters:

  • The (String)

    raw unparsed response body, if any

  • The (Integer)

    HTTP response status code



24
25
26
27
# File 'lib/winrm/http/response_handler.rb', line 24

def initialize(response_body, status_code)
  @response_body = response_body
  @status_code = status_code
end

Instance Method Details

#parse_to_xmlObject

Processes the response from the WinRM service and either returns an XML doc or raises an appropriate error.



33
34
35
36
# File 'lib/winrm/http/response_handler.rb', line 33

def parse_to_xml
  raise_if_error
  response_xml
end