class DependencyTracker::Component

Attributes

children[RW]
classifier[RW]
cpe[RW]
description[RW]
extension[RW]
filename[RW]
group[RW]
is_internal[RW]
last_inherited_risk_score[RW]
license[RW]
md5[RW]
metrics[RW]
name[RW]
parent[RW]
purl[RW]
repository_meta[RW]
resolved_license[RW]
sha1[RW]
sha256[RW]
sha3_256[RW]
sha3_512[RW]
sha512[RW]
used_by[RW]
uuid[RW]
version[RW]
vulnerabilities[RW]

Public Class Methods

attribute_map() click to toggle source

Attribute mapping from ruby-style variable name to JSON key.

# File lib/dependency-tracker-client/models/component.rb, line 94
def self.attribute_map
  {
    :'group' => :'group',
    :'name' => :'name',
    :'version' => :'version',
    :'classifier' => :'classifier',
    :'filename' => :'filename',
    :'extension' => :'extension',
    :'md5' => :'md5',
    :'sha1' => :'sha1',
    :'sha256' => :'sha256',
    :'sha512' => :'sha512',
    :'sha3_256' => :'sha3_256',
    :'sha3_512' => :'sha3_512',
    :'cpe' => :'cpe',
    :'purl' => :'purl',
    :'description' => :'description',
    :'copyright' => :'copyright',
    :'license' => :'license',
    :'resolved_license' => :'resolvedLicense',
    :'parent' => :'parent',
    :'children' => :'children',
    :'vulnerabilities' => :'vulnerabilities',
    :'last_inherited_risk_score' => :'lastInheritedRiskScore',
    :'uuid' => :'uuid',
    :'metrics' => :'metrics',
    :'repository_meta' => :'repositoryMeta',
    :'used_by' => :'usedBy',
    :'is_internal' => :'isInternal'
  }
end
build_from_hash(attributes) click to toggle source

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/component.rb, line 789
def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/dependency-tracker-client/models/component.rb, line 167
def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `DependencyTracker::Component` 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::Component`. 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?(:'group')
    self.group = attributes[:'group']
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.key?(:'version')
    self.version = attributes[:'version']
  end

  if attributes.key?(:'classifier')
    self.classifier = attributes[:'classifier']
  end

  if attributes.key?(:'filename')
    self.filename = attributes[:'filename']
  end

  if attributes.key?(:'extension')
    self.extension = attributes[:'extension']
  end

  if attributes.key?(:'md5')
    self.md5 = attributes[:'md5']
  end

  if attributes.key?(:'sha1')
    self.sha1 = attributes[:'sha1']
  end

  if attributes.key?(:'sha256')
    self.sha256 = attributes[:'sha256']
  end

  if attributes.key?(:'sha512')
    self.sha512 = attributes[:'sha512']
  end

  if attributes.key?(:'sha3_256')
    self.sha3_256 = attributes[:'sha3_256']
  end

  if attributes.key?(:'sha3_512')
    self.sha3_512 = attributes[:'sha3_512']
  end

  if attributes.key?(:'cpe')
    self.cpe = attributes[:'cpe']
  end

  if attributes.key?(:'purl')
    self.purl = attributes[:'purl']
  end

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.key?(:'copyright')
    self.copyright = attributes[:'copyright']
  end

  if attributes.key?(:'license')
    self.license = attributes[:'license']
  end

  if attributes.key?(:'resolved_license')
    self.resolved_license = attributes[:'resolved_license']
  end

  if attributes.key?(:'parent')
    self.parent = attributes[:'parent']
  end

  if attributes.key?(:'children')
    if (value = attributes[:'children']).is_a?(Array)
      self.children = value
    end
  end

  if attributes.key?(:'vulnerabilities')
    if (value = attributes[:'vulnerabilities']).is_a?(Array)
      self.vulnerabilities = value
    end
  end

  if attributes.key?(:'last_inherited_risk_score')
    self.last_inherited_risk_score = attributes[:'last_inherited_risk_score']
  end

  if attributes.key?(:'uuid')
    self.uuid = attributes[:'uuid']
  end

  if attributes.key?(:'metrics')
    self.metrics = attributes[:'metrics']
  end

  if attributes.key?(:'repository_meta')
    self.repository_meta = attributes[:'repository_meta']
  end

  if attributes.key?(:'used_by')
    self.used_by = attributes[:'used_by']
  end

  if attributes.key?(:'is_internal')
    self.is_internal = attributes[:'is_internal']
  end
end
openapi_nullable() click to toggle source

List of attributes with nullable: true

# File lib/dependency-tracker-client/models/component.rb, line 160
def self.openapi_nullable
  Set.new([
  ])
end
openapi_types() click to toggle source

Attribute type mapping.

# File lib/dependency-tracker-client/models/component.rb, line 127
def self.openapi_types
  {
    :'group' => :'String',
    :'name' => :'String',
    :'version' => :'String',
    :'classifier' => :'String',
    :'filename' => :'String',
    :'extension' => :'String',
    :'md5' => :'String',
    :'sha1' => :'String',
    :'sha256' => :'String',
    :'sha512' => :'String',
    :'sha3_256' => :'String',
    :'sha3_512' => :'String',
    :'cpe' => :'String',
    :'purl' => :'PackageURL',
    :'description' => :'String',
    :'copyright' => :'String',
    :'license' => :'String',
    :'resolved_license' => :'License',
    :'parent' => :'Component',
    :'children' => :'Array<Component>',
    :'vulnerabilities' => :'Array<Vulnerability>',
    :'last_inherited_risk_score' => :'Float',
    :'uuid' => :'String',
    :'metrics' => :'ComponentMetrics',
    :'repository_meta' => :'RepositoryMetaComponent',
    :'used_by' => :'Integer',
    :'is_internal' => :'Boolean'
  }
end

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/dependency-tracker-client/models/component.rb, line 742
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      group == o.group &&
      name == o.name &&
      version == o.version &&
      classifier == o.classifier &&
      filename == o.filename &&
      extension == o.extension &&
      md5 == o.md5 &&
      sha1 == o.sha1 &&
      sha256 == o.sha256 &&
      sha512 == o.sha512 &&
      sha3_256 == o.sha3_256 &&
      sha3_512 == o.sha3_512 &&
      cpe == o.cpe &&
      purl == o.purl &&
      description == o.description &&
      copyright == o.copyright &&
      license == o.license &&
      resolved_license == o.resolved_license &&
      parent == o.parent &&
      children == o.children &&
      vulnerabilities == o.vulnerabilities &&
      last_inherited_risk_score == o.last_inherited_risk_score &&
      uuid == o.uuid &&
      metrics == o.metrics &&
      repository_meta == o.repository_meta &&
      used_by == o.used_by &&
      is_internal == o.is_internal
end
_deserialize(type, value) click to toggle source

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/component.rb, line 817
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
_to_hash(value) click to toggle source

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/component.rb, line 886
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
build_from_hash(attributes) click to toggle source

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/component.rb, line 796
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
classifier=(classifier) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] classifier Object to be assigned

# File lib/dependency-tracker-client/models/component.rb, line 552
def classifier=(classifier)
  validator = EnumAttributeValidator.new('String', ["APPLICATION", "FRAMEWORK", "LIBRARY", "OPERATING_SYSTEM", "DEVICE", "FILE"])
  unless validator.valid?(classifier)
    fail ArgumentError, "invalid value for \"classifier\", must be one of #{validator.allowable_values}."
  end
  @classifier = classifier
end
cpe=(cpe) click to toggle source

Custom attribute writer method with validation @param [Object] cpe Value to be assigned

# File lib/dependency-tracker-client/models/component.rb, line 666
def cpe=(cpe)
  if !cpe.nil? && cpe.to_s.length > 255
    fail ArgumentError, 'invalid value for "cpe", the character length must be smaller than or equal to 255.'
  end

  if !cpe.nil? && cpe.to_s.length < 0
    fail ArgumentError, 'invalid value for "cpe", the character length must be great than or equal to 0.'
  end

  pattern = Regexp.new(/(cpe:2\.3:[aho\*\-](:(((\?*|\*?)([a-zA-Z0-9\-\._]|(\\[\\\*\?!"#$$%&'\(\)\+,\/:;<=>@\[\]\^`\{\|}~]))+(\?*|\*?))|[\*\-])){5}(:(([a-zA-Z]{2,3}(-([a-zA-Z]{2}|[0-9]{3}))?)|[\*\-]))(:(((\?*|\*?)([a-zA-Z0-9\-\._]|(\\[\\\*\?!"#$$%&'\(\)\+,\/:;<=>@\[\]\^`\{\|}~]))+(\?*|\*?))|[\*\-])){4})|([c][pP][eE]:\/[AHOaho]?(:[A-Za-z0-9\._\-~%]*){0,6})/)
  if !cpe.nil? && cpe !~ pattern
    fail ArgumentError, "invalid value for \"cpe\", must conform to the pattern #{pattern}."
  end

  @cpe = cpe
end
description=(description) click to toggle source

Custom attribute writer method with validation @param [Object] description Value to be assigned

# File lib/dependency-tracker-client/models/component.rb, line 685
def description=(description)
  if !description.nil? && description.to_s.length > 1024
    fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 1024.'
  end

  if !description.nil? && description.to_s.length < 0
    fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 0.'
  end

  pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/)
  if !description.nil? && description !~ pattern
    fail ArgumentError, "invalid value for \"description\", must conform to the pattern #{pattern}."
  end

  @description = description
end
eql?(o) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/dependency-tracker-client/models/component.rb, line 776
def eql?(o)
  self == o
end
extension=(extension) click to toggle source

Custom attribute writer method with validation @param [Object] extension Value to be assigned

# File lib/dependency-tracker-client/models/component.rb, line 581
def extension=(extension)
  if !extension.nil? && extension.to_s.length > 255
    fail ArgumentError, 'invalid value for "extension", the character length must be smaller than or equal to 255.'
  end

  if !extension.nil? && extension.to_s.length < 0
    fail ArgumentError, 'invalid value for "extension", the character length must be great than or equal to 0.'
  end

  pattern = Regexp.new(/^[\p{Alnum}!@#$%^&{}\[\]()_+\-=,.~'` ]{1,255}$/)
  if !extension.nil? && extension !~ pattern
    fail ArgumentError, "invalid value for \"extension\", must conform to the pattern #{pattern}."
  end

  @extension = extension
end
filename=(filename) click to toggle source

Custom attribute writer method with validation @param [Object] filename Value to be assigned

# File lib/dependency-tracker-client/models/component.rb, line 562
def filename=(filename)
  if !filename.nil? && filename.to_s.length > 255
    fail ArgumentError, 'invalid value for "filename", the character length must be smaller than or equal to 255.'
  end

  if !filename.nil? && filename.to_s.length < 0
    fail ArgumentError, 'invalid value for "filename", the character length must be great than or equal to 0.'
  end

  pattern = Regexp.new(/^[\p{Alnum}:\/\\!@#$%^&{}\[\]()_+\-=,.~'` ]{1,255}$/)
  if !filename.nil? && filename !~ pattern
    fail ArgumentError, "invalid value for \"filename\", must conform to the pattern #{pattern}."
  end

  @filename = filename
end
group=(group) click to toggle source

Custom attribute writer method with validation @param [Object] group Value to be assigned

# File lib/dependency-tracker-client/models/component.rb, line 495
def group=(group)
  if !group.nil? && group.to_s.length > 255
    fail ArgumentError, 'invalid value for "group", the character length must be smaller than or equal to 255.'
  end

  if !group.nil? && group.to_s.length < 0
    fail ArgumentError, 'invalid value for "group", the character length must be great than or equal to 0.'
  end

  pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/)
  if !group.nil? && group !~ pattern
    fail ArgumentError, "invalid value for \"group\", must conform to the pattern #{pattern}."
  end

  @group = group
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Integer] Hash code

# File lib/dependency-tracker-client/models/component.rb, line 782
def hash
  [group, name, version, classifier, filename, extension, md5, sha1, sha256, sha512, sha3_256, sha3_512, cpe, purl, description, copyright, license, resolved_license, parent, children, vulnerabilities, last_inherited_risk_score, uuid, metrics, repository_meta, used_by, is_internal].hash
end
license=(license) click to toggle source

Custom attribute writer method with validation @param [Object] license Value to be assigned

# File lib/dependency-tracker-client/models/component.rb, line 723
def license=(license)
  if !license.nil? && license.to_s.length > 255
    fail ArgumentError, 'invalid value for "license", the character length must be smaller than or equal to 255.'
  end

  if !license.nil? && license.to_s.length < 0
    fail ArgumentError, 'invalid value for "license", the character length must be great than or equal to 0.'
  end

  pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/)
  if !license.nil? && license !~ pattern
    fail ArgumentError, "invalid value for \"license\", must conform to the pattern #{pattern}."
  end

  @license = license
end
list_invalid_properties() click to toggle source

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/component.rb, line 295
def list_invalid_properties
  invalid_properties = Array.new
  if !@group.nil? && @group.to_s.length > 255
    invalid_properties.push('invalid value for "group", the character length must be smaller than or equal to 255.')
  end

  if !@group.nil? && @group.to_s.length < 0
    invalid_properties.push('invalid value for "group", the character length must be great than or equal to 0.')
  end

  pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/)
  if !@group.nil? && @group !~ pattern
    invalid_properties.push("invalid value for \"group\", must conform to the pattern #{pattern}.")
  end

  if !@name.nil? && @name.to_s.length > 255
    invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 255.')
  end

  if !@name.nil? && @name.to_s.length < 1
    invalid_properties.push('invalid value for "name", 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 !@name.nil? && @name !~ pattern
    invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
  end

  if !@version.nil? && @version.to_s.length > 255
    invalid_properties.push('invalid value for "version", the character length must be smaller than or equal to 255.')
  end

  if !@version.nil? && @version.to_s.length < 0
    invalid_properties.push('invalid value for "version", the character length must be great than or equal to 0.')
  end

  pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/)
  if !@version.nil? && @version !~ pattern
    invalid_properties.push("invalid value for \"version\", must conform to the pattern #{pattern}.")
  end

  if !@filename.nil? && @filename.to_s.length > 255
    invalid_properties.push('invalid value for "filename", the character length must be smaller than or equal to 255.')
  end

  if !@filename.nil? && @filename.to_s.length < 0
    invalid_properties.push('invalid value for "filename", the character length must be great than or equal to 0.')
  end

  pattern = Regexp.new(/^[\p{Alnum}:\/\\!@#$%^&{}\[\]()_+\-=,.~'` ]{1,255}$/)
  if !@filename.nil? && @filename !~ pattern
    invalid_properties.push("invalid value for \"filename\", must conform to the pattern #{pattern}.")
  end

  if !@extension.nil? && @extension.to_s.length > 255
    invalid_properties.push('invalid value for "extension", the character length must be smaller than or equal to 255.')
  end

  if !@extension.nil? && @extension.to_s.length < 0
    invalid_properties.push('invalid value for "extension", the character length must be great than or equal to 0.')
  end

  pattern = Regexp.new(/^[\p{Alnum}!@#$%^&{}\[\]()_+\-=,.~'` ]{1,255}$/)
  if !@extension.nil? && @extension !~ pattern
    invalid_properties.push("invalid value for \"extension\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^[0-9a-f]{32}$/)
  if !@md5.nil? && @md5 !~ pattern
    invalid_properties.push("invalid value for \"md5\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^[0-9a-f]{40}$/)
  if !@sha1.nil? && @sha1 !~ pattern
    invalid_properties.push("invalid value for \"sha1\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^[0-9a-f]{64}$/)
  if !@sha256.nil? && @sha256 !~ pattern
    invalid_properties.push("invalid value for \"sha256\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^[0-9a-f]{128}$/)
  if !@sha512.nil? && @sha512 !~ pattern
    invalid_properties.push("invalid value for \"sha512\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^[0-9a-f]{64}$/)
  if !@sha3_256.nil? && @sha3_256 !~ pattern
    invalid_properties.push("invalid value for \"sha3_256\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^[0-9a-f]{128}$/)
  if !@sha3_512.nil? && @sha3_512 !~ pattern
    invalid_properties.push("invalid value for \"sha3_512\", must conform to the pattern #{pattern}.")
  end

  if !@cpe.nil? && @cpe.to_s.length > 255
    invalid_properties.push('invalid value for "cpe", the character length must be smaller than or equal to 255.')
  end

  if !@cpe.nil? && @cpe.to_s.length < 0
    invalid_properties.push('invalid value for "cpe", the character length must be great than or equal to 0.')
  end

  pattern = Regexp.new(/(cpe:2\.3:[aho\*\-](:(((\?*|\*?)([a-zA-Z0-9\-\._]|(\\[\\\*\?!"#$$%&'\(\)\+,\/:;<=>@\[\]\^`\{\|}~]))+(\?*|\*?))|[\*\-])){5}(:(([a-zA-Z]{2,3}(-([a-zA-Z]{2}|[0-9]{3}))?)|[\*\-]))(:(((\?*|\*?)([a-zA-Z0-9\-\._]|(\\[\\\*\?!"#$$%&'\(\)\+,\/:;<=>@\[\]\^`\{\|}~]))+(\?*|\*?))|[\*\-])){4})|([c][pP][eE]:\/[AHOaho]?(:[A-Za-z0-9\._\-~%]*){0,6})/)
  if !@cpe.nil? && @cpe !~ pattern
    invalid_properties.push("invalid value for \"cpe\", must conform to the pattern #{pattern}.")
  end

  if !@description.nil? && @description.to_s.length > 1024
    invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 1024.')
  end

  if !@description.nil? && @description.to_s.length < 0
    invalid_properties.push('invalid value for "description", the character length must be great than or equal to 0.')
  end

  pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/)
  if !@description.nil? && @description !~ pattern
    invalid_properties.push("invalid value for \"description\", must conform to the pattern #{pattern}.")
  end

  if !@copyright.nil? && @copyright.to_s.length > 1024
    invalid_properties.push('invalid value for "copyright", the character length must be smaller than or equal to 1024.')
  end

  if !@copyright.nil? && @copyright.to_s.length < 0
    invalid_properties.push('invalid value for "copyright", the character length must be great than or equal to 0.')
  end

  pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/)
  if !@copyright.nil? && @copyright !~ pattern
    invalid_properties.push("invalid value for \"copyright\", must conform to the pattern #{pattern}.")
  end

  if !@license.nil? && @license.to_s.length > 255
    invalid_properties.push('invalid value for "license", the character length must be smaller than or equal to 255.')
  end

  if !@license.nil? && @license.to_s.length < 0
    invalid_properties.push('invalid value for "license", the character length must be great than or equal to 0.')
  end

  pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/)
  if !@license.nil? && @license !~ pattern
    invalid_properties.push("invalid value for \"license\", 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
md5=(md5) click to toggle source

Custom attribute writer method with validation @param [Object] md5 Value to be assigned

# File lib/dependency-tracker-client/models/component.rb, line 600
def md5=(md5)
  pattern = Regexp.new(/^[0-9a-f]{32}$/)
  if !md5.nil? && md5 !~ pattern
    fail ArgumentError, "invalid value for \"md5\", must conform to the pattern #{pattern}."
  end

  @md5 = md5
end
name=(name) click to toggle source

Custom attribute writer method with validation @param [Object] name Value to be assigned

# File lib/dependency-tracker-client/models/component.rb, line 514
def name=(name)
  if !name.nil? && name.to_s.length > 255
    fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 255.'
  end

  if !name.nil? && name.to_s.length < 1
    fail ArgumentError, 'invalid value for "name", 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 !name.nil? && name !~ pattern
    fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
  end

  @name = name
end
sha1=(sha1) click to toggle source

Custom attribute writer method with validation @param [Object] sha1 Value to be assigned

# File lib/dependency-tracker-client/models/component.rb, line 611
def sha1=(sha1)
  pattern = Regexp.new(/^[0-9a-f]{40}$/)
  if !sha1.nil? && sha1 !~ pattern
    fail ArgumentError, "invalid value for \"sha1\", must conform to the pattern #{pattern}."
  end

  @sha1 = sha1
end
sha256=(sha256) click to toggle source

Custom attribute writer method with validation @param [Object] sha256 Value to be assigned

# File lib/dependency-tracker-client/models/component.rb, line 622
def sha256=(sha256)
  pattern = Regexp.new(/^[0-9a-f]{64}$/)
  if !sha256.nil? && sha256 !~ pattern
    fail ArgumentError, "invalid value for \"sha256\", must conform to the pattern #{pattern}."
  end

  @sha256 = sha256
end
sha3_256=(sha3_256) click to toggle source

Custom attribute writer method with validation @param [Object] sha3_256 Value to be assigned

# File lib/dependency-tracker-client/models/component.rb, line 644
def sha3_256=(sha3_256)
  pattern = Regexp.new(/^[0-9a-f]{64}$/)
  if !sha3_256.nil? && sha3_256 !~ pattern
    fail ArgumentError, "invalid value for \"sha3_256\", must conform to the pattern #{pattern}."
  end

  @sha3_256 = sha3_256
end
sha3_512=(sha3_512) click to toggle source

Custom attribute writer method with validation @param [Object] sha3_512 Value to be assigned

# File lib/dependency-tracker-client/models/component.rb, line 655
def sha3_512=(sha3_512)
  pattern = Regexp.new(/^[0-9a-f]{128}$/)
  if !sha3_512.nil? && sha3_512 !~ pattern
    fail ArgumentError, "invalid value for \"sha3_512\", must conform to the pattern #{pattern}."
  end

  @sha3_512 = sha3_512
end
sha512=(sha512) click to toggle source

Custom attribute writer method with validation @param [Object] sha512 Value to be assigned

# File lib/dependency-tracker-client/models/component.rb, line 633
def sha512=(sha512)
  pattern = Regexp.new(/^[0-9a-f]{128}$/)
  if !sha512.nil? && sha512 !~ pattern
    fail ArgumentError, "invalid value for \"sha512\", must conform to the pattern #{pattern}."
  end

  @sha512 = sha512
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/dependency-tracker-client/models/component.rb, line 862
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/dependency-tracker-client/models/component.rb, line 868
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
to_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/dependency-tracker-client/models/component.rb, line 856
def to_s
  to_hash.to_s
end
valid?() click to toggle source

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/component.rb, line 453
def valid?
  return false if !@group.nil? && @group.to_s.length > 255
  return false if !@group.nil? && @group.to_s.length < 0
  return false if !@group.nil? && @group !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/)
  return false if !@name.nil? && @name.to_s.length > 255
  return false if !@name.nil? && @name.to_s.length < 1
  return false if !@name.nil? && @name !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/)
  return false if !@version.nil? && @version.to_s.length > 255
  return false if !@version.nil? && @version.to_s.length < 0
  return false if !@version.nil? && @version !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/)
  classifier_validator = EnumAttributeValidator.new('String', ["APPLICATION", "FRAMEWORK", "LIBRARY", "OPERATING_SYSTEM", "DEVICE", "FILE"])
  return false unless classifier_validator.valid?(@classifier)
  return false if !@filename.nil? && @filename.to_s.length > 255
  return false if !@filename.nil? && @filename.to_s.length < 0
  return false if !@filename.nil? && @filename !~ Regexp.new(/^[\p{Alnum}:\/\\!@#$%^&{}\[\]()_+\-=,.~'` ]{1,255}$/)
  return false if !@extension.nil? && @extension.to_s.length > 255
  return false if !@extension.nil? && @extension.to_s.length < 0
  return false if !@extension.nil? && @extension !~ Regexp.new(/^[\p{Alnum}!@#$%^&{}\[\]()_+\-=,.~'` ]{1,255}$/)
  return false if !@md5.nil? && @md5 !~ Regexp.new(/^[0-9a-f]{32}$/)
  return false if !@sha1.nil? && @sha1 !~ Regexp.new(/^[0-9a-f]{40}$/)
  return false if !@sha256.nil? && @sha256 !~ Regexp.new(/^[0-9a-f]{64}$/)
  return false if !@sha512.nil? && @sha512 !~ Regexp.new(/^[0-9a-f]{128}$/)
  return false if !@sha3_256.nil? && @sha3_256 !~ Regexp.new(/^[0-9a-f]{64}$/)
  return false if !@sha3_512.nil? && @sha3_512 !~ Regexp.new(/^[0-9a-f]{128}$/)
  return false if !@cpe.nil? && @cpe.to_s.length > 255
  return false if !@cpe.nil? && @cpe.to_s.length < 0
  return false if !@cpe.nil? && @cpe !~ Regexp.new(/(cpe:2\.3:[aho\*\-](:(((\?*|\*?)([a-zA-Z0-9\-\._]|(\\[\\\*\?!"#$$%&'\(\)\+,\/:;<=>@\[\]\^`\{\|}~]))+(\?*|\*?))|[\*\-])){5}(:(([a-zA-Z]{2,3}(-([a-zA-Z]{2}|[0-9]{3}))?)|[\*\-]))(:(((\?*|\*?)([a-zA-Z0-9\-\._]|(\\[\\\*\?!"#$$%&'\(\)\+,\/:;<=>@\[\]\^`\{\|}~]))+(\?*|\*?))|[\*\-])){4})|([c][pP][eE]:\/[AHOaho]?(:[A-Za-z0-9\._\-~%]*){0,6})/)
  return false if !@description.nil? && @description.to_s.length > 1024
  return false if !@description.nil? && @description.to_s.length < 0
  return false if !@description.nil? && @description !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/)
  return false if !@copyright.nil? && @copyright.to_s.length > 1024
  return false if !@copyright.nil? && @copyright.to_s.length < 0
  return false if !@copyright.nil? && @copyright !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/)
  return false if !@license.nil? && @license.to_s.length > 255
  return false if !@license.nil? && @license.to_s.length < 0
  return false if !@license.nil? && @license !~ Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/)
  return false if @uuid.nil?
  true
end
version=(version) click to toggle source

Custom attribute writer method with validation @param [Object] version Value to be assigned

# File lib/dependency-tracker-client/models/component.rb, line 533
def version=(version)
  if !version.nil? && version.to_s.length > 255
    fail ArgumentError, 'invalid value for "version", the character length must be smaller than or equal to 255.'
  end

  if !version.nil? && version.to_s.length < 0
    fail ArgumentError, 'invalid value for "version", the character length must be great than or equal to 0.'
  end

  pattern = Regexp.new(/^[\p{White_Space}\p{L}\p{M}\p{S}\p{N}\p{P}]*$/)
  if !version.nil? && version !~ pattern
    fail ArgumentError, "invalid value for \"version\", must conform to the pattern #{pattern}."
  end

  @version = version
end