Class | Faraday::Connection |
In: |
lib/faraday/connection.rb
|
Parent: | Object |
METHODS | = | Set.new [:get, :post, :put, :delete, :head, :patch, :options] |
METHODS_WITH_BODIES | = | Set.new [:post, :put, :patch, :options] |
builder | [R] | |
default_parallel_manager | [W] | |
headers | [R] | |
options | [R] | |
parallel_manager | [R] | |
params | [R] | |
ssl | [R] | |
url_prefix | [R] |
Public: Initializes a new Faraday::Connection.
url - URI or String base URL to use as a prefix for all
requests (optional).
options - Hash of settings that will be applied to every request made
from this Connection (default: {}). :url - URI or String base URL (default: "http:/"). :params - Hash of URI query unencoded key/value pairs. :headers - Hash of unencoded HTTP header key/value pairs. :request - Hash of request options. :ssl - Hash of SSL options. :proxy - URI, String or Hash of HTTP proxy options (default: "http_proxy" environment variable). :uri - URI or String :user - String (optional) :password - String (optional)
Internal: Build an absolute URL based on url_prefix.
url - A String or URI-like object params - A Faraday::Utils::ParamsHash to replace the query values
of the resulting url (default: nil).
Returns the resulting URI instance.
Takes a relative url for a request and combines it with the defaults set on the connection instance.
conn = Faraday::Connection.new { ... } conn.url_prefix = "https://sushi.com/api?token=abc" conn.scheme # => https conn.path_prefix # => "/api" conn.build_url("nigiri?page=2") # => https://sushi.com/api/nigiri?token=abc&page=2 conn.build_url("nigiri", :page => 2) # => https://sushi.com/api/nigiri?token=abc&page=2
Internal: Traverse the middleware stack in search of a parallel-capable adapter.
Yields in case of not found.
Returns a parallel manager or nil if not found.
Parses the giving url with URI and stores the individual components in this connection. These components serve as defaults for requests made by this connection.
conn = Faraday::Connection.new { ... } conn.url_prefix = "https://sushi.com/api" conn.scheme # => https conn.path_prefix # => "/api" conn.get("nigiri?page=2") # accesses https://sushi.com/api/nigiri
Internal: Yields username and password extracted from a URI if they both exist.