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

Since:

  • API v1.0

Version:

  • v1.0.0

Instance Method Summary collapse

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.

Parameters:

  • control (String) (defaults to: nil)

    the name of the security control name to retrieve

Returns:

  • (Hash)

    a hash representing a security control

Since:

  • API v1.0



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.

Parameters:

  • control (String) (defaults to: nil)

    the name of the security control name to retrieve

Returns:

  • (Hash)

    a hash representing a security control coverage

Since:

  • API v1.0



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.

Parameters:

  • vector (String)

    the threat vector to search for securuty controls by

Returns:

  • (Array<Hash>)

    a list of hashes representing threats

Since:

  • API v1.0



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)

Parameters:

  • controls (Array[Hash{String=>String,Boolean}])

    a list of controls to update

Since:

  • API v1.0



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