Sha256: 9dee4839ef8dca611064b46143468de9cd1a1fb3013661cc2670db500bfe840e
Contents?: true
Size: 1.52 KB
Versions: 6
Compression:
Stored size: 1.52 KB
Contents
# ApiClient::Dispatcher provides methods to make requests module ApiClient::Dispatcher autoload :Typhoeus, 'api-client/dispatcher/typhoeus' autoload :NetHttp, 'api-client/dispatcher/net-http' autoload :Parallel, 'api-client/dispatcher/parallel' # 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. 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 # 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. 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 end
Version data entries
6 entries across 6 versions & 1 rubygems