class Faraday::Connection

def initialize(url = nil, options = nil)

Other tags:
    Yield: - after all setup has been done

Options Hash: (**options)
  • :proxy[:password] (String) --
  • :proxy[:user] (String) --
  • :proxy[:uri] (URI, String) --
  • :proxy (Hash, URI, String) -- proxy options, either as a URL
  • :ssl (Hash) -- Hash of SSL options.
  • :request (Hash) -- Hash of request options.
  • :headers (Hash String>) -- Hash of unencoded HTTP
  • :params (Hash String>) -- URI query unencoded
  • :url (URI, String) -- URI or String base URL

Parameters:
  • options (Hash, Faraday::ConnectionOptions) --
  • url (URI, String) -- URI or String base URL to use as a prefix for all
def initialize(url = nil, options = nil)
  options = ConnectionOptions.from(options)
  if url.is_a?(Hash) || url.is_a?(ConnectionOptions)
    options = Utils.deep_merge(options, url)
    url     = options.url
  end
  @parallel_manager = nil
  @headers = Utils::Headers.new
  @params  = Utils::ParamsHash.new
  @options = options.request
  @ssl = options.ssl
  @default_parallel_manager = options.parallel_manager
  @manual_proxy = nil
  @builder = options.builder || begin
    # pass an empty block to Builder so it doesn't assume default middleware
    options.new_builder(block_given? ? proc { |b| } : nil)
  end
  self.url_prefix = url || 'http:/'
  @params.update(options.params)   if options.params
  @headers.update(options.headers) if options.headers
  initialize_proxy(url, options)
  yield(self) if block_given?
  @headers[:user_agent] ||= USER_AGENT
end