Class: Radfish::VendorDetector
- Inherits:
-
Object
- Object
- Radfish::VendorDetector
- Includes:
- Debuggable
- Defined in:
- lib/radfish/vendor_detector.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#use_ssl ⇒ Object
readonly
Returns the value of attribute use_ssl.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
-
#verbosity ⇒ Object
Returns the value of attribute verbosity.
-
#verify_ssl ⇒ Object
readonly
Returns the value of attribute verify_ssl.
Instance Method Summary collapse
- #detect ⇒ Object
-
#initialize(host:, username:, password:, port: 443, use_ssl: true, verify_ssl: false, host_header: nil) ⇒ VendorDetector
constructor
A new instance of VendorDetector.
Methods included from Debuggable
Constructor Details
#initialize(host:, username:, password:, port: 443, use_ssl: true, verify_ssl: false, host_header: nil) ⇒ VendorDetector
Returns a new instance of VendorDetector.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/radfish/vendor_detector.rb', line 12 def initialize(host:, username:, password:, port: 443, use_ssl: true, verify_ssl: false, host_header: nil) @host = host @username = username @password = password @port = port @use_ssl = use_ssl @verify_ssl = verify_ssl @host_header = host_header @verbosity = 0 # Use the shared HTTP client @http_client = HttpClient.new( host: host, port: port, use_ssl: use_ssl, verify_ssl: verify_ssl, username: username, password: password, host_header: host_header, # Pass host_header to HttpClient verbosity: 0, # Will be updated via verbosity= setter retry_count: 2, # Fewer retries for detection retry_delay: 0.5 ) end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
9 10 11 |
# File 'lib/radfish/vendor_detector.rb', line 9 def host @host end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
9 10 11 |
# File 'lib/radfish/vendor_detector.rb', line 9 def password @password end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
9 10 11 |
# File 'lib/radfish/vendor_detector.rb', line 9 def port @port end |
#use_ssl ⇒ Object (readonly)
Returns the value of attribute use_ssl.
9 10 11 |
# File 'lib/radfish/vendor_detector.rb', line 9 def use_ssl @use_ssl end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
9 10 11 |
# File 'lib/radfish/vendor_detector.rb', line 9 def username @username end |
#verbosity ⇒ Object
Returns the value of attribute verbosity.
10 11 12 |
# File 'lib/radfish/vendor_detector.rb', line 10 def verbosity @verbosity end |
#verify_ssl ⇒ Object (readonly)
Returns the value of attribute verify_ssl.
9 10 11 |
# File 'lib/radfish/vendor_detector.rb', line 9 def verify_ssl @verify_ssl end |
Instance Method Details
#detect ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/radfish/vendor_detector.rb', line 42 def detect debug "Detecting vendor for #{host}:#{port}...", 1, :cyan debug "Host header: #{@host_header}" if @host_header # Try to get the Redfish service root debug "Fetching service root...", 2, :yellow service_root = fetch_service_root unless service_root debug "Failed to fetch service root from #{host}:#{port}", 1, :red return nil end debug "Service root fetched successfully", 2, :green vendor = identify_vendor(service_root) debug "Detected vendor: #{vendor || 'Unknown'} for #{host}:#{port}", 1, vendor ? :green : :yellow vendor end |