Class: SemgrepWebApp::ProtosScaV1PackageFilter
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SemgrepWebApp::ProtosScaV1PackageFilter
- Defined in:
- lib/semgrep_web_app/models/protos_sca_v1_package_filter.rb
Overview
Individual package filter with optional version bounds.
Instance Attribute Summary collapse
-
#exact_name_match ⇒ TrueClass | FalseClass
When true, name must match exactly.
-
#exact_version ⇒ String
Exact version match (e.g. "1.0.0").
-
#name ⇒ String
Exact package name (e.g. lodash).
-
#version_lower_bound ⇒ String
Lower bound version constraint (e.g. ">=1.0.0").
-
#version_upper_bound ⇒ String
Upper bound version constraint (e.g. "<2.0.0").
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(exact_name_match: SKIP, exact_version: SKIP, name: SKIP, version_lower_bound: SKIP, version_upper_bound: SKIP, additional_properties: nil) ⇒ ProtosScaV1PackageFilter
constructor
A new instance of ProtosScaV1PackageFilter.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(exact_name_match: SKIP, exact_version: SKIP, name: SKIP, version_lower_bound: SKIP, version_upper_bound: SKIP, additional_properties: nil) ⇒ ProtosScaV1PackageFilter
Returns a new instance of ProtosScaV1PackageFilter.
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_package_filter.rb', line 63 def initialize(exact_name_match: SKIP, exact_version: SKIP, name: SKIP, version_lower_bound: SKIP, version_upper_bound: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @exact_name_match = exact_name_match unless exact_name_match == SKIP @exact_version = exact_version unless exact_version == SKIP @name = name unless name == SKIP @version_lower_bound = version_lower_bound unless version_lower_bound == SKIP @version_upper_bound = version_upper_bound unless version_upper_bound == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#exact_name_match ⇒ TrueClass | FalseClass
When true, name must match exactly. When false (default), name is fuzzy-matched (contains).
15 16 17 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_package_filter.rb', line 15 def exact_name_match @exact_name_match end |
#exact_version ⇒ String
Exact version match (e.g. "1.0.0"). Takes precedence over version bounds if set.
20 21 22 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_package_filter.rb', line 20 def exact_version @exact_version end |
#name ⇒ String
Exact package name (e.g. lodash).
24 25 26 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_package_filter.rb', line 24 def name @name end |
#version_lower_bound ⇒ String
Lower bound version constraint (e.g. ">=1.0.0"). Ignored if exact_version is set.
29 30 31 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_package_filter.rb', line 29 def version_lower_bound @version_lower_bound end |
#version_upper_bound ⇒ String
Upper bound version constraint (e.g. "<2.0.0"). Ignored if exact_version is set.
34 35 36 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_package_filter.rb', line 34 def version_upper_bound @version_upper_bound end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_package_filter.rb', line 78 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. exact_name_match = hash.key?('exactNameMatch') ? hash['exactNameMatch'] : SKIP exact_version = hash.key?('exactVersion') ? hash['exactVersion'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP version_lower_bound = hash.key?('versionLowerBound') ? hash['versionLowerBound'] : SKIP version_upper_bound = hash.key?('versionUpperBound') ? hash['versionUpperBound'] : 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. ProtosScaV1PackageFilter.new(exact_name_match: exact_name_match, exact_version: exact_version, name: name, version_lower_bound: version_lower_bound, version_upper_bound: version_upper_bound, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_package_filter.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['exact_name_match'] = 'exactNameMatch' @_hash['exact_version'] = 'exactVersion' @_hash['name'] = 'name' @_hash['version_lower_bound'] = 'versionLowerBound' @_hash['version_upper_bound'] = 'versionUpperBound' @_hash end |
.nullables ⇒ Object
An array for nullable fields
59 60 61 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_package_filter.rb', line 59 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
48 49 50 51 52 53 54 55 56 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_package_filter.rb', line 48 def self.optionals %w[ exact_name_match exact_version name version_lower_bound version_upper_bound ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
116 117 118 119 120 121 122 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_package_filter.rb', line 116 def inspect class_name = self.class.name.split('::').last "<#{class_name} exact_name_match: #{@exact_name_match.inspect}, exact_version:"\ " #{@exact_version.inspect}, name: #{@name.inspect}, version_lower_bound:"\ " #{@version_lower_bound.inspect}, version_upper_bound: #{@version_upper_bound.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
108 109 110 111 112 113 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_package_filter.rb', line 108 def to_s class_name = self.class.name.split('::').last "<#{class_name} exact_name_match: #{@exact_name_match}, exact_version: #{@exact_version},"\ " name: #{@name}, version_lower_bound: #{@version_lower_bound}, version_upper_bound:"\ " #{@version_upper_bound}, additional_properties: #{@additional_properties}>" end |