Sha256: 015d5a8a0eea9bd19d370f978b89f6c192f488f74fcb8f2d55c844222ce91830

Contents?: true

Size: 790 Bytes

Versions: 1

Compression:

Stored size: 790 Bytes

Contents

# ApiClient::Dispatcher provides methods to make requests
module ApiClient::Dispatcher
  autoload :Typhoeus, 'api-client/dispatcher/typhoeus'
  autoload :NetHttp, 'api-client/dispatcher/net-http'

  def self.method_missing(method, *args)
    if defined?(::Typhoeus)
      Typhoeus.send(method, *args)
    else
      NetHttp.send(method, *args)
    end
  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 respond_to_missing?(method_name, include_private = false)
    return true if Typhoeus.respond_to?(method_name)
    return true if NetHttp.respond_to?(method_name)
    super
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
api-client-2.0.0.rc2 lib/api-client/dispatcher.rb