Sha256: b6c2ef28717d175a346bd27b39ecc908c2650157ab76c40e11a78be4c0c64a08

Contents?: true

Size: 684 Bytes

Versions: 7

Compression:

Stored size: 684 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, 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

7 entries across 7 versions & 3 rubygems

Version Path
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/lib/fog/core/connection.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/lib/fog/core/connection.rb
fog-1.1.2 lib/fog/core/connection.rb
fog_tractical-1.1.4 lib/fog/core/connection.rb
fog_tractical-1.1.3 lib/fog/core/connection.rb
fog-1.1.1 lib/fog/core/connection.rb
fog-1.1.0 lib/fog/core/connection.rb