Class: SmoothOperator::Operators::Faraday
- Defined in:
- lib/smooth_operator/operators/faraday.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 {|remote_call| ... } ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/smooth_operator/operators/faraday.rb', line 11 def make_the_call remote_call = begin set_basic_authentication response = connection.send(http_verb) do |request| .each { |key, value| request..send("#{key}=", value) } [:headers].each { |key, value| request.headers[key] = value } params.each { |key, value| request.params[key] = value } request.url relative_path request.body = body end RemoteCall::Faraday.new(response) rescue ::Faraday::Error::ConnectionFailed RemoteCall::Errors::ConnectionFailed.new(response) rescue ::Faraday::Error::TimeoutError RemoteCall::Errors::Timeout.new(response) end yield(remote_call) if block_given? remote_call end |