Class: Faraday::Adapter::Typhoeus

Inherits:
Faraday::Adapter show all
Defined in:
lib/faraday/adapter/typhoeus.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.setup_parallel_manager(options = {}) ⇒ Typhoeus::Hydra

Setup Hydra with provided options.

Examples:

Setup Hydra.

Faraday::Adapter::Typhoeus.setup_parallel_manager
#=> #<Typhoeus::Hydra ... >

Returns:

  • (Typhoeus::Hydra)

    The hydra.



21
22
23
# File 'lib/faraday/adapter/typhoeus.rb', line 21

def self.setup_parallel_manager(options = {})
  ::Typhoeus::Hydra.new(options)
end

Instance Method Details

#call(env) ⇒ Object

Parameters:

  • env (Faraday::Env)

    the environment of the request being processed



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/faraday/adapter/typhoeus.rb', line 26

def call(env)
  super
  perform_request env
  @app.call(env)

  # Finally, it's good practice to rescue client-specific exceptions (e.g.
  # Timeout, ConnectionFailed, etc...) and re-raise them as Faraday
  # Errors. Check `Faraday::Error` for a list of all errors.
  #
  # rescue MyAdapterTimeout => e
  #   # Most errors allow you to provide the original exception and optionally (if available) the response, to
  #   # make them available outside of the middleware stack.
  #   raise Faraday::TimeoutError, e
  # end
end