Module: Qualys::Config
Defined Under Namespace
Classes: RequiredOptionMissing
Instance Attribute Summary collapse
-
#password ⇒ Object
Returns the value of attribute password.
-
#session_key ⇒ Object
Returns the value of attribute session_key.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#from_hash(options = {}) ⇒ Object
Configure Qualys from a hash.
-
#load!(path) ⇒ Object
Load the settings from a compliant Qualys.yml file.
Instance Attribute Details
#password ⇒ Object
Returns the value of attribute password.
6 7 8 |
# File 'lib/qualys/config.rb', line 6 def password @password end |
#session_key ⇒ Object
Returns the value of attribute session_key.
6 7 8 |
# File 'lib/qualys/config.rb', line 6 def session_key @session_key end |
#username ⇒ Object
Returns the value of attribute username.
6 7 8 |
# File 'lib/qualys/config.rb', line 6 def username @username end |
Instance Method Details
#from_hash(options = {}) ⇒ Object
Configure Qualys from a hash. This is usually called after parsing a yaml config file such as qualys.yaml.
15 16 17 18 19 |
# File 'lib/qualys/config.rb', line 15 def from_hash( = {}) .each_pair do |name, value| send("#{name}=", value) if respond_to?("#{name}=") end end |
#load!(path) ⇒ Object
Load the settings from a compliant Qualys.yml file. This can be used for easy setup with frameworks other than Rails.
28 29 30 31 |
# 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 |