Class: Fog::XML::SAXParserConnection
- Inherits:
-
Core::Connection
- Object
- Core::Connection
- Fog::XML::SAXParserConnection
- Defined in:
- lib/fog/xml/sax_parser_connection.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#request(parser, params) ⇒ Excon::Response
Makes a request using the connection using Excon.
Methods inherited from Core::Connection
Constructor Details
This class inherits a constructor from Fog::Core::Connection
Instance Method Details
#request(parser, params) ⇒ Excon::Response
Makes a request using the connection using Excon
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fog/xml/sax_parser_connection.rb', line 24 def request(parser, params) reset unless @persistent # Prepare the SAX parser data_stream = Nokogiri::XML::SAX::PushParser.new(parser) response_string = "" params[:response_block] = lambda do |chunk, remaining, total| response_string << chunk if ENV['DEBUG_RESPONSE'] data_stream << chunk end # Make request which read chunks into parser response = @excon.request(params) Fog::Logger.debug "\n#{response_string}" if ENV['DEBUG_RESPONSE'] # Cease parsing and override response.body with parsed data data_stream.finish response.body = parser.response response end |