1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/core/deprecated/connection.rb
Paul Thornthwaite 4123be9568 [core/xml] Splits SAX parsing from Connection
This creates a new `Fog::Core::Connection` class that wraps around HTTP
connections/requests but does not presume SAX parsing of the API response.

A new `Fog::XML::SAXParserConnection` is available which implements the
original behaviour with a clearer interface.

`Fog::Connection` subclasses `SAXParserConnection` to be backwards
compatible.

Further testing and deprecation warnings are needed.

Since mock testing occurs at a higher level the changed code is not
exercised by the tests and I do not have access to an XML based API to
debug quickly with.
2013-06-24 17:30:51 +01:00

24 lines
673 B
Ruby

require "fog/xml"
module Fog
# @deprecated Use {Fog::Core::Connection} or {XML::SAXParserConnection} if you
# require the response body to be parsed.
#
# The Connection class is a wrapper around an instance of Excon::Connection
# supporting {#request} and {#reset} only.
#
# {#request} includes an option to perform SAX parsing for XML APIs.
#
# @see https://github.com/geemus/excon/blob/master/lib/excon/connection.rb
#
class Connection < Fog::XML::SAXParserConnection
def request(params, &block)
if (parser = params.delete(:parser))
super(parser, params)
else
original_request(params)
end
end
end
end