| Class | Faraday::Connection |
| In: |
lib/faraday/connection.rb
|
| Parent: | Object |
| METHODS | = | Set.new [:get, :post, :put, :delete, :head] |
| METHODS_WITH_BODIES | = | Set.new [:post, :put] |
| builder | [R] | |
| headers | [RW] | |
| host | [RW] | |
| options | [R] | |
| parallel_manager | [RW] | |
| params | [RW] | |
| path_prefix | [R] | |
| port | [RW] | |
| scheme | [RW] | |
| ssl | [R] |
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
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