module ApiClient::Dispatcher

ApiClient::Dispatcher provides methods to make requests

Public Class Methods

method_missing(method_name, *args) click to toggle source

It passes the call to a more specific class to handle the dispatch logic based on the environment.

@param [Symbol] method_name the name of the method. @param [Array] args array of params to be passed ahead.

Calls superclass method
# File lib/api-client/dispatcher.rb, line 11
def self.method_missing(method_name, *args)
  case true
    when ApiClient.config.hydra != false && defined?(::Typhoeus) != nil
      return Parallel.send(method_name, *args) if Parallel.respond_to?(method_name)
    when defined?(::Typhoeus)
      return Typhoeus.send(method_name, *args) if Typhoeus.respond_to?(method_name)
    else
      return NetHttp.send(method_name, *args) if NetHttp.respond_to?(method_name)
  end
  super
end
respond_to_missing?(method_name, include_private = false) click to toggle source

Overwrite respond_to? default behavior

@param [Symbol] method_name the name of the method. @param [Boolean] include_private if it does work to private methods as well. @return [Boolean] if it responds to the method or not.

Calls superclass method
# File lib/api-client/dispatcher.rb, line 28
def self.respond_to_missing?(method_name, include_private = false)
  case true
    when ApiClient.config.hydra && defined?(::Typhoeus)
      return true if Parallel.respond_to?(method_name)
    when defined?(::Typhoeus)
      return true if Typhoeus.respond_to?(method_name)
    else
      return true if NetHttp.respond_to?(method_name)
  end
  super
end