class DependencyTracker::Vulnerability
Attributes
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/dependency-tracker-client/models/vulnerability.rb, line 94 def self.attribute_map { :'vuln_id' => :'vulnId', :'source' => :'source', :'title' => :'title', :'sub_title' => :'subTitle', :'description' => :'description', :'recommendation' => :'recommendation', :'references' => :'references', :'credits' => :'credits', :'created' => :'created', :'published' => :'published', :'updated' => :'updated', :'cwe' => :'cwe', :'cvss_v2_base_score' => :'cvssV2BaseScore', :'cvss_v2_impact_sub_score' => :'cvssV2ImpactSubScore', :'cvss_v2_exploitability_sub_score' => :'cvssV2ExploitabilitySubScore', :'cvss_v2_vector' => :'cvssV2Vector', :'cvss_v3_base_score' => :'cvssV3BaseScore', :'cvss_v3_impact_sub_score' => :'cvssV3ImpactSubScore', :'cvss_v3_exploitability_sub_score' => :'cvssV3ExploitabilitySubScore', :'cvss_v3_vector' => :'cvssV3Vector', :'severity' => :'severity', :'vulnerable_versions' => :'vulnerableVersions', :'patched_versions' => :'patchedVersions', :'vulnerable_software' => :'vulnerableSoftware', :'components' => :'components', :'uuid' => :'uuid', :'affected_project_count' => :'affectedProjectCount' } end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/dependency-tracker-client/models/vulnerability.rb, line 618 def self.build_from_hash(attributes) new.build_from_hash(attributes) end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/dependency-tracker-client/models/vulnerability.rb, line 167 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `DependencyTracker::Vulnerability` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `DependencyTracker::Vulnerability`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'vuln_id') self.vuln_id = attributes[:'vuln_id'] end if attributes.key?(:'source') self.source = attributes[:'source'] end if attributes.key?(:'title') self.title = attributes[:'title'] end if attributes.key?(:'sub_title') self.sub_title = attributes[:'sub_title'] end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'recommendation') self.recommendation = attributes[:'recommendation'] end if attributes.key?(:'references') self.references = attributes[:'references'] end if attributes.key?(:'credits') self.credits = attributes[:'credits'] end if attributes.key?(:'created') self.created = attributes[:'created'] end if attributes.key?(:'published') self.published = attributes[:'published'] end if attributes.key?(:'updated') self.updated = attributes[:'updated'] end if attributes.key?(:'cwe') self.cwe = attributes[:'cwe'] end if attributes.key?(:'cvss_v2_base_score') self.cvss_v2_base_score = attributes[:'cvss_v2_base_score'] end if attributes.key?(:'cvss_v2_impact_sub_score') self.cvss_v2_impact_sub_score = attributes[:'cvss_v2_impact_sub_score'] end if attributes.key?(:'cvss_v2_exploitability_sub_score') self.cvss_v2_exploitability_sub_score = attributes[:'cvss_v2_exploitability_sub_score'] end if attributes.key?(:'cvss_v2_vector') self.cvss_v2_vector = attributes[:'cvss_v2_vector'] end if attributes.key?(:'cvss_v3_base_score') self.cvss_v3_base_score = attributes[:'cvss_v3_base_score'] end if attributes.key?(:'cvss_v3_impact_sub_score') self.cvss_v3_impact_sub_score = attributes[:'cvss_v3_impact_sub_score'] end if attributes.key?(:'cvss_v3_exploitability_sub_score') self.cvss_v3_exploitability_sub_score = attributes[:'cvss_v3_exploitability_sub_score'] end if attributes.key?(:'cvss_v3_vector') self.cvss_v3_vector = attributes[:'cvss_v3_vector'] end if attributes.key?(:'severity') self.severity = attributes[:'severity'] end if attributes.key?(:'vulnerable_versions') self.vulnerable_versions = attributes[:'vulnerable_versions'] end if attributes.key?(:'patched_versions') self.patched_versions = attributes[:'patched_versions'] end if attributes.key?(:'vulnerable_software') if (value = attributes[:'vulnerable_software']).is_a?(Array) self.vulnerable_software = value end end if attributes.key?(:'components') if (value = attributes[:'components']).is_a?(Array) self.components = value end end if attributes.key?(:'uuid') self.uuid = attributes[:'uuid'] end if attributes.key?(:'affected_project_count') self.affected_project_count = attributes[:'affected_project_count'] end end
List of attributes with nullable: true
# File lib/dependency-tracker-client/models/vulnerability.rb, line 160 def self.openapi_nullable Set.new([ ]) end
Attribute type mapping.
# File lib/dependency-tracker-client/models/vulnerability.rb, line 127 def self.openapi_types { :'vuln_id' => :'String', :'source' => :'String', :'title' => :'String', :'sub_title' => :'String', :'description' => :'String', :'recommendation' => :'String', :'references' => :'String', :'credits' => :'String', :'created' => :'Integer', :'published' => :'Integer', :'updated' => :'Integer', :'cwe' => :'Cwe', :'cvss_v2_base_score' => :'Float', :'cvss_v2_impact_sub_score' => :'Float', :'cvss_v2_exploitability_sub_score' => :'Float', :'cvss_v2_vector' => :'String', :'cvss_v3_base_score' => :'Float', :'cvss_v3_impact_sub_score' => :'Float', :'cvss_v3_exploitability_sub_score' => :'Float', :'cvss_v3_vector' => :'String', :'severity' => :'String', :'vulnerable_versions' => :'String', :'patched_versions' => :'String', :'vulnerable_software' => :'Array<VulnerableSoftware>', :'components' => :'Array<Component>', :'uuid' => :'String', :'affected_project_count' => :'Integer' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/dependency-tracker-client/models/vulnerability.rb, line 571 def ==(o) return true if self.equal?(o) self.class == o.class && vuln_id == o.vuln_id && source == o.source && title == o.title && sub_title == o.sub_title && description == o.description && recommendation == o.recommendation && references == o.references && credits == o.credits && created == o.created && published == o.published && updated == o.updated && cwe == o.cwe && cvss_v2_base_score == o.cvss_v2_base_score && cvss_v2_impact_sub_score == o.cvss_v2_impact_sub_score && cvss_v2_exploitability_sub_score == o.cvss_v2_exploitability_sub_score && cvss_v2_vector == o.cvss_v2_vector && cvss_v3_base_score == o.cvss_v3_base_score && cvss_v3_impact_sub_score == o.cvss_v3_impact_sub_score && cvss_v3_exploitability_sub_score == o.cvss_v3_exploitability_sub_score && cvss_v3_vector == o.cvss_v3_vector && severity == o.severity && vulnerable_versions == o.vulnerable_versions && patched_versions == o.patched_versions && vulnerable_software == o.vulnerable_software && components == o.components && uuid == o.uuid && affected_project_count == o.affected_project_count end
Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data
# File lib/dependency-tracker-client/models/vulnerability.rb, line 646 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model DependencyTracker.const_get(type).build_from_hash(value) end end
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash
# File lib/dependency-tracker-client/models/vulnerability.rb, line 715 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/dependency-tracker-client/models/vulnerability.rb, line 625 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end
Custom attribute writer method with validation @param [Object] credits Value to be assigned
# File lib/dependency-tracker-client/models/vulnerability.rb, line 506 def credits=(credits) pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !credits.nil? && credits !~ pattern fail ArgumentError, "invalid value for \"credits\", must conform to the pattern #{pattern}." end @credits = credits end
Custom attribute writer method with validation @param [Object] cvss_v2_vector
Value to be assigned
# File lib/dependency-tracker-client/models/vulnerability.rb, line 517 def cvss_v2_vector=(cvss_v2_vector) pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !cvss_v2_vector.nil? && cvss_v2_vector !~ pattern fail ArgumentError, "invalid value for \"cvss_v2_vector\", must conform to the pattern #{pattern}." end @cvss_v2_vector = cvss_v2_vector end
Custom attribute writer method with validation @param [Object] cvss_v3_vector
Value to be assigned
# File lib/dependency-tracker-client/models/vulnerability.rb, line 528 def cvss_v3_vector=(cvss_v3_vector) pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !cvss_v3_vector.nil? && cvss_v3_vector !~ pattern fail ArgumentError, "invalid value for \"cvss_v3_vector\", must conform to the pattern #{pattern}." end @cvss_v3_vector = cvss_v3_vector end
Custom attribute writer method with validation @param [Object] description Value to be assigned
# File lib/dependency-tracker-client/models/vulnerability.rb, line 473 def description=(description) pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !description.nil? && description !~ pattern fail ArgumentError, "invalid value for \"description\", must conform to the pattern #{pattern}." end @description = description end
@see the `==` method @param [Object] Object to be compared
# File lib/dependency-tracker-client/models/vulnerability.rb, line 605 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Integer] Hash code
# File lib/dependency-tracker-client/models/vulnerability.rb, line 611 def hash [vuln_id, source, title, sub_title, description, recommendation, references, credits, created, published, updated, cwe, cvss_v2_base_score, cvss_v2_impact_sub_score, cvss_v2_exploitability_sub_score, cvss_v2_vector, cvss_v3_base_score, cvss_v3_impact_sub_score, cvss_v3_exploitability_sub_score, cvss_v3_vector, severity, vulnerable_versions, patched_versions, vulnerable_software, components, uuid, affected_project_count].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons
# File lib/dependency-tracker-client/models/vulnerability.rb, line 295 def list_invalid_properties invalid_properties = Array.new if !@vuln_id.nil? && @vuln_id.to_s.length > 255 invalid_properties.push('invalid value for "vuln_id", the character length must be smaller than or equal to 255.') end if !@vuln_id.nil? && @vuln_id.to_s.length < 1 invalid_properties.push('invalid value for "vuln_id", the character length must be great than or equal to 1.') end pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/) if !@vuln_id.nil? && @vuln_id !~ pattern invalid_properties.push("invalid value for \"vuln_id\", must conform to the pattern #{pattern}.") end if !@source.nil? && @source.to_s.length > 255 invalid_properties.push('invalid value for "source", the character length must be smaller than or equal to 255.') end if !@source.nil? && @source.to_s.length < 1 invalid_properties.push('invalid value for "source", the character length must be great than or equal to 1.') end pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !@source.nil? && @source !~ pattern invalid_properties.push("invalid value for \"source\", must conform to the pattern #{pattern}.") end pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !@title.nil? && @title !~ pattern invalid_properties.push("invalid value for \"title\", must conform to the pattern #{pattern}.") end pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !@sub_title.nil? && @sub_title !~ pattern invalid_properties.push("invalid value for \"sub_title\", must conform to the pattern #{pattern}.") end pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !@description.nil? && @description !~ pattern invalid_properties.push("invalid value for \"description\", must conform to the pattern #{pattern}.") end pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !@recommendation.nil? && @recommendation !~ pattern invalid_properties.push("invalid value for \"recommendation\", must conform to the pattern #{pattern}.") end pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !@references.nil? && @references !~ pattern invalid_properties.push("invalid value for \"references\", must conform to the pattern #{pattern}.") end pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !@credits.nil? && @credits !~ pattern invalid_properties.push("invalid value for \"credits\", must conform to the pattern #{pattern}.") end pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !@cvss_v2_vector.nil? && @cvss_v2_vector !~ pattern invalid_properties.push("invalid value for \"cvss_v2_vector\", must conform to the pattern #{pattern}.") end pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !@cvss_v3_vector.nil? && @cvss_v3_vector !~ pattern invalid_properties.push("invalid value for \"cvss_v3_vector\", must conform to the pattern #{pattern}.") end pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/) if !@severity.nil? && @severity !~ pattern invalid_properties.push("invalid value for \"severity\", must conform to the pattern #{pattern}.") end pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !@vulnerable_versions.nil? && @vulnerable_versions !~ pattern invalid_properties.push("invalid value for \"vulnerable_versions\", must conform to the pattern #{pattern}.") end pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !@patched_versions.nil? && @patched_versions !~ pattern invalid_properties.push("invalid value for \"patched_versions\", must conform to the pattern #{pattern}.") end if @uuid.nil? invalid_properties.push('invalid value for "uuid", uuid cannot be nil.') end invalid_properties end
Custom attribute writer method with validation @param [Object] patched_versions
Value to be assigned
# File lib/dependency-tracker-client/models/vulnerability.rb, line 560 def patched_versions=(patched_versions) pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !patched_versions.nil? && patched_versions !~ pattern fail ArgumentError, "invalid value for \"patched_versions\", must conform to the pattern #{pattern}." end @patched_versions = patched_versions end
Custom attribute writer method with validation @param [Object] recommendation Value to be assigned
# File lib/dependency-tracker-client/models/vulnerability.rb, line 484 def recommendation=(recommendation) pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !recommendation.nil? && recommendation !~ pattern fail ArgumentError, "invalid value for \"recommendation\", must conform to the pattern #{pattern}." end @recommendation = recommendation end
Custom attribute writer method with validation @param [Object] references Value to be assigned
# File lib/dependency-tracker-client/models/vulnerability.rb, line 495 def references=(references) pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !references.nil? && references !~ pattern fail ArgumentError, "invalid value for \"references\", must conform to the pattern #{pattern}." end @references = references end
Custom attribute writer method checking allowed values (enum). @param [Object] severity Object to be assigned
# File lib/dependency-tracker-client/models/vulnerability.rb, line 539 def severity=(severity) validator = EnumAttributeValidator.new('String', ["CRITICAL", "HIGH", "MEDIUM", "LOW", "INFO", "UNASSIGNED"]) unless validator.valid?(severity) fail ArgumentError, "invalid value for \"severity\", must be one of #{validator.allowable_values}." end @severity = severity end
Custom attribute writer method with validation @param [Object] source Value to be assigned
# File lib/dependency-tracker-client/models/vulnerability.rb, line 432 def source=(source) if !source.nil? && source.to_s.length > 255 fail ArgumentError, 'invalid value for "source", the character length must be smaller than or equal to 255.' end if !source.nil? && source.to_s.length < 1 fail ArgumentError, 'invalid value for "source", the character length must be great than or equal to 1.' end pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !source.nil? && source !~ pattern fail ArgumentError, "invalid value for \"source\", must conform to the pattern #{pattern}." end @source = source end
Custom attribute writer method with validation @param [Object] sub_title
Value to be assigned
# File lib/dependency-tracker-client/models/vulnerability.rb, line 462 def sub_title=(sub_title) pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !sub_title.nil? && sub_title !~ pattern fail ArgumentError, "invalid value for \"sub_title\", must conform to the pattern #{pattern}." end @sub_title = sub_title end
Custom attribute writer method with validation @param [Object] title Value to be assigned
# File lib/dependency-tracker-client/models/vulnerability.rb, line 451 def title=(title) pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !title.nil? && title !~ pattern fail ArgumentError, "invalid value for \"title\", must conform to the pattern #{pattern}." end @title = title end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/dependency-tracker-client/models/vulnerability.rb, line 697 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end
Returns the string representation of the object @return [String] String presentation of the object
# File lib/dependency-tracker-client/models/vulnerability.rb, line 685 def to_s to_hash.to_s end
Check to see if the all the properties in the model are valid @return true if the model is valid
# File lib/dependency-tracker-client/models/vulnerability.rb, line 387 def valid? return false if !@vuln_id.nil? && @vuln_id.to_s.length > 255 return false if !@vuln_id.nil? && @vuln_id.to_s.length < 1 return false if !@vuln_id.nil? && @vuln_id !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/) return false if !@source.nil? && @source.to_s.length > 255 return false if !@source.nil? && @source.to_s.length < 1 return false if !@source.nil? && @source !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) return false if !@title.nil? && @title !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) return false if !@sub_title.nil? && @sub_title !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) return false if !@description.nil? && @description !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) return false if !@recommendation.nil? && @recommendation !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) return false if !@references.nil? && @references !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) return false if !@credits.nil? && @credits !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) return false if !@cvss_v2_vector.nil? && @cvss_v2_vector !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) return false if !@cvss_v3_vector.nil? && @cvss_v3_vector !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) severity_validator = EnumAttributeValidator.new('String', ["CRITICAL", "HIGH", "MEDIUM", "LOW", "INFO", "UNASSIGNED"]) return false unless severity_validator.valid?(@severity) return false if !@severity.nil? && @severity !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/) return false if !@vulnerable_versions.nil? && @vulnerable_versions !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) return false if !@patched_versions.nil? && @patched_versions !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) return false if @uuid.nil? true end
Custom attribute writer method with validation @param [Object] vuln_id
Value to be assigned
# File lib/dependency-tracker-client/models/vulnerability.rb, line 413 def vuln_id=(vuln_id) if !vuln_id.nil? && vuln_id.to_s.length > 255 fail ArgumentError, 'invalid value for "vuln_id", the character length must be smaller than or equal to 255.' end if !vuln_id.nil? && vuln_id.to_s.length < 1 fail ArgumentError, 'invalid value for "vuln_id", the character length must be great than or equal to 1.' end pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/) if !vuln_id.nil? && vuln_id !~ pattern fail ArgumentError, "invalid value for \"vuln_id\", must conform to the pattern #{pattern}." end @vuln_id = vuln_id end
Custom attribute writer method with validation @param [Object] vulnerable_versions
Value to be assigned
# File lib/dependency-tracker-client/models/vulnerability.rb, line 549 def vulnerable_versions=(vulnerable_versions) pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}\n\r\t]*$/) if !vulnerable_versions.nil? && vulnerable_versions !~ pattern fail ArgumentError, "invalid value for \"vulnerable_versions\", must conform to the pattern #{pattern}." end @vulnerable_versions = vulnerable_versions end