module Qualys::Config

Attributes

password[RW]
session_key[RW]
username[RW]

Public Instance Methods

from_hash(options = {}) click to toggle source

Configure Qualys from a hash. This is usually called after parsing a yaml config file such as qualys.yaml.

@example Configure Qualys.

config.from_hash({})

@param [ Hash ] options The settings to use.

# File lib/qualys/config.rb, line 15
def from_hash(options = {})
  options.each_pair do |name, value|
    send("#{name}=", value) if respond_to?("#{name}=")
  end
end
load!(path) click to toggle source

Load the settings from a compliant Qualys.yml file. This can be used for easy setup with frameworks other than Rails.

@example Configure Qualys.

Qualys.load!("/path/to/qualys.yml")

@param [ String ] path The path to the file.

# File lib/qualys/config.rb, line 28
def load!(path)
  settings = YAML.safe_load(ERB.new(File.new(path).read).result)['api']
  from_hash(settings) if settings.is_a? Hash
end