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



160
161
162
163
164
165
166
167
168
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
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 160

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_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
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_quarantinedObject

Returns the value of attribute is_quarantined.



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

def is_quarantined
  @is_quarantined
end

#is_restorableObject

Returns the value of attribute is_restorable.



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

def is_restorable
  @is_restorable
end

#nameObject

The name of this package.



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

def name
  @name
end

#policy_violatedObject

Whether or not the package has violated any policy.



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

def policy_violated
  @policy_violated
end

#repositoryObject

Returns the value of attribute repository.



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

def repository
  @repository
end

#security_scan_completed_atObject

The datetime the security scanning was completed.



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

def security_scan_completed_at
  @security_scan_completed_at
end

#security_scan_statusObject

Returns the value of attribute security_scan_status.



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

def security_scan_status
  @security_scan_status
end

#sizeObject

The calculated size of the package.



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

def size
  @size
end

#slug_permObject

Returns the value of attribute slug_perm.



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

def slug_perm
  @slug_perm
end

#statusObject

The synchronisation status of the package.



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

def status
  @status
end

#status_updated_atObject

The datetime the package status was updated at.



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

def status_updated_at
  @status_updated_at
end

#tagsObject

Returns the value of attribute tags.



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

def tags
  @tags
end

#type_displayObject

Returns the value of attribute type_display.



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

def type_display
  @type_display
end

#uploaded_atObject

The date this package was uploaded.



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

def uploaded_at
  @uploaded_at
end

#uploaderObject

Returns the value of attribute uploader.



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

def uploader
  @uploader
end

#versionObject

The raw version for this package.



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

def version
  @version
end

Class Method Details

.attribute_mapObject

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



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 99

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_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'
  }
end

.swagger_typesObject

Attribute type mapping.



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

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_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'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 296

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_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
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



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 361

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



427
428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 427

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



340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 340

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


327
328
329
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 327

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



333
334
335
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 333

def hash
  [action_by, downloads, filename, format, fully_qualified_name, identifiers, invoked_retention_rule, is_deleteable, 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].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



271
272
273
274
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 271

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



407
408
409
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 407

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



413
414
415
416
417
418
419
420
421
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 413

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



401
402
403
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 401

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



278
279
280
281
282
# File 'lib/cloudsmith-api/models/recycle_bin_package.rb', line 278

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