Module: Faraday
- Defined in:
- lib/faraday/error.rb,
lib/faraday/utils.rb,
lib/faraday/adapter.rb,
lib/faraday/methods.rb,
lib/faraday/options.rb,
lib/faraday/request.rb,
lib/faraday/version.rb,
lib/faraday/autoload.rb,
lib/faraday/response.rb,
lib/faraday/file_part.rb,
lib/faraday/connection.rb,
lib/faraday/middleware.rb,
lib/faraday/param_part.rb,
lib/faraday/options/env.rb,
lib/faraday/adapter/rack.rb,
lib/faraday/adapter/test.rb,
lib/faraday/rack_builder.rb,
lib/faraday/request/retry.rb,
lib/faraday/utils/headers.rb,
lib/faraday/adapter/patron.rb,
lib/faraday/response/logger.rb,
lib/faraday/adapter/typhoeus.rb,
lib/faraday/adapter_registry.rb,
lib/faraday/dependency_loader.rb,
lib/faraday/logging/formatter.rb,
lib/faraday/request/multipart.rb,
lib/faraday/utils/params_hash.rb,
lib/faraday/adapter/httpclient.rb,
lib/faraday/middleware_registry.rb,
lib/faraday/options/ssl_options.rb,
lib/faraday/request/url_encoded.rb,
lib/faraday/response/raise_error.rb,
lib/faraday/options/proxy_options.rb,
lib/faraday/request/authorization.rb,
lib/faraday/options/request_options.rb,
lib/faraday/request/instrumentation.rb,
lib/faraday/options/connection_options.rb,
lib/faraday/encoders/flat_params_encoder.rb,
lib/faraday/request/basic_authentication.rb,
lib/faraday/request/token_authentication.rb,
lib/faraday/encoders/nested_params_encoder.rb,
lib/faraday.rb
Overview
This is the main namespace for Faraday.
It provides methods to create Connection objects, and HTTP-related methods to use directly.
Defined Under Namespace
Modules: AutoloadHelper, DecodeMethods, DependencyLoader, EncodeMethods, FlatParamsEncoder, Logging, MiddlewareRegistry, NestedParamsEncoder, Utils Classes: Adapter, AdapterRegistry, BadRequestError, ClientError, CompositeReadIO, ConflictError, Connection, ConnectionFailed, ConnectionOptions, Env, Error, ForbiddenError, Middleware, NilStatusError, Options, ParamPart, ParsingError, ProxyAuthError, ProxyOptions, RackBuilder, Request, RequestOptions, ResourceNotFound, Response, RetriableResponse, SSLError, SSLOptions, ServerError, TimeoutError, UnauthorizedError, UnprocessableEntityError
Constant Summary collapse
- METHODS_WITH_QUERY =
%w[get head delete trace].freeze
- METHODS_WITH_BODY =
%w[post put patch].freeze
- VERSION =
'1.4.2'
- FilePart =
The uploaded binary data’s content type.
The base filename, taken either from the filename_or_io or filename arguments in #initialize.
Extra String key/value pairs to make up the header for this uploaded file.
The open IO object for the uploaded file.
::UploadIO
- UploadIO =
Deprecated.
Use FilePart instead of this class. It behaves identically, with a matching name to ParamPart.
Multipart value used to POST a file.
::UploadIO
- Parts =
::Parts
- Timer =
Timeout
Class Attribute Summary collapse
- .default_adapter ⇒ Object
- .default_connection ⇒ Object
-
.ignore_env_proxy ⇒ Boolean
Tells Faraday to ignore the environment proxy (http_proxy).
-
.lib_path ⇒ String
Gets or sets the path that the Faraday libs are loaded from.
-
.root_path ⇒ String
The root path that Faraday is being loaded from.
Instance Attribute Summary collapse
-
#content_type ⇒ Faraday::FilePart, ...
readonly
The uploaded binary data’s content type.
-
#io ⇒ Faraday::FilePart, ...
readonly
The uploaded binary data’s content type.
-
#opts ⇒ Faraday::FilePart, ...
readonly
The uploaded binary data’s content type.
-
#original_filename ⇒ Faraday::FilePart, ...
readonly
The uploaded binary data’s content type.
Class Method Summary collapse
-
.default_connection_options ⇒ Faraday::ConnectionOptions
Gets the default connection options used when calling Faraday.new.
-
.default_connection_options=(options) ⇒ Object
Sets the default options used when calling Faraday.new.
-
.new(url = nil, options = {}, &block) ⇒ Faraday::Connection
Initializes a new Connection.
-
.require_libs(*libs) ⇒ void
(also: require_lib)
Internal: Requires internal Faraday libraries.
- .respond_to_missing?(symbol, include_private = false) ⇒ Boolean
Instance Method Summary collapse
Class Attribute Details
.default_adapter ⇒ Symbol .default_adapter=(adapter) ⇒ Symbol
68 69 70 |
# File 'lib/faraday.rb', line 68 def default_adapter @default_adapter end |
.default_connection ⇒ Faraday::Connection .default_connection=(connection) ⇒ Object
142 143 144 |
# File 'lib/faraday.rb', line 142 def default_connection @default_connection ||= Connection.new() end |
.ignore_env_proxy ⇒ Boolean
Tells Faraday to ignore the environment proxy (http_proxy). Defaults to ‘false`.
76 77 78 |
# File 'lib/faraday.rb', line 76 def ignore_env_proxy @ignore_env_proxy end |
.lib_path ⇒ String
Gets or sets the path that the Faraday libs are loaded from.
59 60 61 |
# File 'lib/faraday.rb', line 59 def lib_path @lib_path end |
.root_path ⇒ String
The root path that Faraday is being loaded from.
This is the root from where the libraries are auto-loaded.
55 56 57 |
# File 'lib/faraday.rb', line 55 def root_path @root_path end |
Instance Attribute Details
#content_type ⇒ Faraday::FilePart, ... (readonly)
The uploaded binary data’s content type.
The base filename, taken either from the filename_or_io or filename arguments in #initialize.
Extra String key/value pairs to make up the header for this uploaded file.
The open IO object for the uploaded file.
53 |
# File 'lib/faraday/file_part.rb', line 53 FilePart = ::UploadIO |
#io ⇒ Faraday::FilePart, ... (readonly)
The uploaded binary data’s content type.
The base filename, taken either from the filename_or_io or filename arguments in #initialize.
Extra String key/value pairs to make up the header for this uploaded file.
The open IO object for the uploaded file.
53 |
# File 'lib/faraday/file_part.rb', line 53 FilePart = ::UploadIO |
#opts ⇒ Faraday::FilePart, ... (readonly)
The uploaded binary data’s content type.
The base filename, taken either from the filename_or_io or filename arguments in #initialize.
Extra String key/value pairs to make up the header for this uploaded file.
The open IO object for the uploaded file.
53 |
# File 'lib/faraday/file_part.rb', line 53 FilePart = ::UploadIO |
#original_filename ⇒ Faraday::FilePart, ... (readonly)
The uploaded binary data’s content type.
The base filename, taken either from the filename_or_io or filename arguments in #initialize.
Extra String key/value pairs to make up the header for this uploaded file.
The open IO object for the uploaded file.
53 |
# File 'lib/faraday/file_part.rb', line 53 FilePart = ::UploadIO |
Class Method Details
.default_connection_options ⇒ Faraday::ConnectionOptions
Gets the default connection options used when calling new.
149 150 151 |
# File 'lib/faraday.rb', line 149 def @default_connection_options ||= ConnectionOptions.new end |
.default_connection_options=(options) ⇒ Object
Sets the default options used when calling new.
156 157 158 159 |
# File 'lib/faraday.rb', line 156 def () @default_connection = nil @default_connection_options = ConnectionOptions.from() end |
.new(url = nil, options = {}, &block) ⇒ Faraday::Connection
Initializes a new Connection.
105 106 107 108 |
# File 'lib/faraday.rb', line 105 def new(url = nil, = {}, &block) = .merge() Faraday::Connection.new(url, , &block) end |
.require_libs(*libs) ⇒ void Also known as: require_lib
This method returns an undefined value.
Internal: Requires internal Faraday libraries.
115 116 117 118 119 |
# File 'lib/faraday.rb', line 115 def require_libs(*libs) libs.each do |lib| require "#{lib_path}/#{lib}" end end |
.respond_to_missing?(symbol, include_private = false) ⇒ Boolean
129 130 131 |
# File 'lib/faraday.rb', line 129 def respond_to_missing?(symbol, include_private = false) default_connection.respond_to?(symbol, include_private) || super end |
Instance Method Details
#initialize(filename_or_io, content_type, filename = nil, opts = {}) ⇒ Object
53 |
# File 'lib/faraday/file_part.rb', line 53 FilePart = ::UploadIO |