Class Faraday::Connection
In: lib/faraday/connection.rb
Parent: Object

Methods

adapter   app   basic_auth   build   build_url   delete   dup   get   head   in_parallel   in_parallel?   new   patch   path_prefix=   post   proxy   proxy_arg_to_uri   put   request   response   run_request   token_auth   url_prefix=   use  

Included Modules

Addressable

Constants

METHODS = Set.new [:get, :post, :put, :delete, :head, :patch, :options]
METHODS_WITH_BODIES = Set.new [:post, :put, :patch, :options]

Attributes

builder  [R] 
headers  [RW] 
host  [RW] 
options  [R] 
parallel_manager  [RW] 
params  [RW] 
path_prefix  [R] 
port  [RW] 
scheme  [RW] 
ssl  [R] 

Public Class methods

Public Instance methods

The "rack app" wrapped in middleware. All requests are sent here.

The builder is responsible for creating the app object. After this, the builder gets locked to ensure no further modifications are made to the middleware stack.

Returns an object that responds to `call` and returns a Response.

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

Ensures that the path prefix always has a leading / and no trailing /

Parses the giving url with Addressable::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

[Validate]