module Faraday
def self.default_connection
-
connection
(Faraday::Connection
) --
Overloads:
-
default_connection=(connection)
-
default_connection
Returns:
-
(Faraday::Connection)
- a connection configured with
def self.default_connection @default_connection ||= Connection.new(default_connection_options) end
def self.default_connection_options
-
(Faraday::ConnectionOptions)
-
def self.default_connection_options @default_connection_options ||= ConnectionOptions.new end
def self.default_connection_options=(options)
-
options
(Hash, Faraday::ConnectionOptions
) --
def self.default_connection_options=(options) @default_connection = nil @default_connection_options = ConnectionOptions.from(options) end
def default_adapter=(adapter)
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) if default_connection.respond_to?(name) default_connection.send(name, *args, &block) else super end end
def new(url = nil, options = {}, &block)
- Example: With everything in an options hash -
Example: With an URL argument and an options hash -
Example: With an URL argument -
Returns:
-
(Faraday::Connection)
-
Options Hash:
(**options)
-
:proxy
(Hash
) -- Hash of Proxy options. -
:ssl
(Hash
) -- Hash of SSL options. -
:request
(Hash
) -- Hash of request options. -
:headers
(Hash
) -- Hash of unencoded HTTP headers. -
:params
(Hash
) -- Hash of unencoded URI query params. -
:url
(String
) -- Base URL
Parameters:
-
options
(Hash
) -- -
url
(String, Hash
) -- The optional String base URL to use as a prefix
def new(url = nil, options = {}, &block) options = default_connection_options.merge(options) Faraday::Connection.new(url, options, &block) end
def require_libs(*libs)
-
(void)
-
Parameters:
-
libs
(Array
) -- one or more relative String names to Faraday classes.
Other tags:
- Private: -
def require_libs(*libs) libs.each do |lib| require "#{lib_path}/#{lib}" end end
def respond_to_missing?(symbol, include_private = false)
def respond_to_missing?(symbol, include_private = false) default_connection.respond_to?(symbol, include_private) || super end