pulp_container_client 2.0.0b2 → 2.0.0b3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +32 -20
  3. data/docs/{ContainerBlobRead.md → ContainerBlob.md} +2 -2
  4. data/docs/ContainerContainerDistribution.md +8 -8
  5. data/docs/{ContainerContainerRepositoryRead.md → ContainerContainerPushRepository.md} +2 -2
  6. data/docs/ContainerContentRedirectContentGuard.md +23 -0
  7. data/docs/{ContainerManifestRead.md → ContainerManifest.md} +2 -2
  8. data/docs/{ContainerTagRead.md → ContainerTag.md} +2 -2
  9. data/docs/ContentBlobsApi.md +2 -2
  10. data/docs/ContentManifestsApi.md +2 -2
  11. data/docs/ContentTagsApi.md +2 -2
  12. data/docs/ContentguardsContentRedirectApi.md +355 -0
  13. data/docs/DistributionsContainerApi.md +4 -4
  14. data/docs/InlineResponse200.md +1 -1
  15. data/docs/InlineResponse2001.md +1 -1
  16. data/docs/InlineResponse2002.md +1 -1
  17. data/docs/InlineResponse2003.md +1 -1
  18. data/docs/InlineResponse2004.md +1 -1
  19. data/docs/InlineResponse2005.md +1 -1
  20. data/docs/InlineResponse2006.md +1 -1
  21. data/docs/InlineResponse2007.md +23 -0
  22. data/docs/InlineResponse2008.md +23 -0
  23. data/docs/RemotesContainerApi.md +6 -6
  24. data/docs/RepositoriesContainerApi.md +6 -6
  25. data/docs/RepositoriesContainerPushApi.md +356 -0
  26. data/docs/RepositoriesContainerVersionsApi.md +285 -20
  27. data/docs/{V2Api.md → TokenApi.md} +5 -5
  28. data/lib/pulp_container_client.rb +10 -12
  29. data/lib/pulp_container_client/api/content_blobs_api.rb +3 -3
  30. data/lib/pulp_container_client/api/content_manifests_api.rb +3 -3
  31. data/lib/pulp_container_client/api/content_tags_api.rb +3 -3
  32. data/lib/pulp_container_client/api/contentguards_content_redirect_api.rb +431 -0
  33. data/lib/pulp_container_client/api/distributions_container_api.rb +6 -6
  34. data/lib/pulp_container_client/api/remotes_container_api.rb +9 -9
  35. data/lib/pulp_container_client/api/repositories_container_api.rb +9 -9
  36. data/lib/pulp_container_client/api/repositories_container_push_api.rb +433 -0
  37. data/lib/pulp_container_client/api/repositories_container_versions_api.rb +354 -34
  38. data/lib/pulp_container_client/api/{v2_api.rb → token_api.rb} +6 -6
  39. data/lib/pulp_container_client/models/{container_blob_read.rb → container_blob.rb} +3 -3
  40. data/lib/pulp_container_client/models/container_container_distribution.rb +60 -61
  41. data/lib/pulp_container_client/models/{container_container_repository_read.rb → container_container_push_repository.rb} +3 -3
  42. data/lib/pulp_container_client/models/container_content_redirect_content_guard.rb +276 -0
  43. data/lib/pulp_container_client/models/{container_manifest_read.rb → container_manifest.rb} +3 -3
  44. data/lib/pulp_container_client/models/{container_tag_read.rb → container_tag.rb} +3 -3
  45. data/lib/pulp_container_client/models/inline_response200.rb +1 -1
  46. data/lib/pulp_container_client/models/inline_response2001.rb +1 -1
  47. data/lib/pulp_container_client/models/inline_response2002.rb +1 -1
  48. data/lib/pulp_container_client/models/inline_response2003.rb +1 -1
  49. data/lib/pulp_container_client/models/inline_response2004.rb +1 -1
  50. data/lib/pulp_container_client/models/inline_response2005.rb +1 -1
  51. data/lib/pulp_container_client/models/inline_response2006.rb +1 -1
  52. data/lib/pulp_container_client/models/{repository_version_read.rb → inline_response2007.rb} +42 -39
  53. data/lib/pulp_container_client/models/inline_response2008.rb +247 -0
  54. data/lib/pulp_container_client/version.rb +1 -1
  55. data/spec/api/content_blobs_api_spec.rb +1 -1
  56. data/spec/api/content_manifests_api_spec.rb +1 -1
  57. data/spec/api/content_tags_api_spec.rb +1 -1
  58. data/spec/api/contentguards_content_redirect_api_spec.rb +117 -0
  59. data/spec/api/distributions_container_api_spec.rb +2 -2
  60. data/spec/api/remotes_container_api_spec.rb +3 -3
  61. data/spec/api/repositories_container_api_spec.rb +3 -3
  62. data/spec/api/repositories_container_push_api_spec.rb +117 -0
  63. data/spec/api/repositories_container_versions_api_spec.rb +77 -7
  64. data/spec/api/{v2_api_spec.rb → token_api_spec.rb} +7 -7
  65. data/spec/models/{container_blob_read_spec.rb → container_blob_spec.rb} +6 -6
  66. data/spec/models/container_container_distribution_spec.rb +7 -7
  67. data/spec/models/{container_container_repository_read_spec.rb → container_container_push_repository_spec.rb} +6 -6
  68. data/spec/models/{repository_version_read_spec.rb → container_content_redirect_content_guard_spec.rb} +8 -14
  69. data/spec/models/{container_manifest_read_spec.rb → container_manifest_spec.rb} +6 -6
  70. data/spec/models/{container_tag_read_spec.rb → container_tag_spec.rb} +6 -6
  71. data/spec/models/inline_response2007_spec.rb +59 -0
  72. data/spec/models/inline_response2008_spec.rb +59 -0
  73. metadata +42 -50
  74. data/docs/ContainerContainerDistributionRead.md +0 -31
  75. data/docs/ContainerContainerRemoteRead.md +0 -47
  76. data/docs/RepositoryVersionRead.md +0 -25
  77. data/docs/V2BlobsApi.md +0 -63
  78. data/docs/V2CatalogApi.md +0 -64
  79. data/docs/V2ListApi.md +0 -66
  80. data/docs/V2UploadsApi.md +0 -61
  81. data/lib/pulp_container_client/api/v2_blobs_api.rb +0 -88
  82. data/lib/pulp_container_client/api/v2_catalog_api.rb +0 -80
  83. data/lib/pulp_container_client/api/v2_list_api.rb +0 -86
  84. data/lib/pulp_container_client/api/v2_uploads_api.rb +0 -82
  85. data/lib/pulp_container_client/models/container_container_distribution_read.rb +0 -342
  86. data/lib/pulp_container_client/models/container_container_remote_read.rb +0 -578
  87. data/spec/api/v2_blobs_api_spec.rb +0 -48
  88. data/spec/api/v2_catalog_api_spec.rb +0 -47
  89. data/spec/api/v2_list_api_spec.rb +0 -48
  90. data/spec/api/v2_uploads_api_spec.rb +0 -47
  91. data/spec/models/container_container_distribution_read_spec.rb +0 -83
  92. data/spec/models/container_container_remote_read_spec.rb +0 -135
@@ -1,578 +0,0 @@
1
- =begin
2
- #Pulp 3 API
3
-
4
- #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
-
6
- The version of the OpenAPI document: v3
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.3
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module PulpContainerClient
16
- class ContainerContainerRemoteRead
17
- attr_accessor :pulp_href
18
-
19
- # Timestamp of creation.
20
- attr_accessor :pulp_created
21
-
22
- # A unique name for this remote.
23
- attr_accessor :name
24
-
25
- # The URL of an external content source.
26
- attr_accessor :url
27
-
28
- # A string containing the PEM encoded CA certificate used to validate the server certificate presented by the remote server. All new line characters must be escaped.
29
- attr_accessor :ca_cert
30
-
31
- # A string containing the PEM encoded client certificate used for authentication. All new line characters must be escaped.
32
- attr_accessor :client_cert
33
-
34
- # A PEM encoded private key used for authentication.
35
- attr_accessor :client_key
36
-
37
- # If True, TLS peer validation must be performed.
38
- attr_accessor :tls_validation
39
-
40
- # The proxy URL. Format: scheme://user:password@host:port
41
- attr_accessor :proxy_url
42
-
43
- # The username to be used for authentication when syncing.
44
- attr_accessor :username
45
-
46
- # The password to be used for authentication when syncing.
47
- attr_accessor :password
48
-
49
- # Timestamp of the most recent update of the remote.
50
- attr_accessor :pulp_last_updated
51
-
52
- # Total number of simultaneous connections.
53
- attr_accessor :download_concurrency
54
-
55
- # immediate - All manifests and blobs are downloaded and saved during a sync. on_demand - Only tags and manifests are downloaded. Blobs are not downloaded until they are requested for the first time by a client. streamed - Blobs are streamed to the client with every request and never saved.
56
- attr_accessor :policy
57
-
58
- # Name of the upstream repository
59
- attr_accessor :upstream_name
60
-
61
- # A list of whitelisted tags to sync
62
- attr_accessor :whitelist_tags
63
-
64
- class EnumAttributeValidator
65
- attr_reader :datatype
66
- attr_reader :allowable_values
67
-
68
- def initialize(datatype, allowable_values)
69
- @allowable_values = allowable_values.map do |value|
70
- case datatype.to_s
71
- when /Integer/i
72
- value.to_i
73
- when /Float/i
74
- value.to_f
75
- else
76
- value
77
- end
78
- end
79
- end
80
-
81
- def valid?(value)
82
- !value || allowable_values.include?(value)
83
- end
84
- end
85
-
86
- # Attribute mapping from ruby-style variable name to JSON key.
87
- def self.attribute_map
88
- {
89
- :'pulp_href' => :'pulp_href',
90
- :'pulp_created' => :'pulp_created',
91
- :'name' => :'name',
92
- :'url' => :'url',
93
- :'ca_cert' => :'ca_cert',
94
- :'client_cert' => :'client_cert',
95
- :'client_key' => :'client_key',
96
- :'tls_validation' => :'tls_validation',
97
- :'proxy_url' => :'proxy_url',
98
- :'username' => :'username',
99
- :'password' => :'password',
100
- :'pulp_last_updated' => :'pulp_last_updated',
101
- :'download_concurrency' => :'download_concurrency',
102
- :'policy' => :'policy',
103
- :'upstream_name' => :'upstream_name',
104
- :'whitelist_tags' => :'whitelist_tags'
105
- }
106
- end
107
-
108
- # Attribute type mapping.
109
- def self.openapi_types
110
- {
111
- :'pulp_href' => :'String',
112
- :'pulp_created' => :'DateTime',
113
- :'name' => :'String',
114
- :'url' => :'String',
115
- :'ca_cert' => :'String',
116
- :'client_cert' => :'String',
117
- :'client_key' => :'String',
118
- :'tls_validation' => :'Boolean',
119
- :'proxy_url' => :'String',
120
- :'username' => :'String',
121
- :'password' => :'String',
122
- :'pulp_last_updated' => :'DateTime',
123
- :'download_concurrency' => :'Integer',
124
- :'policy' => :'String',
125
- :'upstream_name' => :'String',
126
- :'whitelist_tags' => :'Array<String>'
127
- }
128
- end
129
-
130
- # List of attributes with nullable: true
131
- def self.openapi_nullable
132
- Set.new([
133
- :'ca_cert',
134
- :'client_cert',
135
- :'client_key',
136
- :'proxy_url',
137
- :'username',
138
- :'password',
139
- :'whitelist_tags'
140
- ])
141
- end
142
-
143
- # Initializes the object
144
- # @param [Hash] attributes Model attributes in the form of hash
145
- def initialize(attributes = {})
146
- if (!attributes.is_a?(Hash))
147
- fail ArgumentError, "The input argument (attributes) must be a hash in `PulpContainerClient::ContainerContainerRemoteRead` initialize method"
148
- end
149
-
150
- # check to see if the attribute exists and convert string to symbol for hash key
151
- attributes = attributes.each_with_object({}) { |(k, v), h|
152
- if (!self.class.attribute_map.key?(k.to_sym))
153
- fail ArgumentError, "`#{k}` is not a valid attribute in `PulpContainerClient::ContainerContainerRemoteRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
154
- end
155
- h[k.to_sym] = v
156
- }
157
-
158
- if attributes.key?(:'pulp_href')
159
- self.pulp_href = attributes[:'pulp_href']
160
- end
161
-
162
- if attributes.key?(:'pulp_created')
163
- self.pulp_created = attributes[:'pulp_created']
164
- end
165
-
166
- if attributes.key?(:'name')
167
- self.name = attributes[:'name']
168
- end
169
-
170
- if attributes.key?(:'url')
171
- self.url = attributes[:'url']
172
- end
173
-
174
- if attributes.key?(:'ca_cert')
175
- self.ca_cert = attributes[:'ca_cert']
176
- end
177
-
178
- if attributes.key?(:'client_cert')
179
- self.client_cert = attributes[:'client_cert']
180
- end
181
-
182
- if attributes.key?(:'client_key')
183
- self.client_key = attributes[:'client_key']
184
- end
185
-
186
- if attributes.key?(:'tls_validation')
187
- self.tls_validation = attributes[:'tls_validation']
188
- end
189
-
190
- if attributes.key?(:'proxy_url')
191
- self.proxy_url = attributes[:'proxy_url']
192
- end
193
-
194
- if attributes.key?(:'username')
195
- self.username = attributes[:'username']
196
- end
197
-
198
- if attributes.key?(:'password')
199
- self.password = attributes[:'password']
200
- end
201
-
202
- if attributes.key?(:'pulp_last_updated')
203
- self.pulp_last_updated = attributes[:'pulp_last_updated']
204
- end
205
-
206
- if attributes.key?(:'download_concurrency')
207
- self.download_concurrency = attributes[:'download_concurrency']
208
- end
209
-
210
- if attributes.key?(:'policy')
211
- self.policy = attributes[:'policy']
212
- else
213
- self.policy = 'immediate'
214
- end
215
-
216
- if attributes.key?(:'upstream_name')
217
- self.upstream_name = attributes[:'upstream_name']
218
- end
219
-
220
- if attributes.key?(:'whitelist_tags')
221
- if (value = attributes[:'whitelist_tags']).is_a?(Array)
222
- self.whitelist_tags = value
223
- end
224
- end
225
- end
226
-
227
- # Show invalid properties with the reasons. Usually used together with valid?
228
- # @return Array for valid properties with the reasons
229
- def list_invalid_properties
230
- invalid_properties = Array.new
231
- if @name.nil?
232
- invalid_properties.push('invalid value for "name", name cannot be nil.')
233
- end
234
-
235
- if @name.to_s.length < 1
236
- invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
237
- end
238
-
239
- if @url.nil?
240
- invalid_properties.push('invalid value for "url", url cannot be nil.')
241
- end
242
-
243
- if @url.to_s.length < 1
244
- invalid_properties.push('invalid value for "url", the character length must be great than or equal to 1.')
245
- end
246
-
247
- if !@ca_cert.nil? && @ca_cert.to_s.length < 1
248
- invalid_properties.push('invalid value for "ca_cert", the character length must be great than or equal to 1.')
249
- end
250
-
251
- if !@client_cert.nil? && @client_cert.to_s.length < 1
252
- invalid_properties.push('invalid value for "client_cert", the character length must be great than or equal to 1.')
253
- end
254
-
255
- if !@client_key.nil? && @client_key.to_s.length < 1
256
- invalid_properties.push('invalid value for "client_key", the character length must be great than or equal to 1.')
257
- end
258
-
259
- if !@proxy_url.nil? && @proxy_url.to_s.length < 1
260
- invalid_properties.push('invalid value for "proxy_url", the character length must be great than or equal to 1.')
261
- end
262
-
263
- if !@username.nil? && @username.to_s.length < 1
264
- invalid_properties.push('invalid value for "username", the character length must be great than or equal to 1.')
265
- end
266
-
267
- if !@password.nil? && @password.to_s.length < 1
268
- invalid_properties.push('invalid value for "password", the character length must be great than or equal to 1.')
269
- end
270
-
271
- if !@download_concurrency.nil? && @download_concurrency < 1
272
- invalid_properties.push('invalid value for "download_concurrency", must be greater than or equal to 1.')
273
- end
274
-
275
- if @upstream_name.nil?
276
- invalid_properties.push('invalid value for "upstream_name", upstream_name cannot be nil.')
277
- end
278
-
279
- if @upstream_name.to_s.length < 1
280
- invalid_properties.push('invalid value for "upstream_name", the character length must be great than or equal to 1.')
281
- end
282
-
283
- invalid_properties
284
- end
285
-
286
- # Check to see if the all the properties in the model are valid
287
- # @return true if the model is valid
288
- def valid?
289
- return false if @name.nil?
290
- return false if @name.to_s.length < 1
291
- return false if @url.nil?
292
- return false if @url.to_s.length < 1
293
- return false if !@ca_cert.nil? && @ca_cert.to_s.length < 1
294
- return false if !@client_cert.nil? && @client_cert.to_s.length < 1
295
- return false if !@client_key.nil? && @client_key.to_s.length < 1
296
- return false if !@proxy_url.nil? && @proxy_url.to_s.length < 1
297
- return false if !@username.nil? && @username.to_s.length < 1
298
- return false if !@password.nil? && @password.to_s.length < 1
299
- return false if !@download_concurrency.nil? && @download_concurrency < 1
300
- policy_validator = EnumAttributeValidator.new('String', ["immediate", "on_demand", "streamed"])
301
- return false unless policy_validator.valid?(@policy)
302
- return false if @upstream_name.nil?
303
- return false if @upstream_name.to_s.length < 1
304
- true
305
- end
306
-
307
- # Custom attribute writer method with validation
308
- # @param [Object] name Value to be assigned
309
- def name=(name)
310
- if name.nil?
311
- fail ArgumentError, 'name cannot be nil'
312
- end
313
-
314
- if name.to_s.length < 1
315
- fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
316
- end
317
-
318
- @name = name
319
- end
320
-
321
- # Custom attribute writer method with validation
322
- # @param [Object] url Value to be assigned
323
- def url=(url)
324
- if url.nil?
325
- fail ArgumentError, 'url cannot be nil'
326
- end
327
-
328
- if url.to_s.length < 1
329
- fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.'
330
- end
331
-
332
- @url = url
333
- end
334
-
335
- # Custom attribute writer method with validation
336
- # @param [Object] ca_cert Value to be assigned
337
- def ca_cert=(ca_cert)
338
- if !ca_cert.nil? && ca_cert.to_s.length < 1
339
- fail ArgumentError, 'invalid value for "ca_cert", the character length must be great than or equal to 1.'
340
- end
341
-
342
- @ca_cert = ca_cert
343
- end
344
-
345
- # Custom attribute writer method with validation
346
- # @param [Object] client_cert Value to be assigned
347
- def client_cert=(client_cert)
348
- if !client_cert.nil? && client_cert.to_s.length < 1
349
- fail ArgumentError, 'invalid value for "client_cert", the character length must be great than or equal to 1.'
350
- end
351
-
352
- @client_cert = client_cert
353
- end
354
-
355
- # Custom attribute writer method with validation
356
- # @param [Object] client_key Value to be assigned
357
- def client_key=(client_key)
358
- if !client_key.nil? && client_key.to_s.length < 1
359
- fail ArgumentError, 'invalid value for "client_key", the character length must be great than or equal to 1.'
360
- end
361
-
362
- @client_key = client_key
363
- end
364
-
365
- # Custom attribute writer method with validation
366
- # @param [Object] proxy_url Value to be assigned
367
- def proxy_url=(proxy_url)
368
- if !proxy_url.nil? && proxy_url.to_s.length < 1
369
- fail ArgumentError, 'invalid value for "proxy_url", the character length must be great than or equal to 1.'
370
- end
371
-
372
- @proxy_url = proxy_url
373
- end
374
-
375
- # Custom attribute writer method with validation
376
- # @param [Object] username Value to be assigned
377
- def username=(username)
378
- if !username.nil? && username.to_s.length < 1
379
- fail ArgumentError, 'invalid value for "username", the character length must be great than or equal to 1.'
380
- end
381
-
382
- @username = username
383
- end
384
-
385
- # Custom attribute writer method with validation
386
- # @param [Object] password Value to be assigned
387
- def password=(password)
388
- if !password.nil? && password.to_s.length < 1
389
- fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 1.'
390
- end
391
-
392
- @password = password
393
- end
394
-
395
- # Custom attribute writer method with validation
396
- # @param [Object] download_concurrency Value to be assigned
397
- def download_concurrency=(download_concurrency)
398
- if !download_concurrency.nil? && download_concurrency < 1
399
- fail ArgumentError, 'invalid value for "download_concurrency", must be greater than or equal to 1.'
400
- end
401
-
402
- @download_concurrency = download_concurrency
403
- end
404
-
405
- # Custom attribute writer method checking allowed values (enum).
406
- # @param [Object] policy Object to be assigned
407
- def policy=(policy)
408
- validator = EnumAttributeValidator.new('String', ["immediate", "on_demand", "streamed"])
409
- unless validator.valid?(policy)
410
- fail ArgumentError, "invalid value for \"policy\", must be one of #{validator.allowable_values}."
411
- end
412
- @policy = policy
413
- end
414
-
415
- # Custom attribute writer method with validation
416
- # @param [Object] upstream_name Value to be assigned
417
- def upstream_name=(upstream_name)
418
- if upstream_name.nil?
419
- fail ArgumentError, 'upstream_name cannot be nil'
420
- end
421
-
422
- if upstream_name.to_s.length < 1
423
- fail ArgumentError, 'invalid value for "upstream_name", the character length must be great than or equal to 1.'
424
- end
425
-
426
- @upstream_name = upstream_name
427
- end
428
-
429
- # Checks equality by comparing each attribute.
430
- # @param [Object] Object to be compared
431
- def ==(o)
432
- return true if self.equal?(o)
433
- self.class == o.class &&
434
- pulp_href == o.pulp_href &&
435
- pulp_created == o.pulp_created &&
436
- name == o.name &&
437
- url == o.url &&
438
- ca_cert == o.ca_cert &&
439
- client_cert == o.client_cert &&
440
- client_key == o.client_key &&
441
- tls_validation == o.tls_validation &&
442
- proxy_url == o.proxy_url &&
443
- username == o.username &&
444
- password == o.password &&
445
- pulp_last_updated == o.pulp_last_updated &&
446
- download_concurrency == o.download_concurrency &&
447
- policy == o.policy &&
448
- upstream_name == o.upstream_name &&
449
- whitelist_tags == o.whitelist_tags
450
- end
451
-
452
- # @see the `==` method
453
- # @param [Object] Object to be compared
454
- def eql?(o)
455
- self == o
456
- end
457
-
458
- # Calculates hash code according to all attributes.
459
- # @return [Integer] Hash code
460
- def hash
461
- [pulp_href, pulp_created, name, url, ca_cert, client_cert, client_key, tls_validation, proxy_url, username, password, pulp_last_updated, download_concurrency, policy, upstream_name, whitelist_tags].hash
462
- end
463
-
464
- # Builds the object from hash
465
- # @param [Hash] attributes Model attributes in the form of hash
466
- # @return [Object] Returns the model itself
467
- def self.build_from_hash(attributes)
468
- new.build_from_hash(attributes)
469
- end
470
-
471
- # Builds the object from hash
472
- # @param [Hash] attributes Model attributes in the form of hash
473
- # @return [Object] Returns the model itself
474
- def build_from_hash(attributes)
475
- return nil unless attributes.is_a?(Hash)
476
- self.class.openapi_types.each_pair do |key, type|
477
- if type =~ /\AArray<(.*)>/i
478
- # check to ensure the input is an array given that the attribute
479
- # is documented as an array but the input is not
480
- if attributes[self.class.attribute_map[key]].is_a?(Array)
481
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
482
- end
483
- elsif !attributes[self.class.attribute_map[key]].nil?
484
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
485
- end # or else data not found in attributes(hash), not an issue as the data can be optional
486
- end
487
-
488
- self
489
- end
490
-
491
- # Deserializes the data based on type
492
- # @param string type Data type
493
- # @param string value Value to be deserialized
494
- # @return [Object] Deserialized data
495
- def _deserialize(type, value)
496
- case type.to_sym
497
- when :DateTime
498
- DateTime.parse(value)
499
- when :Date
500
- Date.parse(value)
501
- when :String
502
- value.to_s
503
- when :Integer
504
- value.to_i
505
- when :Float
506
- value.to_f
507
- when :Boolean
508
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
509
- true
510
- else
511
- false
512
- end
513
- when :Object
514
- # generic object (usually a Hash), return directly
515
- value
516
- when /\AArray<(?<inner_type>.+)>\z/
517
- inner_type = Regexp.last_match[:inner_type]
518
- value.map { |v| _deserialize(inner_type, v) }
519
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
520
- k_type = Regexp.last_match[:k_type]
521
- v_type = Regexp.last_match[:v_type]
522
- {}.tap do |hash|
523
- value.each do |k, v|
524
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
525
- end
526
- end
527
- else # model
528
- PulpContainerClient.const_get(type).build_from_hash(value)
529
- end
530
- end
531
-
532
- # Returns the string representation of the object
533
- # @return [String] String presentation of the object
534
- def to_s
535
- to_hash.to_s
536
- end
537
-
538
- # to_body is an alias to to_hash (backward compatibility)
539
- # @return [Hash] Returns the object in the form of hash
540
- def to_body
541
- to_hash
542
- end
543
-
544
- # Returns the object in the form of hash
545
- # @return [Hash] Returns the object in the form of hash
546
- def to_hash
547
- hash = {}
548
- self.class.attribute_map.each_pair do |attr, param|
549
- value = self.send(attr)
550
- if value.nil?
551
- is_nullable = self.class.openapi_nullable.include?(attr)
552
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
553
- end
554
-
555
- hash[param] = _to_hash(value)
556
- end
557
- hash
558
- end
559
-
560
- # Outputs non-array value in the form of hash
561
- # For object, use to_hash. Otherwise, just return the value
562
- # @param [Object] value Any valid value
563
- # @return [Hash] Returns the value in the form of hash
564
- def _to_hash(value)
565
- if value.is_a?(Array)
566
- value.compact.map { |v| _to_hash(v) }
567
- elsif value.is_a?(Hash)
568
- {}.tap do |hash|
569
- value.each { |k, v| hash[k] = _to_hash(v) }
570
- end
571
- elsif value.respond_to? :to_hash
572
- value.to_hash
573
- else
574
- value
575
- end
576
- end
577
- end
578
- end