module Faraday
def self.const_missing(name)
def self.const_missing(name) if name.to_sym == :Builder warn "Faraday::Builder is now Faraday::RackBuilder." const_set name, RackBuilder else super end end
def self.default_connection
Gets the default connection used for simple scripts.
def self.default_connection @default_connection ||= Connection.new end
def self.default_connection_options
Gets the default connection options used when calling Faraday#new.
def self.default_connection_options @default_connection_options ||= ConnectionOptions.new end
def self.default_connection_options=(options)
def self.default_connection_options=(options) @default_connection_options = ConnectionOptions.from(options) end
def default_adapter=(adapter)
#default_connection.
Public: Updates default adapter while resetting
def default_adapter=(adapter) @default_connection = nil @default_adapter = adapter end
def method_missing(name, *args, &block)
Internal: Proxies method calls on the Faraday constant to
def method_missing(name, *args, &block) default_connection.send(name, *args, &block) end
def new(url = nil, options = nil)
:params => {:page => 1}
Faraday.new :url => 'http://faraday.com',
# same
Faraday.new 'http://faraday.com', :params => {:page => 1}
# http://faraday.com?page=1
Faraday.new 'http://faraday.com'
Examples
:proxy - Hash of Proxy options.
:ssl - Hash of SSL options.
:request - Hash of request options.
:headers - Hash of unencoded HTTP header key/value pairs.
:params - Hash of URI query unencoded key/value pairs.
:url - String base URL.
overridden for a specific request.
Any of these values will be set on every request made, unless
options - The optional Hash used to configure this Faraday::Connection.
requests. Can also be the options Hash.
url - The optional String base URL to use as a prefix for all
Public: Initializes a new Faraday::Connection.
def new(url = nil, options = nil) block = block_given? ? Proc.new : nil options = options ? default_connection_options.merge(options) : default_connection_options Faraday::Connection.new(url, options, &block) end
def require_libs(*libs)
*libs - One or more relative String names to Faraday classes.
Internal: Requires internal Faraday libraries.
def require_libs(*libs) libs.each do |lib| require "#{lib_path}/#{lib}" end end
def respond_to?(symbol, include_private = false)
def respond_to?(symbol, include_private = false) default_connection.respond_to?(symbol, include_private) || super end