fog--fog/lib/fog/connection.rb

44 lines
642 B
Ruby
Raw Normal View History

2009-08-07 07:28:53 +00:00
unless Fog.mocking?
2009-08-07 07:28:53 +00:00
module Fog
class Connection
2009-08-07 07:28:53 +00:00
def initialize(url)
@excon = Excon.new(url)
end
2009-08-07 07:28:53 +00:00
def request(params)
if parser = params.delete(:parser)
body = Nokogiri::XML::SAX::PushParser.new(parser)
params[:block] = lambda { |chunk| body << chunk }
2009-08-07 07:28:53 +00:00
end
response = @excon.request(params)
2009-08-07 07:28:53 +00:00
if parser
body.finish
response.body = parser.response
2009-08-07 07:28:53 +00:00
end
response
end
2009-08-07 07:28:53 +00:00
end
2009-08-07 07:28:53 +00:00
end
else
2009-08-07 07:28:53 +00:00
module Fog
class Connection
2009-08-07 07:28:53 +00:00
def initialize(url)
end
2009-08-07 07:28:53 +00:00
def request(params)
end
end
end
2009-08-07 07:28:53 +00:00
end