Class: SemgrepWebApp::ProtosOpenapiV1GetScanResponseScanMeta

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb

Overview

ProtosOpenapiV1GetScanResponseScanMeta Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(mtrue: SKIP, branch: SKIP, commit: SKIP, config: SKIP, repo_url: SKIP, ci_job_url: SKIP, repository: SKIP, commit_title: SKIP, pull_request_id: SKIP, pull_request_title: SKIP, commit_author_name: SKIP, commit_author_image_url: SKIP, commit_author_email: SKIP, commit_author_username: SKIP, pull_request_author_username: SKIP, pull_request_author_image_url: SKIP, additional_properties: nil) ⇒ ProtosOpenapiV1GetScanResponseScanMeta

Returns a new instance of ProtosOpenapiV1GetScanResponseScanMeta.



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 132

def initialize(mtrue: SKIP, branch: SKIP, commit: SKIP, config: SKIP,
               repo_url: SKIP, ci_job_url: SKIP, repository: SKIP,
               commit_title: SKIP, pull_request_id: SKIP,
               pull_request_title: SKIP, commit_author_name: SKIP,
               commit_author_image_url: SKIP, commit_author_email: SKIP,
               commit_author_username: SKIP,
               pull_request_author_username: SKIP,
               pull_request_author_image_url: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @mtrue = mtrue unless mtrue == SKIP
  @branch = branch unless branch == SKIP
  @commit = commit unless commit == SKIP
  @config = config unless config == SKIP
  @repo_url = repo_url unless repo_url == SKIP
  @ci_job_url = ci_job_url unless ci_job_url == SKIP
  @repository = repository unless repository == SKIP
  @commit_title = commit_title unless commit_title == SKIP
  @pull_request_id = pull_request_id unless pull_request_id == SKIP
  @pull_request_title = pull_request_title unless pull_request_title == SKIP
  @commit_author_name = commit_author_name unless commit_author_name == SKIP
  @commit_author_image_url = commit_author_image_url unless commit_author_image_url == SKIP
  @commit_author_email = commit_author_email unless commit_author_email == SKIP
  @commit_author_username = commit_author_username unless commit_author_username == SKIP
  unless pull_request_author_username == SKIP
    @pull_request_author_username =
      pull_request_author_username
  end
  unless pull_request_author_image_url == SKIP
    @pull_request_author_image_url =
      pull_request_author_image_url
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#branchString

The branch that was scanned, if applicable.

Returns:

  • (String)


18
19
20
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 18

def branch
  @branch
end

#ci_job_urlString

The URL of the CI job that ran the scan, if applicable.

Returns:

  • (String)


34
35
36
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 34

def ci_job_url
  @ci_job_url
end

#commitString

The commit SHA associated with the scan, if applicable.

Returns:

  • (String)


22
23
24
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 22

def commit
  @commit
end

#commit_author_emailString

The email of the author of the commit associated with the scan, if applicable.

Returns:

  • (String)


65
66
67
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 65

def commit_author_email
  @commit_author_email
end

#commit_author_image_urlString

The avatar image url of the author of the commit associated with the scan, if applicable.

Returns:

  • (String)


60
61
62
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 60

def commit_author_image_url
  @commit_author_image_url
end

#commit_author_nameString

The name of the author of the commit associated with the scan, if applicable.

Returns:

  • (String)


55
56
57
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 55

def commit_author_name
  @commit_author_name
end

#commit_author_usernameString

The username of the author of the commit associated with the scan, if applicable.

Returns:

  • (String)


70
71
72
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 70

def commit_author_username
  @commit_author_username
end

#commit_titleString

The commit message associated with the scan, if applicable.

Returns:

  • (String)


42
43
44
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 42

def commit_title
  @commit_title
end

#configString

The path of the configuration file used for this scan, if applicable.

Returns:

  • (String)


26
27
28
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 26

def config
  @config
end

#mtrueString

What triggered this scan, if applicable.

Returns:

  • (String)


14
15
16
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 14

def mtrue
  @mtrue
end

#pull_request_author_image_urlString

The avatar image url of the author of the pull request associated with the scan, if applicable.

Returns:

  • (String)


80
81
82
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 80

def pull_request_author_image_url
  @pull_request_author_image_url
end

#pull_request_author_usernameString

The username of the author of the pull request associated with the scan, if applicable.

Returns:

  • (String)


75
76
77
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 75

def pull_request_author_username
  @pull_request_author_username
end

#pull_request_idString

The ID of the pull request associated with the scan, if applicable.

Returns:

  • (String)


46
47
48
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 46

def pull_request_id
  @pull_request_id
end

#pull_request_titleString

The title of the pull request associated with the scan if applicable.

Returns:

  • (String)


50
51
52
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 50

def pull_request_title
  @pull_request_title
end

#repo_urlString

The URL of the scanned repository, if applicable.

Returns:

  • (String)


30
31
32
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 30

def repo_url
  @repo_url
end

#repositoryString

The name and organization of the scanned repository, if applicable.

Returns:

  • (String)


38
39
40
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 38

def repository
  @repository
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 170

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  mtrue = hash.key?('true') ? hash['true'] : SKIP
  branch = hash.key?('branch') ? hash['branch'] : SKIP
  commit = hash.key?('commit') ? hash['commit'] : SKIP
  config = hash.key?('config') ? hash['config'] : SKIP
  repo_url = hash.key?('repo_url') ? hash['repo_url'] : SKIP
  ci_job_url = hash.key?('ci_job_url') ? hash['ci_job_url'] : SKIP
  repository = hash.key?('repository') ? hash['repository'] : SKIP
  commit_title = hash.key?('commit_title') ? hash['commit_title'] : SKIP
  pull_request_id =
    hash.key?('pull_request_id') ? hash['pull_request_id'] : SKIP
  pull_request_title =
    hash.key?('pull_request_title') ? hash['pull_request_title'] : SKIP
  commit_author_name =
    hash.key?('commit_author_name') ? hash['commit_author_name'] : SKIP
  commit_author_image_url =
    hash.key?('commit_author_image_url') ? hash['commit_author_image_url'] : SKIP
  commit_author_email =
    hash.key?('commit_author_email') ? hash['commit_author_email'] : SKIP
  commit_author_username =
    hash.key?('commit_author_username') ? hash['commit_author_username'] : SKIP
  pull_request_author_username =
    hash.key?('pull_request_author_username') ? hash['pull_request_author_username'] : SKIP
  pull_request_author_image_url =
    hash.key?('pull_request_author_image_url') ? hash['pull_request_author_image_url'] : 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.
  ProtosOpenapiV1GetScanResponseScanMeta.new(mtrue: mtrue,
                                             branch: branch,
                                             commit: commit,
                                             config: config,
                                             repo_url: repo_url,
                                             ci_job_url: ci_job_url,
                                             repository: repository,
                                             commit_title: commit_title,
                                             pull_request_id: pull_request_id,
                                             pull_request_title: pull_request_title,
                                             commit_author_name: commit_author_name,
                                             commit_author_image_url: commit_author_image_url,
                                             commit_author_email: commit_author_email,
                                             commit_author_username: commit_author_username,
                                             pull_request_author_username: pull_request_author_username,
                                             pull_request_author_image_url: pull_request_author_image_url,
                                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 83

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['mtrue'] = 'true'
  @_hash['branch'] = 'branch'
  @_hash['commit'] = 'commit'
  @_hash['config'] = 'config'
  @_hash['repo_url'] = 'repo_url'
  @_hash['ci_job_url'] = 'ci_job_url'
  @_hash['repository'] = 'repository'
  @_hash['commit_title'] = 'commit_title'
  @_hash['pull_request_id'] = 'pull_request_id'
  @_hash['pull_request_title'] = 'pull_request_title'
  @_hash['commit_author_name'] = 'commit_author_name'
  @_hash['commit_author_image_url'] = 'commit_author_image_url'
  @_hash['commit_author_email'] = 'commit_author_email'
  @_hash['commit_author_username'] = 'commit_author_username'
  @_hash['pull_request_author_username'] = 'pull_request_author_username'
  @_hash['pull_request_author_image_url'] =
    'pull_request_author_image_url'
  @_hash
end

.nullablesObject

An array for nullable fields



128
129
130
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 128

def self.nullables
  []
end

.optionalsObject

An array for optional fields



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 106

def self.optionals
  %w[
    mtrue
    branch
    commit
    config
    repo_url
    ci_job_url
    repository
    commit_title
    pull_request_id
    pull_request_title
    commit_author_name
    commit_author_image_url
    commit_author_email
    commit_author_username
    pull_request_author_username
    pull_request_author_image_url
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 241

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} mtrue: #{@mtrue.inspect}, branch: #{@branch.inspect}, commit:"\
  " #{@commit.inspect}, config: #{@config.inspect}, repo_url: #{@repo_url.inspect},"\
  " ci_job_url: #{@ci_job_url.inspect}, repository: #{@repository.inspect}, commit_title:"\
  " #{@commit_title.inspect}, pull_request_id: #{@pull_request_id.inspect},"\
  " pull_request_title: #{@pull_request_title.inspect}, commit_author_name:"\
  " #{@commit_author_name.inspect}, commit_author_image_url:"\
  " #{@commit_author_image_url.inspect}, commit_author_email: #{@commit_author_email.inspect},"\
  " commit_author_username: #{@commit_author_username.inspect}, pull_request_author_username:"\
  " #{@pull_request_author_username.inspect}, pull_request_author_image_url:"\
  " #{@pull_request_author_image_url.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb', line 227

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} mtrue: #{@mtrue}, branch: #{@branch}, commit: #{@commit}, config:"\
  " #{@config}, repo_url: #{@repo_url}, ci_job_url: #{@ci_job_url}, repository:"\
  " #{@repository}, commit_title: #{@commit_title}, pull_request_id: #{@pull_request_id},"\
  " pull_request_title: #{@pull_request_title}, commit_author_name: #{@commit_author_name},"\
  " commit_author_image_url: #{@commit_author_image_url}, commit_author_email:"\
  " #{@commit_author_email}, commit_author_username: #{@commit_author_username},"\
  " pull_request_author_username: #{@pull_request_author_username},"\
  " pull_request_author_image_url: #{@pull_request_author_image_url}, additional_properties:"\
  " #{@additional_properties}>"
end