Sha256: 5c4dc36d1e4d0285d81ba0ddf3ff5d37c4210ce88dbbffef21f621f58bd6f29b

Contents?: true

Size: 767 Bytes

Versions: 24

Compression:

Stored size: 767 Bytes

Contents

module Fog
  class Connection

    def initialize(url, persistent=false, params={})
      Excon.defaults[:headers]['User-Agent'] ||= "fog/#{Fog::VERSION}"
      @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

24 entries across 24 versions & 9 rubygems

Version Path
cifrado-0.2.1 vendor/fog/lib/fog/core/connection.rb
cifrado-0.2.0 vendor/fog/lib/fog/core/connection.rb
fog-1.12.0 lib/fog/core/connection.rb
hpfog-0.0.20 lib/fog/core/connection.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/core/connection.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/core/connection.rb
fog-nirvanix-1.8.2 lib/fog/core/connection.rb
fog-1.11.1 lib/fog/core/connection.rb
fog-1.11.0 lib/fog/core/connection.rb
fog-nirvanix-1.8.1 lib/fog/core/connection.rb
fog-1.10.1 lib/fog/core/connection.rb
fog-test-me-1.10.0 lib/fog/core/connection.rb
cifrado-0.1.3 vendor/fog/lib/fog/core/connection.rb
fog-1.10.0 lib/fog/core/connection.rb
cifrado-0.1.2 vendor/fog/lib/fog/core/connection.rb
cifrado-0.1.1 vendor/fog/lib/fog/core/connection.rb
cifrado-0.1 vendor/fog/lib/fog/core/connection.rb
fog-1.9.0 lib/fog/core/connection.rb
fog-maestrodev-1.8.0.20130114204828 lib/fog/core/connection.rb
fog-maestrodev-1.8.0.20130111070250 lib/fog/core/connection.rb