Class: Emasser::TestResults

Inherits:
SubCommandBase show all
Defined in:
lib/emasser/get.rb,
lib/emasser/post.rb

Overview

The Test Results endpoints provide the ability to add test results for a system’s Assessment Procedures (CCIs) which determine Security Control compliance.

Endpoint:

/api/systems/{systemId}/test-results - Add one or many test results for a system

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SubCommandBase

banner

Methods included from OutputConverters

#to_output_hash

Methods included from InputConverters

#to_input_hash

Methods included from OptionsParser

#optional_options, #required_options

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


244
245
246
# File 'lib/emasser/get.rb', line 244

def self.exit_on_failure?
  true
end

Instance Method Details

#addObject



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/emasser/post.rb', line 63

def add
  body = EmassClient::TestResultsRequestPostBody.new
  body.cci = options[:cci]
  body.tested_by = options[:testedBy]
  body.test_date = options[:testDate]
  body.description = options[:description]
  body.compliance_status = options[:complianceStatus]

  body_array = Array.new(1, body)

  begin
    result = EmassClient::TestResultsApi
             .new.add_test_results_by_system_id(body_array, options[:systemId])
    puts to_output_hash(result).green
  rescue EmassClient::ApiError => e
    puts 'Exception when calling TestResultsApi->add_test_results_by_system_id'.red
    puts to_output_hash(e)
  end
end

#forSystemObject



257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/emasser/get.rb', line 257

def forSystem
  optional_options_keys = optional_options(@_initializer).keys
  optional_options = to_input_hash(optional_options_keys, options)

  begin
    result = EmassClient::TestResultsApi.new.get_system_test_results(options[:systemId], optional_options)
    puts to_output_hash(result).green
  rescue EmassClient::ApiError => e
    puts 'Exception when calling TestResultsApi->get_system_test_results'.red
    puts to_output_hash(e)
  end
end