Method: Nessus::Client#initialize

Defined in:
lib/nessus/client.rb

#initialize(host, login = nil, password = nil, connection_options = {}) {|@connection| ... } ⇒ Client

Returns a new instance of Client.

Parameters:

  • host (String)

    the base URL to use when connecting to the Nessus API

Yields:



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/nessus/client.rb', line 32

def initialize(host,  = nil, password = nil, connection_options = {})
  connection_options[:ssl] ||= {}
  connection_options[:ssl][:verify] ||= Nessus::Client.verify_ssl.nil? || Nessus::Client.verify_ssl

  @connection = Faraday.new host, connection_options
  @connection.headers[:user_agent] = "Nessus.rb v#{Nessus::VERSION}".freeze

  # Allow passing a block to Faraday::Connection
  yield @connection if block_given?

  authenticate(, password) if  && password
end