module SmoothOperator::Operators

Public Instance Methods

remote_call(typhoeus_response) click to toggle source
# File lib/smooth_operator/operators/typhoeus.rb, line 50
def remote_call(typhoeus_response)
  if typhoeus_response.return_code == :couldnt_connect
    RemoteCall::Errors::ConnectionFailed
  elsif typhoeus_response.timed_out?
    RemoteCall::Errors::Timeout
  else
    RemoteCall::Typhoeus
  end.new(typhoeus_response)
end
request_configuration(request, request_options, options, params, body) click to toggle source
# File lib/smooth_operator/operators/faraday.rb, line 69
def request_configuration(request, request_options, options, params, body)
  request_options.each { |key, value| request.options.send("#{key}=", value) }

  options[:headers].each { |key, value| request.headers[key] = value }

  params.each { |key, value| request.params[key] = value }

  request.body = body
end
set_basic_authentication(connection, options) click to toggle source
# File lib/smooth_operator/operators/faraday.rb, line 65
def set_basic_authentication(connection, options)
  connection.basic_auth(options[:endpoint_user], options[:endpoint_pass]) if Helpers.present?(options[:endpoint_user])
end