Class: CloudsmithApi::RecycleBinPackage

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudsmith-api/models/recycle_bin_package.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ RecycleBinPackage

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



169
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 169

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.has_key?(:'action_by')
    self.action_by = attributes[:'action_by']
  end

  if attributes.has_key?(:'downloads')
    self.downloads = attributes[:'downloads']
  end

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

  if attributes.has_key?(:'format')
    self.format = attributes[:'format']
  end

  if attributes.has_key?(:'fully_qualified_name')
    self.fully_qualified_name = attributes[:'fully_qualified_name']
  end

  if attributes.has_key?(:'identifiers')
    if (value = attributes[:'identifiers']).is_a?(Hash)
      self.identifiers = value
    end
  end

  if attributes.has_key?(:'invoked_retention_rule')
    if (value = attributes[:'invoked_retention_rule']).is_a?(Hash)
      self.invoked_retention_rule = value
    end
  end

  if attributes.has_key?(:'is_deleteable')
    self.is_deleteable = attributes[:'is_deleteable']
  end

  if attributes.has_key?(:'is_malware_detected')
    self.is_malware_detected = attributes[:'is_malware_detected']
  end

  if attributes.has_key?(:'is_quarantined')
    self.is_quarantined = attributes[:'is_quarantined']
  end

  if attributes.has_key?(:'is_restorable')
    self.is_restorable = attributes[:'is_restorable']
  end

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

  if attributes.has_key?(:'policy_violated')
    self.policy_violated = attributes[:'policy_violated']
  end

  if attributes.has_key?(:'repository')
    self.repository = attributes[:'repository']
  end

  if attributes.has_key?(:'security_scan_completed_at')
    self.security_scan_completed_at = attributes[:'security_scan_completed_at']
  end

  if attributes.has_key?(:'security_scan_status')
    self.security_scan_status = attributes[:'security_scan_status']
  else
    self.security_scan_status = 'Awaiting Security Scan'
  end

  if attributes.has_key?(:'size')
    self.size = attributes[:'size']
  end

  if attributes.has_key?(:'slug_perm')
    self.slug_perm = attributes[:'slug_perm']
  end

  if attributes.has_key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.has_key?(:'status_updated_at')
    self.status_updated_at = attributes[:'status_updated_at']
  end

  if attributes.has_key?(:'tags')
    self.tags = attributes[:'tags']
  end

  if attributes.has_key?(:'type_display')
    self.type_display = attributes[:'type_display']
  end

  if attributes.has_key?(:'uploaded_at')
    self.uploaded_at = attributes[:'uploaded_at']
  end

  if attributes.has_key?(:'uploader')
    self.uploader = attributes[:'uploader']
  end

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

  if attributes.has_key?(:'vulnerability_counts')
    self.vulnerability_counts = attributes[:'vulnerability_counts']
  end
end

Instance Attribute Details

#action_byObject

The name of the user who deleted the package.



18
19
20
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 18

def action_by
  @action_by
end

#downloadsObject

Returns the value of attribute downloads.



20
21
22
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 20

def downloads
  @downloads
end

#filenameObject

Returns the value of attribute filename.



22
23
24
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 22

def filename
  @filename
end

#formatObject

Returns the value of attribute format.



24
25
26
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 24

def format
  @format
end

#fully_qualified_nameObject

The fully qualified name of the package.



27
28
29
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 27

def fully_qualified_name
  @fully_qualified_name
end

#identifiersObject

Returns the value of attribute identifiers.



29
30
31
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 29

def identifiers
  @identifiers
end

#invoked_retention_ruleObject

Information about the retention rule that triggered deletion (if any).



32
33
34
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 32

def invoked_retention_rule
  @invoked_retention_rule
end

#is_deleteableObject

Returns the value of attribute is_deleteable.



34
35
36
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 34

def is_deleteable
  @is_deleteable
end

#is_malware_detectedObject

Whether the package has been detected as containing malware. Requires Ultra plan.



37
38
39
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 37

def is_malware_detected
  @is_malware_detected
end

#is_quarantinedObject

Returns the value of attribute is_quarantined.



39
40
41
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 39

def is_quarantined
  @is_quarantined
end

#is_restorableObject

Returns the value of attribute is_restorable.



41
42
43
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 41

def is_restorable
  @is_restorable
end

#nameObject

The name of this package.



44
45
46
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 44

def name
  @name
end

#policy_violatedObject

Whether or not the package has violated any policy.



47
48
49
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 47

def policy_violated
  @policy_violated
end

#repositoryObject

Returns the value of attribute repository.



49
50
51
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 49

def repository
  @repository
end

#security_scan_completed_atObject

The datetime the security scanning was completed.



52
53
54
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 52

def security_scan_completed_at
  @security_scan_completed_at
end

#security_scan_statusObject

Returns the value of attribute security_scan_status.



54
55
56
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 54

def security_scan_status
  @security_scan_status
end

#sizeObject

The calculated size of the package.



57
58
59
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 57

def size
  @size
end

#slug_permObject

Returns the value of attribute slug_perm.



59
60
61
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 59

def slug_perm
  @slug_perm
end

#statusObject

The synchronisation status of the package.



62
63
64
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 62

def status
  @status
end

#status_updated_atObject

The datetime the package status was updated at.



65
66
67
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 65

def status_updated_at
  @status_updated_at
end

#tagsObject

Returns the value of attribute tags.



67
68
69
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 67

def tags
  @tags
end

#type_displayObject

Returns the value of attribute type_display.



69
70
71
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 69

def type_display
  @type_display
end

#uploaded_atObject

The date this package was uploaded.



72
73
74
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 72

def uploaded_at
  @uploaded_at
end

#uploaderObject

Returns the value of attribute uploader.



74
75
76
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 74

def uploader
  @uploader
end

#versionObject

The raw version for this package.



77
78
79
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 77

def version
  @version
end

#vulnerability_countsObject

Returns the value of attribute vulnerability_counts.



79
80
81
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 79

def vulnerability_counts
  @vulnerability_counts
end

Class Method Details

.attribute_mapObject

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



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 104

def self.attribute_map
  {
    :'action_by' => :'action_by',
    :'downloads' => :'downloads',
    :'filename' => :'filename',
    :'format' => :'format',
    :'fully_qualified_name' => :'fully_qualified_name',
    :'identifiers' => :'identifiers',
    :'invoked_retention_rule' => :'invoked_retention_rule',
    :'is_deleteable' => :'is_deleteable',
    :'is_malware_detected' => :'is_malware_detected',
    :'is_quarantined' => :'is_quarantined',
    :'is_restorable' => :'is_restorable',
    :'name' => :'name',
    :'policy_violated' => :'policy_violated',
    :'repository' => :'repository',
    :'security_scan_completed_at' => :'security_scan_completed_at',
    :'security_scan_status' => :'security_scan_status',
    :'size' => :'size',
    :'slug_perm' => :'slug_perm',
    :'status' => :'status',
    :'status_updated_at' => :'status_updated_at',
    :'tags' => :'tags',
    :'type_display' => :'type_display',
    :'uploaded_at' => :'uploaded_at',
    :'uploader' => :'uploader',
    :'version' => :'version',
    :'vulnerability_counts' => :'vulnerability_counts'
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 136

def self.swagger_types
  {
    :'action_by' => :'String',
    :'downloads' => :'Integer',
    :'filename' => :'String',
    :'format' => :'String',
    :'fully_qualified_name' => :'String',
    :'identifiers' => :'Hash<String, String>',
    :'invoked_retention_rule' => :'Hash<String, String>',
    :'is_deleteable' => :'BOOLEAN',
    :'is_malware_detected' => :'BOOLEAN',
    :'is_quarantined' => :'BOOLEAN',
    :'is_restorable' => :'BOOLEAN',
    :'name' => :'String',
    :'policy_violated' => :'BOOLEAN',
    :'repository' => :'String',
    :'security_scan_completed_at' => :'DateTime',
    :'security_scan_status' => :'String',
    :'size' => :'Integer',
    :'slug_perm' => :'String',
    :'status' => :'Integer',
    :'status_updated_at' => :'DateTime',
    :'tags' => :'Tags',
    :'type_display' => :'String',
    :'uploaded_at' => :'DateTime',
    :'uploader' => :'String',
    :'version' => :'String',
    :'vulnerability_counts' => :'WebOSVSeverityCounts'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 313

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      action_by == o.action_by &&
      downloads == o.downloads &&
      filename == o.filename &&
      format == o.format &&
      fully_qualified_name == o.fully_qualified_name &&
      identifiers == o.identifiers &&
      invoked_retention_rule == o.invoked_retention_rule &&
      is_deleteable == o.is_deleteable &&
      is_malware_detected == o.is_malware_detected &&
      is_quarantined == o.is_quarantined &&
      is_restorable == o.is_restorable &&
      name == o.name &&
      policy_violated == o.policy_violated &&
      repository == o.repository &&
      security_scan_completed_at == o.security_scan_completed_at &&
      security_scan_status == o.security_scan_status &&
      size == o.size &&
      slug_perm == o.slug_perm &&
      status == o.status &&
      status_updated_at == o.status_updated_at &&
      tags == o.tags &&
      type_display == o.type_display &&
      uploaded_at == o.uploaded_at &&
      uploader == o.uploader &&
      version == o.version &&
      vulnerability_counts == o.vulnerability_counts
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 380

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
    temp_model = CloudsmithApi.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



446
447
448
449
450
451
452
453
454
455
456
457
458
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 446

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) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 359

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


346
347
348
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 346

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



352
353
354
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 352

def hash
  [action_by, downloads, filename, format, fully_qualified_name, identifiers, invoked_retention_rule, is_deleteable, is_malware_detected, is_quarantined, is_restorable, name, policy_violated, repository, security_scan_completed_at, security_scan_status, size, slug_perm, status, status_updated_at, tags, type_display, uploaded_at, uploader, version, vulnerability_counts].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



288
289
290
291
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 288

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



426
427
428
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 426

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



432
433
434
435
436
437
438
439
440
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 432

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



420
421
422
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 420

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



295
296
297
298
299
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 295

def valid?
  security_scan_status_validator = EnumAttributeValidator.new('String', ['Awaiting Security Scan', 'Security Scanning in Progress', 'Scan Detected Vulnerabilities', 'Scan Detected No Vulnerabilities', 'Security Scanning Disabled', 'Security Scanning Failed', 'Security Scanning Skipped', 'Security Scanning Not Supported'])
  return false unless security_scan_status_validator.valid?(@security_scan_status)
  true
end