Class: SemgrepWebApp::ProtosSecretsV1HistoricalInfo
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SemgrepWebApp::ProtosSecretsV1HistoricalInfo
- Defined in:
- lib/semgrep_web_app/models/protos_secrets_v1_historical_info.rb
Overview
ProtosSecretsV1HistoricalInfo Model.
Instance Attribute Summary collapse
-
#git_blob ⇒ String
Git blob at which the finding is present.
-
#git_commit ⇒ String
Git commit at which the finding is present.
-
#git_commit_timestamp ⇒ DateTime
Git commit at which the finding is present.
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(git_blob: SKIP, git_commit: SKIP, git_commit_timestamp: SKIP, additional_properties: nil) ⇒ ProtosSecretsV1HistoricalInfo
constructor
A new instance of ProtosSecretsV1HistoricalInfo.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_git_commit_timestamp ⇒ Object
-
#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(git_blob: SKIP, git_commit: SKIP, git_commit_timestamp: SKIP, additional_properties: nil) ⇒ ProtosSecretsV1HistoricalInfo
Returns a new instance of ProtosSecretsV1HistoricalInfo.
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/semgrep_web_app/models/protos_secrets_v1_historical_info.rb', line 59 def initialize(git_blob: SKIP, git_commit: SKIP, git_commit_timestamp: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @git_blob = git_blob unless git_blob == SKIP @git_commit = git_commit unless git_commit == SKIP @git_commit_timestamp = unless == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#git_blob ⇒ String
Git blob at which the finding is present. Sent in addition to the commit since some SCMs have permalinks which use the blob sha, so this information is useful when generating links back to the SCM.
18 19 20 |
# File 'lib/semgrep_web_app/models/protos_secrets_v1_historical_info.rb', line 18 def git_blob @git_blob end |
#git_commit ⇒ String
Git commit at which the finding is present. Used by "historical" scans, which scan non-HEAD commits in the git history. Relevant for finding, e.g., secrets which are buried in the git history which we wouldn't find at HEAD
26 27 28 |
# File 'lib/semgrep_web_app/models/protos_secrets_v1_historical_info.rb', line 26 def git_commit @git_commit end |
#git_commit_timestamp ⇒ DateTime
Git commit at which the finding is present. Used by "historical" scans, which scan non-HEAD commits in the git history. Relevant for finding, e.g., secrets which are buried in the git history which we wouldn't find at HEAD
34 35 36 |
# File 'lib/semgrep_web_app/models/protos_secrets_v1_historical_info.rb', line 34 def @git_commit_timestamp end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/semgrep_web_app/models/protos_secrets_v1_historical_info.rb', line 71 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. git_blob = hash.key?('gitBlob') ? hash['gitBlob'] : SKIP git_commit = hash.key?('gitCommit') ? hash['gitCommit'] : SKIP = if hash.key?('gitCommitTimestamp') (DateTimeHelper.from_rfc3339(hash['gitCommitTimestamp']) if hash['gitCommitTimestamp']) else SKIP end # 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. ProtosSecretsV1HistoricalInfo.new(git_blob: git_blob, git_commit: git_commit, git_commit_timestamp: , additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 |
# File 'lib/semgrep_web_app/models/protos_secrets_v1_historical_info.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['git_blob'] = 'gitBlob' @_hash['git_commit'] = 'gitCommit' @_hash['git_commit_timestamp'] = 'gitCommitTimestamp' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/semgrep_web_app/models/protos_secrets_v1_historical_info.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
46 47 48 49 50 51 52 |
# File 'lib/semgrep_web_app/models/protos_secrets_v1_historical_info.rb', line 46 def self.optionals %w[ git_blob git_commit git_commit_timestamp ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
109 110 111 112 113 114 |
# File 'lib/semgrep_web_app/models/protos_secrets_v1_historical_info.rb', line 109 def inspect class_name = self.class.name.split('::').last "<#{class_name} git_blob: #{@git_blob.inspect}, git_commit: #{@git_commit.inspect},"\ " git_commit_timestamp: #{@git_commit_timestamp.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_git_commit_timestamp ⇒ Object
97 98 99 |
# File 'lib/semgrep_web_app/models/protos_secrets_v1_historical_info.rb', line 97 def DateTimeHelper.to_rfc3339() end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
102 103 104 105 106 |
# File 'lib/semgrep_web_app/models/protos_secrets_v1_historical_info.rb', line 102 def to_s class_name = self.class.name.split('::').last "<#{class_name} git_blob: #{@git_blob}, git_commit: #{@git_commit}, git_commit_timestamp:"\ " #{@git_commit_timestamp}, additional_properties: #{@additional_properties}>" end |