Class: Faraday::Connection
- Inherits:
-
Object
- Object
- Faraday::Connection
- Defined in:
- lib/leadlight/lib_ext/faraday/connection.rb
Instance Method Summary collapse
-
#initialize(url = nil, options = {}) {|_self| ... } ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize(url = nil, options = {}) {|_self| ... } ⇒ Connection
Returns a new instance of Connection.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/leadlight/lib_ext/faraday/connection.rb', line 3 def initialize(url = nil, = {}) if url.is_a?(Hash) = url url = [:url] end @headers = Utils::Headers.new @params = Utils::ParamsHash.new @options = [:request] || {} @ssl = [:ssl] || {} adapter = [:adapter] @parallel_manager = nil @default_parallel_manager = [:parallel_manager] @builder = [:builder] || begin # pass an empty block to Builder so it doesn't assume default middleware block = block_given?? Proc.new {|b| } : nil Builder.new(&block) end self.url_prefix = url || 'http:/' @params.update [:params] if [:params] @headers.update [:headers] if [:headers] @proxy = nil proxy(.fetch(:proxy) { ENV['http_proxy'] }) yield self if block_given? if adapter self.adapter = adapter end end |