Module: Faraday
- Extended by:
- AutoloadHelper
- Defined in:
- lib/faraday.rb,
lib/faraday/error.rb,
lib/faraday/utils.rb,
lib/faraday/adapter.rb,
lib/faraday/builder.rb,
lib/faraday/request.rb,
lib/faraday/response.rb,
lib/faraday/upload_io.rb,
lib/faraday/connection.rb,
lib/faraday/middleware.rb,
lib/faraday/adapter/test.rb,
lib/faraday/adapter/excon.rb,
lib/faraday/request/retry.rb,
lib/faraday/adapter/patron.rb,
lib/faraday/adapter/em_http.rb,
lib/faraday/response/logger.rb,
lib/faraday/adapter/typhoeus.rb,
lib/faraday/adapter/net_http.rb,
lib/faraday/request/multipart.rb,
lib/faraday/request/url_encoded.rb,
lib/faraday/response/raise_error.rb,
lib/faraday/adapter/em_synchrony.rb,
lib/faraday/adapter/action_dispatch.rb,
lib/faraday/request/token_authentication.rb,
lib/faraday/request/basic_authentication.rb,
lib/faraday/adapter/em_synchrony/parallel_manager.rb
Defined Under Namespace
Modules: AutoloadHelper, Error, MiddlewareRegistry, Utils Classes: Adapter, Builder, CompositeReadIO, Connection, Middleware, Request, Response
Constant Summary
- VERSION =
"0.8.0.rc2"- UploadIO =
::UploadIO
- Parts =
::Parts
Class Attribute Summary (collapse)
-
+ (Object) default_adapter
Returns the value of attribute default_adapter.
- + (Object) default_connection
-
+ (Object) lib_path
Returns the value of attribute lib_path.
-
+ (Object) root_path
Returns the value of attribute root_path.
Class Method Summary (collapse)
- + (Object) new(url = nil, options = {})
-
+ (Object) register_middleware(type, mapping = nil)
Public: register middleware classes under a short name.
- + (Object) require_libs(*libs) (also: require_lib)
Methods included from AutoloadHelper
all_loaded_constants, autoload_all, load_autoloaded_constants
Class Attribute Details
+ (Object) default_adapter
Returns the value of attribute default_adapter
6 7 8 |
# File 'lib/faraday.rb', line 6 def default_adapter @default_adapter end |
+ (Object) default_connection
32 33 34 |
# File 'lib/faraday.rb', line 32 def self.default_connection @default_connection ||= Connection.new end |
+ (Object) lib_path
Returns the value of attribute lib_path
5 6 7 |
# File 'lib/faraday.rb', line 5 def lib_path @lib_path end |
+ (Object) root_path
Returns the value of attribute root_path
5 6 7 |
# File 'lib/faraday.rb', line 5 def root_path @root_path end |
Class Method Details
+ (Object) new(url = nil, options = {})
9 10 11 12 |
# File 'lib/faraday.rb', line 9 def new(url = nil, = {}) block = block_given? ? Proc.new : nil Faraday::Connection.new(url, , &block) end |
+ (Object) register_middleware(type, mapping = nil)
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.
100 101 102 103 104 |
# File 'lib/faraday.rb', line 100 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 |
+ (Object) require_libs(*libs) Also known as: require_lib
14 15 16 17 18 |
# File 'lib/faraday.rb', line 14 def require_libs(*libs) libs.each do |lib| require "#{lib_path}/#{lib}" end end |