module SmoothOperator::Operators::Typhoeus
Public Instance Methods
generate_connection(adapter = nil, options = nil)
click to toggle source
# File lib/smooth_operator/operators/typhoeus.rb, line 16 def generate_connection(adapter = nil, options = nil) ConnectionWrapper.new(::Typhoeus::Hydra::hydra) end
generate_parallel_connection()
click to toggle source
# File lib/smooth_operator/operators/typhoeus.rb, line 12 def generate_parallel_connection generate_connection end
make_the_call(http_verb, resource_path, params, body, options) { |remote_call| ... }
click to toggle source
# File lib/smooth_operator/operators/typhoeus.rb, line 20 def make_the_call(http_verb, resource_path, params, body, options) request = ::Typhoeus::Request.new *typhoeus_request_args(http_verb, resource_path, params, body, options) hydra = (options[:connection] || generate_connection).connection request_result = nil hydra.queue(request) request.on_complete do |typhoeus_response| remote_call = remote_call(typhoeus_response) if block_given? request_result = yield(remote_call) else request_result = remote_call end end hydra.run if Helpers.blank?(options[:connection]) request_result end