Parent

Class/Module Index [+]

Quicksearch

Fog::Connection

Public Class Methods

new(url, persistent=false, params={}) click to toggle source
# File lib/fog/core/connection.rb, line 4
def initialize(url, persistent=false, params={})
  Excon.defaults[:headers]['User-Agent'] ||= "fog/#{Fog::VERSION}"
  @excon = Excon.new(url, params)
  @persistent = persistent
end

Public Instance Methods

request(params, &block) click to toggle source
# File lib/fog/core/connection.rb, line 10
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
reset() click to toggle source
# File lib/fog/core/connection.rb, line 31
def reset
  @excon.reset
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.