Sha256: 027da491d0a61cfee86b14d57fafe633e71f51e685c3a1097c9358ebec49d722

Contents?: true

Size: 660 Bytes

Versions: 15

Compression:

Stored size: 660 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)
          block = lambda { |chunk| 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

15 entries across 15 versions & 3 rubygems

Version Path
fog-0.7.1 lib/fog/core/connection.rb
fog-0.7.0 lib/fog/core/connection.rb
bbcloud-0.11.2 lib/bbcloud/vendor/fog/lib/fog/core/connection.rb
bbcloud-0.11.1 lib/bbcloud/vendor/fog/lib/fog/core/connection.rb
bbcloud-0.11.0 lib/bbcloud/vendor/fog/lib/fog/core/connection.rb
fog-0.6.0 lib/fog/core/connection.rb
fog-0.5.3 lib/fog/core/connection.rb
fog-0.5.2 lib/fog/core/connection.rb
fog-0.5.1 lib/fog/core/connection.rb
fog-0.5.0 lib/fog/core/connection.rb
phpfog-fog-0.4.1.3 lib/fog/core/connection.rb
phpfog-fog-0.4.1.2 lib/fog/core/connection.rb
phpfog-fog-0.4.1.1 lib/fog/core/connection.rb
phpfog-fog-0.4.1 lib/fog/core/connection.rb
fog-0.4.1 lib/fog/core/connection.rb