class Eth::Client

def self.create(host)

Raises:
  • (ArgumentError) - in case it cannot determine the client type.

Returns:
  • (Eth::Client::Http) - an HTTP client.
  • (Eth::Client::HttpAuth) - an HTTP client with basic authentication.
  • (Eth::Client::Ipc) - an IPC client.

Parameters:
  • host (String) -- either an HTTP/S host or an IPC path.
def self.create(host)
  return Client::Ipc.new host if host.end_with? ".ipc"
  return Client::HttpAuth.new host if Regexp.new(":.*@.*:", Regexp::IGNORECASE).match host
  return Client::Http.new host if host.start_with? "http"
  raise ArgumentError, "Unable to detect client type!"
end