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

Methods

Included Modules

Addressable Faraday::Utils

Constants

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

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

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]