Module: Controls::Client::SecurityControls
- Included in:
- Controls::Client
- Defined in:
- lib/controls/client/security_controls.rb
Overview
A module to encapsulate API methods related to security controls and configurations
Instance Method Summary collapse
-
#security_controls(control = nil) ⇒ Hash
A hash representing a security control.
-
#security_controls_coverage(control = nil) ⇒ Hash
A hash representing a security control coverage.
-
#threat_vector_security_controls(vector) ⇒ Array<Hash>
(also: #security_controls_by_threat_vector)
A list of hashes representing threats.
-
#update_security_controls(controls) ⇒ void
Updates the specified security control(s).
Instance Method Details
#security_controls(control = nil) ⇒ Hash
TODO:
warn that this method returns a different object now?
Returns a hash representing a security control.
14 15 16 17 18 19 20 |
# File 'lib/controls/client/security_controls.rb', line 14 def security_controls(control = nil) if control get "/security_controls/#{control}" else get '/security_controls' end end |
#security_controls_coverage(control = nil) ⇒ Hash
TODO:
add a since note? this replaces security_controls and security_controls now returns a new object
Returns a hash representing a security control coverage.
26 27 28 29 30 31 32 |
# File 'lib/controls/client/security_controls.rb', line 26 def security_controls_coverage(control = nil) if control get "/coverage/security_controls/#{control}" else get '/coverage/security_controls' end end |
#threat_vector_security_controls(vector) ⇒ Array<Hash> Also known as: security_controls_by_threat_vector
Returns a list of hashes representing threats.
51 52 53 |
# File 'lib/controls/client/security_controls.rb', line 51 def threat_vector_security_controls(vector) get "/threat_vectors/#{vector}/security_controls" end |
#update_security_controls(controls) ⇒ void
This method returns an undefined value.
Updates the specified security control(s)
38 39 40 41 42 43 44 45 46 |
# File 'lib/controls/client/security_controls.rb', line 38 def update_security_controls(controls) if controls.kind_of? Array put '/security_controls', controls.to_json elsif controls.is_a? Controls::SecurityControl put "/security_controls/#{controls.name}", controls.to_json elsif controls.is_a? Hash put "/security_controls/#{controls['name']}", controls.to_json end end |