Class: SemgrepWebApp::Status3

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

Overview

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. |

Constant Summary collapse

STATUS3 =
[
  # TODO: Write general description for SBOM_EXPORT_STATUS_IN_PROGRESS
  SBOM_EXPORT_STATUS_IN_PROGRESS = 'SBOM_EXPORT_STATUS_IN_PROGRESS'.freeze,

  # TODO: Write general description for SBOM_EXPORT_STATUS_COMPLETED
  SBOM_EXPORT_STATUS_COMPLETED = 'SBOM_EXPORT_STATUS_COMPLETED'.freeze,

  # TODO: Write general description for SBOM_EXPORT_STATUS_FAILED
  SBOM_EXPORT_STATUS_FAILED = 'SBOM_EXPORT_STATUS_FAILED'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = SBOM_EXPORT_STATUS_IN_PROGRESS) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/semgrep_web_app/models/status3.rb', line 30

def self.from_value(value, default_value = SBOM_EXPORT_STATUS_IN_PROGRESS)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'sbom_export_status_in_progress' then SBOM_EXPORT_STATUS_IN_PROGRESS
  when 'sbom_export_status_completed' then SBOM_EXPORT_STATUS_COMPLETED
  when 'sbom_export_status_failed' then SBOM_EXPORT_STATUS_FAILED
  else
    default_value
  end
end

.validate(value) ⇒ Object



24
25
26
27
28
# File 'lib/semgrep_web_app/models/status3.rb', line 24

def self.validate(value)
  return false if value.nil?

  STATUS3.include?(value)
end