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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Response.



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

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

Instance Attribute Details

#resultsObject (readonly)

Returns the value of attribute results.



11
12
13
# File 'lib/gitlab/secret_detection/core/response.rb', line 11

def results
  @results
end

#statusObject (readonly)

Returns the value of attribute status.



11
12
13
# File 'lib/gitlab/secret_detection/core/response.rb', line 11

def status
  @status
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
# File 'lib/gitlab/secret_detection/core/response.rb', line 18

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

#to_hObject



22
23
24
25
26
27
# File 'lib/gitlab/secret_detection/core/response.rb', line 22

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