Module: Controls::Client::Assets
- Included in:
- Controls::Client
- Defined in:
- lib/controls/client/assets.rb
Overview
A module to encapsulate API methods related to assets
Asset Methods collapse
-
#applicable_assets(guidance, params = {}) ⇒ Array<Hash>
(also: #assets_by_guidance)
An array of hashes that represent assets.
-
#asset_search(query, params = {}) ⇒ Hash
- todo
-
change the name to asset_search/search_assets?.
-
-
#assets(params = {}) ⇒ Hash
- todo
-
use @overload here for assets(params) vs assets(uuid) vs assets({ uuid: ‘uuid-string’, other: ‘param’ }).
-
-
#misconfigured_assets(configuration, params = {}) ⇒ Array<Hash>
(also: #assets_by_configuration)
An array of hashes that represent assets.
-
#threat_assets(threat, params = {}) ⇒ Array<Hash>
(also: #assets_by_threat)
An array of hashes that represent assets.
-
#uncovered_assets(security_control, params = {}) ⇒ Array<Hash>
(also: #assets_by_security_control)
An array of hashes that represent assets.
-
#undefended_assets(threat_vector, params = {}) ⇒ Array<Hash>
(also: #assets_by_threat_vector)
An array of hashes that represent assets.
Instance Method Details
#applicable_assets(guidance, params = {}) ⇒ Array<Hash> Also known as: assets_by_guidance
Returns an array of hashes that represent assets.
40 41 42 |
# File 'lib/controls/client/assets.rb', line 40 def applicable_assets(guidance, params = {}) get "/guidance/#{guidance}/applicable_assets", params end |
#asset_search(query, params = {}) ⇒ Hash
- todo
-
change the name to asset_search/search_assets?
-
33 34 35 36 |
# File 'lib/controls/client/assets.rb', line 33 def asset_search(query, params = {}) params[:query] = query get "/assets/search", params end |
#assets(params = {}) ⇒ Hash
since the uuid is an optional param it has been added to the params options hash
- todo
-
use @overload here for assets(params) vs assets(uuid) vs assets({ uuid: ‘uuid-string’, other: ‘param’ })
-
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/controls/client/assets.rb', line 14 def assets(params = {}) if params.is_a? Hash uuid = params.delete(:uuid) else uuid = params params = {} end if uuid && !uuid.empty? get "/assets/#{uuid}", params else get '/assets', params end end |
#misconfigured_assets(configuration, params = {}) ⇒ Array<Hash> Also known as: assets_by_configuration
Returns an array of hashes that represent assets.
47 48 49 |
# File 'lib/controls/client/assets.rb', line 47 def misconfigured_assets(configuration, params = {}) get "/configurations/#{configuration}/misconfigured_assets", params end |
#threat_assets(threat, params = {}) ⇒ Array<Hash> Also known as: assets_by_threat
Returns an array of hashes that represent assets.
54 55 56 57 |
# File 'lib/controls/client/assets.rb', line 54 def threat_assets(threat, params = {}) fail NotImplementedError, "Assets by threat is not a valid request. Use Controls::Client#assets or Controls::Client#assets_by_threat_vector instead." # get "/threats/#{threat}/assets", params end |
#uncovered_assets(security_control, params = {}) ⇒ Array<Hash> Also known as: assets_by_security_control
Returns an array of hashes that represent assets.
63 64 65 |
# File 'lib/controls/client/assets.rb', line 63 def uncovered_assets(security_control, params = {}) get "/security_controls/#{security_control}/uncovered_assets", params end |
#undefended_assets(threat_vector, params = {}) ⇒ Array<Hash> Also known as: assets_by_threat_vector
Returns an array of hashes that represent assets.
70 71 72 |
# File 'lib/controls/client/assets.rb', line 70 def undefended_assets(threat_vector, params = {}) get "/threat_vectors/#{threat_vector}/undefended_assets", params end |