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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SubCommandBase

banner

Methods included from OutputConverters

#change_to_datetime, #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)


252
253
254
# File 'lib/emasser/get.rb', line 252

def self.exit_on_failure?
  true
end

Instance Method Details

#addObject



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/emasser/post.rb', line 89

def add
  body = EmassClient::TestResultsGet.new
  body.assessment_procedure = options[:assessmentProcedure]
  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(options[:systemId], body_array)
    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



267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/emasser/get.rb', line 267

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