Class: SemgrepWebApp::ProtosScaV1FoundDependency
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SemgrepWebApp::ProtosScaV1FoundDependency
- Defined in:
- lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb
Overview
ProtosScaV1FoundDependency Model.
Instance Attribute Summary collapse
-
#defined_at ⇒ ProtosScaV1CodeLocation
Path and line number dependency is declared in.
-
#ecosystem ⇒ Ecosystem1
The ecosystem the dependency is in (e.g. pypi, npm, etc).
-
#licenses ⇒ Array[String]
Licenses the dependency is using.
-
#manifest_definition ⇒ ProtosScaV1CodeLocation
Path to the manifest file that defines the subproject containing this dependency.
-
#package ⇒ ProtosScaV1Dependency
What the dependency is.
-
#repository_id ⇒ String
ID of repository dependency is found in.
-
#resolved_url ⇒ String
The resolved URL of the dependency.
-
#transitivity ⇒ Transitivity1
Whether dependency is direct or transitive.
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(defined_at: SKIP, ecosystem: SKIP, licenses: SKIP, manifest_definition: SKIP, package: SKIP, repository_id: SKIP, resolved_url: SKIP, transitivity: SKIP, additional_properties: nil) ⇒ ProtosScaV1FoundDependency
constructor
A new instance of ProtosScaV1FoundDependency.
-
#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(defined_at: SKIP, ecosystem: SKIP, licenses: SKIP, manifest_definition: SKIP, package: SKIP, repository_id: SKIP, resolved_url: SKIP, transitivity: SKIP, additional_properties: nil) ⇒ ProtosScaV1FoundDependency
Returns a new instance of ProtosScaV1FoundDependency.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb', line 103 def initialize(defined_at: SKIP, ecosystem: SKIP, licenses: SKIP, manifest_definition: SKIP, package: SKIP, repository_id: SKIP, resolved_url: SKIP, transitivity: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @defined_at = defined_at unless defined_at == SKIP @ecosystem = ecosystem unless ecosystem == SKIP @licenses = licenses unless licenses == SKIP @manifest_definition = manifest_definition unless manifest_definition == SKIP @package = package unless package == SKIP @repository_id = repository_id unless repository_id == SKIP @resolved_url = resolved_url unless resolved_url == SKIP @transitivity = transitivity unless transitivity == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#defined_at ⇒ ProtosScaV1CodeLocation
Path and line number dependency is declared in.
14 15 16 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb', line 14 def defined_at @defined_at end |
#ecosystem ⇒ Ecosystem1
The ecosystem the dependency is in (e.g. pypi, npm, etc).
| value | description |
|---|---|
| no_package_manager | |
| npm | |
| pypi | |
| gomod | |
| cargo | |
| maven | |
| gem | |
| composer | |
| nuget | |
| pub | |
| swiftpm | |
| hex | |
| cocoapods | |
| mix | |
| opam |
35 36 37 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb', line 35 def ecosystem @ecosystem end |
#licenses ⇒ Array[String]
Licenses the dependency is using.
39 40 41 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb', line 39 def licenses @licenses end |
#manifest_definition ⇒ ProtosScaV1CodeLocation
Path to the manifest file that defines the subproject containing this dependency
44 45 46 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb', line 44 def manifest_definition @manifest_definition end |
#package ⇒ ProtosScaV1Dependency
What the dependency is.
48 49 50 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb', line 48 def package @package end |
#repository_id ⇒ String
ID of repository dependency is found in.
52 53 54 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb', line 52 def repository_id @repository_id end |
#resolved_url ⇒ String
The resolved URL of the dependency. Could point to a compressed source code directory (e.g. tarball), source code repository, or a package manager cache directory. May be empty if the package manager doesn't supply a URL.
59 60 61 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb', line 59 def resolved_url @resolved_url end |
#transitivity ⇒ Transitivity1
Whether dependency is direct or transitive.
| value | description |
|---|---|
| UNKNOWN_TRANSITIVITY | |
| TRANSITIVE | |
| DIRECT |
68 69 70 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb', line 68 def transitivity @transitivity end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb', line 122 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. defined_at = ProtosScaV1CodeLocation.from_hash(hash['definedAt']) if hash['definedAt'] ecosystem = hash.key?('ecosystem') ? hash['ecosystem'] : SKIP licenses = hash.key?('licenses') ? hash['licenses'] : SKIP manifest_definition = ProtosScaV1CodeLocation.from_hash(hash['manifestDefinition']) if hash['manifestDefinition'] package = ProtosScaV1Dependency.from_hash(hash['package']) if hash['package'] repository_id = hash.key?('repositoryId') ? hash['repositoryId'] : SKIP resolved_url = hash.key?('resolvedUrl') ? hash['resolvedUrl'] : SKIP transitivity = hash.key?('transitivity') ? hash['transitivity'] : 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. ProtosScaV1FoundDependency.new(defined_at: defined_at, ecosystem: ecosystem, licenses: licenses, manifest_definition: manifest_definition, package: package, repository_id: repository_id, resolved_url: resolved_url, transitivity: transitivity, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb', line 71 def self.names @_hash = {} if @_hash.nil? @_hash['defined_at'] = 'definedAt' @_hash['ecosystem'] = 'ecosystem' @_hash['licenses'] = 'licenses' @_hash['manifest_definition'] = 'manifestDefinition' @_hash['package'] = 'package' @_hash['repository_id'] = 'repositoryId' @_hash['resolved_url'] = 'resolvedUrl' @_hash['transitivity'] = 'transitivity' @_hash end |
.nullables ⇒ Object
An array for nullable fields
99 100 101 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb', line 99 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb', line 85 def self.optionals %w[ defined_at ecosystem licenses manifest_definition package repository_id resolved_url transitivity ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
165 166 167 168 169 170 171 172 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb', line 165 def inspect class_name = self.class.name.split('::').last "<#{class_name} defined_at: #{@defined_at.inspect}, ecosystem: #{@ecosystem.inspect},"\ " licenses: #{@licenses.inspect}, manifest_definition: #{@manifest_definition.inspect},"\ " package: #{@package.inspect}, repository_id: #{@repository_id.inspect}, resolved_url:"\ " #{@resolved_url.inspect}, transitivity: #{@transitivity.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
156 157 158 159 160 161 162 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb', line 156 def to_s class_name = self.class.name.split('::').last "<#{class_name} defined_at: #{@defined_at}, ecosystem: #{@ecosystem}, licenses:"\ " #{@licenses}, manifest_definition: #{@manifest_definition}, package: #{@package},"\ " repository_id: #{@repository_id}, resolved_url: #{@resolved_url}, transitivity:"\ " #{@transitivity}, additional_properties: #{@additional_properties}>" end |