module Faraday

Constants

Parts
Timer
UploadIO
VERSION

Attributes

default_adapter[RW]
default_connection[W]
lib_path[RW]
root_path[RW]

Public Class Methods

default_connection() click to toggle source
# File lib/faraday.rb, line 32
def self.default_connection
  @default_connection ||= Connection.new
end
new(url = nil, options = {}) click to toggle source
# File lib/faraday.rb, line 9
def new(url = nil, options = {})
  block = block_given? ? Proc.new : nil
  Faraday::Connection.new(url, options, &block)
end
register_middleware(type, mapping = nil) click to toggle source

Public: register middleware classes under a short name.

type - A Symbol specifying the kind of middleware (default: :middleware) mapping - A Hash mapping Symbol keys to classes. Classes can be expressed

as fully qualified constant, or a Proc that will be lazily called
to return the former.

Examples

Faraday.register_middleware :aloha => MyModule::Aloha
Faraday.register_middleware :response, :boom => MyModule::Boom

# shortcuts are now available in Builder:
builder.use :aloha
builder.response :boom

Returns nothing.

# File lib/faraday.rb, line 114
def self.register_middleware type, mapping = nil
  type, mapping = :middleware, type if mapping.nil?
  component = self.const_get(type.to_s.capitalize)
  component.register_middleware(mapping)
end
require_lib(*libs) click to toggle source
Alias for: require_libs
require_libs(*libs) click to toggle source
# File lib/faraday.rb, line 14
def require_libs(*libs)
  libs.each do |lib|
    require "#{lib_path}/#{lib}"
  end
end
Also aliased as: require_lib