Class: Gitlab::SecretDetection::Core::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/secret_detection/core/response.rb

Overview

Response is the data object returned by the scan operation with the following structure

status

One of values from Gitlab::SecretDetection::Core::Status indicating the scan operation’s status

results

Array of Gitlab::SecretDetection::Core::Finding values. Default value is nil.

metadata

Hash object containing additional meta information about the response. It is currently used

to embed more information on error.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, results = [], metadata = {}) ⇒ Response

Returns a new instance of Response.



15
16
17
18
19
# File 'lib/gitlab/secret_detection/core/response.rb', line 15

def initialize(status, results = [],  = {})
  @status = status
  @results = results
  @metadata = 
end

Instance Attribute Details

#metadataObject (readonly)

Returns the value of attribute metadata.



13
14
15
# File 'lib/gitlab/secret_detection/core/response.rb', line 13

def 
  @metadata
end

#resultsObject (readonly)

Returns the value of attribute results.



13
14
15
# File 'lib/gitlab/secret_detection/core/response.rb', line 13

def results
  @results
end

#statusObject (readonly)

Returns the value of attribute status.



13
14
15
# File 'lib/gitlab/secret_detection/core/response.rb', line 13

def status
  @status
end

Instance Method Details

#==(other) ⇒ Object



21
22
23
# File 'lib/gitlab/secret_detection/core/response.rb', line 21

def ==(other)
  self.class == other.class && other.state == state
end

#to_hObject



25
26
27
28
29
30
31
# File 'lib/gitlab/secret_detection/core/response.rb', line 25

def to_h
  {
    status:,
    metadata:,
    results: results&.map(&:to_h)
  }
end