Class: SemgrepWebApp::GetSbomExportResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/semgrep_web_app/models/get_sbom_export_response.rb

Overview

GetSbomExportResponse Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(status:, download_url: SKIP, error_message: SKIP, additional_properties: nil) ⇒ GetSbomExportResponse

Returns a new instance of GetSbomExportResponse.



51
52
53
54
55
56
57
58
59
60
# File 'lib/semgrep_web_app/models/get_sbom_export_response.rb', line 51

def initialize(status:, download_url: SKIP, error_message: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @download_url = download_url unless download_url == SKIP
  @error_message = error_message unless error_message == SKIP
  @status = status
  @additional_properties = additional_properties
end

Instance Attribute Details

#download_urlString

URL to download the SBOM when status is COMPLETED.

Returns:

  • (String)


14
15
16
# File 'lib/semgrep_web_app/models/get_sbom_export_response.rb', line 14

def download_url
  @download_url
end

#error_messageString

Error message when status is FAILED.

Returns:

  • (String)


18
19
20
# File 'lib/semgrep_web_app/models/get_sbom_export_response.rb', line 18

def error_message
  @error_message
end

#statusStatus3

Status of the SBOM export job.

value description
SBOM_EXPORT_STATUS_IN_PROGRESS The SBOM export job is in progress.
SBOM_EXPORT_STATUS_COMPLETED The SBOM export job has completed.
SBOM_EXPORT_STATUS_FAILED The SBOM export job has failed.

Returns:



27
28
29
# File 'lib/semgrep_web_app/models/get_sbom_export_response.rb', line 27

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  status = hash.key?('status') ? hash['status'] : nil
  download_url = hash.key?('downloadUrl') ? hash['downloadUrl'] : SKIP
  error_message = hash.key?('errorMessage') ? hash['errorMessage'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  GetSbomExportResponse.new(status: status,
                            download_url: download_url,
                            error_message: error_message,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
# File 'lib/semgrep_web_app/models/get_sbom_export_response.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['download_url'] = 'downloadUrl'
  @_hash['error_message'] = 'errorMessage'
  @_hash['status'] = 'status'
  @_hash
end

.nullablesObject

An array for nullable fields



47
48
49
# File 'lib/semgrep_web_app/models/get_sbom_export_response.rb', line 47

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
# File 'lib/semgrep_web_app/models/get_sbom_export_response.rb', line 39

def self.optionals
  %w[
    download_url
    error_message
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



93
94
95
96
97
98
# File 'lib/semgrep_web_app/models/get_sbom_export_response.rb', line 93

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} download_url: #{@download_url.inspect}, error_message:"\
  " #{@error_message.inspect}, status: #{@status.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



86
87
88
89
90
# File 'lib/semgrep_web_app/models/get_sbom_export_response.rb', line 86

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} download_url: #{@download_url}, error_message: #{@error_message}, status:"\
  " #{@status}, additional_properties: #{@additional_properties}>"
end