Class: SmoothOperator::Operators::Typhoeus
- Defined in:
- lib/smooth_operator/operators/typhoeus.rb
Instance Attribute Summary
Attributes inherited from Base
#body, #connection, #endpoint_pass, #endpoint_user, #http_verb, #operator_class, #operator_options, #options, #params, #relative_path
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from SmoothOperator::Operators::Base
Instance Method Details
#make_the_call ⇒ Object
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 37 38 |
# File 'lib/smooth_operator/operators/typhoeus.rb', line 10 def make_the_call set_basic_authentication request = ::Typhoeus::Request.new(url, ) remote_call = {} # hydra.queue(request) request.on_complete do |typhoeus_response| remote_call_class = if typhoeus_response.return_code == :couldnt_connect RemoteCall::Errors::ConnectionFailed elsif typhoeus_response.timed_out? RemoteCall::Errors::Timeout else RemoteCall::Typhoeus end remote_call = remote_call_class.new(typhoeus_response) yield(remote_call) if block_given? end # hydra.run request.run remote_call end |