Class: SmoothOperator::HttpHandlers::Typhoeus::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/smooth_operator/http_handlers/typhoeus/base.rb

Class Method Summary collapse

Class Method Details

.make_the_call(http_verb, url, options, basic_auth_credentials) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/smooth_operator/http_handlers/typhoeus/base.rb', line 10

def self.make_the_call(http_verb, url, options, basic_auth_credentials)
  hydra = get_hydra_and_remove_it_from options
  options = { (http_verb == :get ? :params : :body) => options, :method => http_verb, :headers => { "Content-type" => "application/x-www-form-urlencoded" } }.merge auth_credentials(basic_auth_credentials)
  
  if hydra.present?
    make_asynchronous_request(url, options, hydra)
  else
    make_synchronous_request(url, options)
  end
end