Sha256: d28e4e3726629592e6080a235166e25a1de152bea9113c8e3f367a3e9904928f

Contents?: true

Size: 696 Bytes

Versions: 14

Compression:

Stored size: 696 Bytes

Contents

module Fog
  class Connection

    def initialize(url, persistent=false, params={})
      @excon = Excon.new(url, params)
      @persistent = persistent
    end

    def request(params, &block)
      unless @persistent
        reset
      end
      unless block_given?
        if (parser = params.delete(:parser))
          body = Nokogiri::XML::SAX::PushParser.new(parser)
          params[:response_block] = lambda { |chunk, remaining, total| body << chunk }
        end
      end

      response = @excon.request(params, &block)

      if parser
        body.finish
        response.body = parser.response
      end

      response
    end

    def reset
      @excon.reset
    end

  end
end

Version data entries

14 entries across 14 versions & 7 rubygems

Version Path
fog-parser-fix-1.6.1 lib/fog/core/connection.rb
fog-test-again-1.6.0 lib/fog/core/connection.rb
fog-parser-fix-1.6.0 lib/fog/core/connection.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/core/connection.rb
fog-1.7.0 lib/fog/core/connection.rb
fog-1.6.0 lib/fog/core/connection.rb
fog-1.5.0 lib/fog/core/connection.rb
rackspace-fog-1.4.2 lib/rackspace-fog/core/connection.rb
fog-1.4.0 lib/fog/core/connection.rb
michiels-fog-1.3.1 lib/fog/core/connection.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/core/connection.rb
fog-1.3.1 lib/fog/core/connection.rb
fog-1.3.0 lib/fog/core/connection.rb
fog-1.2.0 lib/fog/core/connection.rb