pulp_python_client 3.0.0b9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +175 -0
  4. data/Rakefile +10 -0
  5. data/docs/AsyncOperationResponse.md +17 -0
  6. data/docs/ContentPackagesApi.md +262 -0
  7. data/docs/ContentSummary.md +21 -0
  8. data/docs/DistributionsPypiApi.md +364 -0
  9. data/docs/InlineResponse200.md +23 -0
  10. data/docs/InlineResponse2001.md +23 -0
  11. data/docs/InlineResponse2002.md +23 -0
  12. data/docs/InlineResponse2003.md +23 -0
  13. data/docs/InlineResponse2004.md +23 -0
  14. data/docs/InlineResponse2005.md +23 -0
  15. data/docs/ProjectSpecifier.md +19 -0
  16. data/docs/PublicationsPypiApi.md +253 -0
  17. data/docs/PythonPythonDistribution.md +29 -0
  18. data/docs/PythonPythonDistributionRead.md +29 -0
  19. data/docs/PythonPythonPackageContentRead.md +69 -0
  20. data/docs/PythonPythonPublication.md +25 -0
  21. data/docs/PythonPythonPublicationRead.md +25 -0
  22. data/docs/PythonPythonRemote.md +49 -0
  23. data/docs/PythonPythonRemoteRead.md +49 -0
  24. data/docs/PythonPythonRepository.md +27 -0
  25. data/docs/PythonPythonRepositoryRead.md +27 -0
  26. data/docs/RemotesPythonApi.md +368 -0
  27. data/docs/RepositoriesPythonApi.md +468 -0
  28. data/docs/RepositoriesPythonVersionsApi.md +269 -0
  29. data/docs/RepositoryAddRemoveContent.md +21 -0
  30. data/docs/RepositorySyncURL.md +19 -0
  31. data/docs/RepositoryVersion.md +25 -0
  32. data/docs/RepositoryVersionRead.md +25 -0
  33. data/git_push.sh +58 -0
  34. data/lib/pulp_python_client.rb +67 -0
  35. data/lib/pulp_python_client/api/content_packages_api.rb +349 -0
  36. data/lib/pulp_python_client/api/distributions_pypi_api.rb +445 -0
  37. data/lib/pulp_python_client/api/publications_pypi_api.rb +306 -0
  38. data/lib/pulp_python_client/api/remotes_python_api.rb +451 -0
  39. data/lib/pulp_python_client/api/repositories_python_api.rb +573 -0
  40. data/lib/pulp_python_client/api/repositories_python_versions_api.rb +336 -0
  41. data/lib/pulp_python_client/api_client.rb +402 -0
  42. data/lib/pulp_python_client/api_error.rb +57 -0
  43. data/lib/pulp_python_client/configuration.rb +243 -0
  44. data/lib/pulp_python_client/models/async_operation_response.rb +212 -0
  45. data/lib/pulp_python_client/models/content_summary.rb +246 -0
  46. data/lib/pulp_python_client/models/inline_response200.rb +247 -0
  47. data/lib/pulp_python_client/models/inline_response2001.rb +247 -0
  48. data/lib/pulp_python_client/models/inline_response2002.rb +247 -0
  49. data/lib/pulp_python_client/models/inline_response2003.rb +247 -0
  50. data/lib/pulp_python_client/models/inline_response2004.rb +247 -0
  51. data/lib/pulp_python_client/models/inline_response2005.rb +247 -0
  52. data/lib/pulp_python_client/models/project_specifier.rb +242 -0
  53. data/lib/pulp_python_client/models/python_python_distribution.rb +331 -0
  54. data/lib/pulp_python_client/models/python_python_distribution_read.rb +331 -0
  55. data/lib/pulp_python_client/models/python_python_package_content_read.rb +550 -0
  56. data/lib/pulp_python_client/models/python_python_publication.rb +247 -0
  57. data/lib/pulp_python_client/models/python_python_publication_read.rb +247 -0
  58. data/lib/pulp_python_client/models/python_python_remote.rb +565 -0
  59. data/lib/pulp_python_client/models/python_python_remote_read.rb +565 -0
  60. data/lib/pulp_python_client/models/python_python_repository.rb +294 -0
  61. data/lib/pulp_python_client/models/python_python_repository_read.rb +294 -0
  62. data/lib/pulp_python_client/models/repository_add_remove_content.rb +231 -0
  63. data/lib/pulp_python_client/models/repository_sync_url.rb +224 -0
  64. data/lib/pulp_python_client/models/repository_version.rb +244 -0
  65. data/lib/pulp_python_client/models/repository_version_read.rb +244 -0
  66. data/lib/pulp_python_client/version.rb +15 -0
  67. data/pulp_python_client.gemspec +39 -0
  68. data/spec/api/content_packages_api_spec.rb +114 -0
  69. data/spec/api/distributions_pypi_api_spec.rb +121 -0
  70. data/spec/api/publications_pypi_api_spec.rb +96 -0
  71. data/spec/api/remotes_python_api_spec.rb +123 -0
  72. data/spec/api/repositories_python_api_spec.rb +143 -0
  73. data/spec/api/repositories_python_versions_api_spec.rb +103 -0
  74. data/spec/api_client_spec.rb +188 -0
  75. data/spec/configuration_spec.rb +42 -0
  76. data/spec/models/async_operation_response_spec.rb +41 -0
  77. data/spec/models/content_summary_spec.rb +53 -0
  78. data/spec/models/inline_response2001_spec.rb +59 -0
  79. data/spec/models/inline_response2002_spec.rb +59 -0
  80. data/spec/models/inline_response2003_spec.rb +59 -0
  81. data/spec/models/inline_response2004_spec.rb +59 -0
  82. data/spec/models/inline_response2005_spec.rb +59 -0
  83. data/spec/models/inline_response200_spec.rb +59 -0
  84. data/spec/models/project_specifier_spec.rb +47 -0
  85. data/spec/models/python_python_distribution_read_spec.rb +77 -0
  86. data/spec/models/python_python_distribution_spec.rb +77 -0
  87. data/spec/models/python_python_package_content_read_spec.rb +197 -0
  88. data/spec/models/python_python_publication_read_spec.rb +65 -0
  89. data/spec/models/python_python_publication_spec.rb +65 -0
  90. data/spec/models/python_python_remote_read_spec.rb +141 -0
  91. data/spec/models/python_python_remote_spec.rb +141 -0
  92. data/spec/models/python_python_repository_read_spec.rb +71 -0
  93. data/spec/models/python_python_repository_spec.rb +71 -0
  94. data/spec/models/repository_add_remove_content_spec.rb +53 -0
  95. data/spec/models/repository_sync_url_spec.rb +47 -0
  96. data/spec/models/repository_version_read_spec.rb +65 -0
  97. data/spec/models/repository_version_spec.rb +65 -0
  98. data/spec/spec_helper.rb +111 -0
  99. metadata +225 -0
@@ -0,0 +1,565 @@
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 PulpPythonClient
16
+ class PythonPythonRemoteRead
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
+ # The policy to use when downloading content. The possible values include: 'immediate', 'on_demand', and 'cache_only'. 'immediate' is the default.
56
+ attr_accessor :policy
57
+
58
+ # AKA \"Whitelist\". A list of dictionaries, expand for more information. Example: [{\"name\": \"django\", \"version_specifier\":\"~=2.0\"}]
59
+ attr_accessor :includes
60
+
61
+ # \"AKA \"Blacklist\". A list of dictionaries, expand for more information. Example: [{\"name\": \"django\", \"version_specifier\":\"~=2.0\"}]
62
+ attr_accessor :excludes
63
+
64
+ # Whether or not to include pre-release packages in the sync.
65
+ attr_accessor :prereleases
66
+
67
+ class EnumAttributeValidator
68
+ attr_reader :datatype
69
+ attr_reader :allowable_values
70
+
71
+ def initialize(datatype, allowable_values)
72
+ @allowable_values = allowable_values.map do |value|
73
+ case datatype.to_s
74
+ when /Integer/i
75
+ value.to_i
76
+ when /Float/i
77
+ value.to_f
78
+ else
79
+ value
80
+ end
81
+ end
82
+ end
83
+
84
+ def valid?(value)
85
+ !value || allowable_values.include?(value)
86
+ end
87
+ end
88
+
89
+ # Attribute mapping from ruby-style variable name to JSON key.
90
+ def self.attribute_map
91
+ {
92
+ :'pulp_href' => :'pulp_href',
93
+ :'pulp_created' => :'pulp_created',
94
+ :'name' => :'name',
95
+ :'url' => :'url',
96
+ :'ca_cert' => :'ca_cert',
97
+ :'client_cert' => :'client_cert',
98
+ :'client_key' => :'client_key',
99
+ :'tls_validation' => :'tls_validation',
100
+ :'proxy_url' => :'proxy_url',
101
+ :'username' => :'username',
102
+ :'password' => :'password',
103
+ :'pulp_last_updated' => :'pulp_last_updated',
104
+ :'download_concurrency' => :'download_concurrency',
105
+ :'policy' => :'policy',
106
+ :'includes' => :'includes',
107
+ :'excludes' => :'excludes',
108
+ :'prereleases' => :'prereleases'
109
+ }
110
+ end
111
+
112
+ # Attribute type mapping.
113
+ def self.openapi_types
114
+ {
115
+ :'pulp_href' => :'String',
116
+ :'pulp_created' => :'DateTime',
117
+ :'name' => :'String',
118
+ :'url' => :'String',
119
+ :'ca_cert' => :'String',
120
+ :'client_cert' => :'String',
121
+ :'client_key' => :'String',
122
+ :'tls_validation' => :'Boolean',
123
+ :'proxy_url' => :'String',
124
+ :'username' => :'String',
125
+ :'password' => :'String',
126
+ :'pulp_last_updated' => :'DateTime',
127
+ :'download_concurrency' => :'Integer',
128
+ :'policy' => :'String',
129
+ :'includes' => :'Array<ProjectSpecifier>',
130
+ :'excludes' => :'Array<ProjectSpecifier>',
131
+ :'prereleases' => :'Boolean'
132
+ }
133
+ end
134
+
135
+ # List of attributes with nullable: true
136
+ def self.openapi_nullable
137
+ Set.new([
138
+ :'ca_cert',
139
+ :'client_cert',
140
+ :'client_key',
141
+ :'proxy_url',
142
+ :'username',
143
+ :'password',
144
+ ])
145
+ end
146
+
147
+ # Initializes the object
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ def initialize(attributes = {})
150
+ if (!attributes.is_a?(Hash))
151
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpPythonClient::PythonPythonRemoteRead` initialize method"
152
+ end
153
+
154
+ # check to see if the attribute exists and convert string to symbol for hash key
155
+ attributes = attributes.each_with_object({}) { |(k, v), h|
156
+ if (!self.class.attribute_map.key?(k.to_sym))
157
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpPythonClient::PythonPythonRemoteRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
158
+ end
159
+ h[k.to_sym] = v
160
+ }
161
+
162
+ if attributes.key?(:'pulp_href')
163
+ self.pulp_href = attributes[:'pulp_href']
164
+ end
165
+
166
+ if attributes.key?(:'pulp_created')
167
+ self.pulp_created = attributes[:'pulp_created']
168
+ end
169
+
170
+ if attributes.key?(:'name')
171
+ self.name = attributes[:'name']
172
+ end
173
+
174
+ if attributes.key?(:'url')
175
+ self.url = attributes[:'url']
176
+ end
177
+
178
+ if attributes.key?(:'ca_cert')
179
+ self.ca_cert = attributes[:'ca_cert']
180
+ end
181
+
182
+ if attributes.key?(:'client_cert')
183
+ self.client_cert = attributes[:'client_cert']
184
+ end
185
+
186
+ if attributes.key?(:'client_key')
187
+ self.client_key = attributes[:'client_key']
188
+ end
189
+
190
+ if attributes.key?(:'tls_validation')
191
+ self.tls_validation = attributes[:'tls_validation']
192
+ end
193
+
194
+ if attributes.key?(:'proxy_url')
195
+ self.proxy_url = attributes[:'proxy_url']
196
+ end
197
+
198
+ if attributes.key?(:'username')
199
+ self.username = attributes[:'username']
200
+ end
201
+
202
+ if attributes.key?(:'password')
203
+ self.password = attributes[:'password']
204
+ end
205
+
206
+ if attributes.key?(:'pulp_last_updated')
207
+ self.pulp_last_updated = attributes[:'pulp_last_updated']
208
+ end
209
+
210
+ if attributes.key?(:'download_concurrency')
211
+ self.download_concurrency = attributes[:'download_concurrency']
212
+ end
213
+
214
+ if attributes.key?(:'policy')
215
+ self.policy = attributes[:'policy']
216
+ else
217
+ self.policy = 'immediate'
218
+ end
219
+
220
+ if attributes.key?(:'includes')
221
+ if (value = attributes[:'includes']).is_a?(Array)
222
+ self.includes = value
223
+ end
224
+ end
225
+
226
+ if attributes.key?(:'excludes')
227
+ if (value = attributes[:'excludes']).is_a?(Array)
228
+ self.excludes = value
229
+ end
230
+ end
231
+
232
+ if attributes.key?(:'prereleases')
233
+ self.prereleases = attributes[:'prereleases']
234
+ end
235
+ end
236
+
237
+ # Show invalid properties with the reasons. Usually used together with valid?
238
+ # @return Array for valid properties with the reasons
239
+ def list_invalid_properties
240
+ invalid_properties = Array.new
241
+ if @name.nil?
242
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
243
+ end
244
+
245
+ if @name.to_s.length < 1
246
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
247
+ end
248
+
249
+ if @url.nil?
250
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
251
+ end
252
+
253
+ if @url.to_s.length < 1
254
+ invalid_properties.push('invalid value for "url", the character length must be great than or equal to 1.')
255
+ end
256
+
257
+ if !@ca_cert.nil? && @ca_cert.to_s.length < 1
258
+ invalid_properties.push('invalid value for "ca_cert", the character length must be great than or equal to 1.')
259
+ end
260
+
261
+ if !@client_cert.nil? && @client_cert.to_s.length < 1
262
+ invalid_properties.push('invalid value for "client_cert", the character length must be great than or equal to 1.')
263
+ end
264
+
265
+ if !@client_key.nil? && @client_key.to_s.length < 1
266
+ invalid_properties.push('invalid value for "client_key", the character length must be great than or equal to 1.')
267
+ end
268
+
269
+ if !@proxy_url.nil? && @proxy_url.to_s.length < 1
270
+ invalid_properties.push('invalid value for "proxy_url", the character length must be great than or equal to 1.')
271
+ end
272
+
273
+ if !@username.nil? && @username.to_s.length < 1
274
+ invalid_properties.push('invalid value for "username", the character length must be great than or equal to 1.')
275
+ end
276
+
277
+ if !@password.nil? && @password.to_s.length < 1
278
+ invalid_properties.push('invalid value for "password", the character length must be great than or equal to 1.')
279
+ end
280
+
281
+ if !@download_concurrency.nil? && @download_concurrency < 1
282
+ invalid_properties.push('invalid value for "download_concurrency", must be greater than or equal to 1.')
283
+ end
284
+
285
+ invalid_properties
286
+ end
287
+
288
+ # Check to see if the all the properties in the model are valid
289
+ # @return true if the model is valid
290
+ def valid?
291
+ return false if @name.nil?
292
+ return false if @name.to_s.length < 1
293
+ return false if @url.nil?
294
+ return false if @url.to_s.length < 1
295
+ return false if !@ca_cert.nil? && @ca_cert.to_s.length < 1
296
+ return false if !@client_cert.nil? && @client_cert.to_s.length < 1
297
+ return false if !@client_key.nil? && @client_key.to_s.length < 1
298
+ return false if !@proxy_url.nil? && @proxy_url.to_s.length < 1
299
+ return false if !@username.nil? && @username.to_s.length < 1
300
+ return false if !@password.nil? && @password.to_s.length < 1
301
+ return false if !@download_concurrency.nil? && @download_concurrency < 1
302
+ policy_validator = EnumAttributeValidator.new('String', ["immediate", "on_demand", "streamed"])
303
+ return false unless policy_validator.valid?(@policy)
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
+ # Checks equality by comparing each attribute.
416
+ # @param [Object] Object to be compared
417
+ def ==(o)
418
+ return true if self.equal?(o)
419
+ self.class == o.class &&
420
+ pulp_href == o.pulp_href &&
421
+ pulp_created == o.pulp_created &&
422
+ name == o.name &&
423
+ url == o.url &&
424
+ ca_cert == o.ca_cert &&
425
+ client_cert == o.client_cert &&
426
+ client_key == o.client_key &&
427
+ tls_validation == o.tls_validation &&
428
+ proxy_url == o.proxy_url &&
429
+ username == o.username &&
430
+ password == o.password &&
431
+ pulp_last_updated == o.pulp_last_updated &&
432
+ download_concurrency == o.download_concurrency &&
433
+ policy == o.policy &&
434
+ includes == o.includes &&
435
+ excludes == o.excludes &&
436
+ prereleases == o.prereleases
437
+ end
438
+
439
+ # @see the `==` method
440
+ # @param [Object] Object to be compared
441
+ def eql?(o)
442
+ self == o
443
+ end
444
+
445
+ # Calculates hash code according to all attributes.
446
+ # @return [Integer] Hash code
447
+ def hash
448
+ [pulp_href, pulp_created, name, url, ca_cert, client_cert, client_key, tls_validation, proxy_url, username, password, pulp_last_updated, download_concurrency, policy, includes, excludes, prereleases].hash
449
+ end
450
+
451
+ # Builds the object from hash
452
+ # @param [Hash] attributes Model attributes in the form of hash
453
+ # @return [Object] Returns the model itself
454
+ def self.build_from_hash(attributes)
455
+ new.build_from_hash(attributes)
456
+ end
457
+
458
+ # Builds the object from hash
459
+ # @param [Hash] attributes Model attributes in the form of hash
460
+ # @return [Object] Returns the model itself
461
+ def build_from_hash(attributes)
462
+ return nil unless attributes.is_a?(Hash)
463
+ self.class.openapi_types.each_pair do |key, type|
464
+ if type =~ /\AArray<(.*)>/i
465
+ # check to ensure the input is an array given that the attribute
466
+ # is documented as an array but the input is not
467
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
468
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
469
+ end
470
+ elsif !attributes[self.class.attribute_map[key]].nil?
471
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
472
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
473
+ end
474
+
475
+ self
476
+ end
477
+
478
+ # Deserializes the data based on type
479
+ # @param string type Data type
480
+ # @param string value Value to be deserialized
481
+ # @return [Object] Deserialized data
482
+ def _deserialize(type, value)
483
+ case type.to_sym
484
+ when :DateTime
485
+ DateTime.parse(value)
486
+ when :Date
487
+ Date.parse(value)
488
+ when :String
489
+ value.to_s
490
+ when :Integer
491
+ value.to_i
492
+ when :Float
493
+ value.to_f
494
+ when :Boolean
495
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
496
+ true
497
+ else
498
+ false
499
+ end
500
+ when :Object
501
+ # generic object (usually a Hash), return directly
502
+ value
503
+ when /\AArray<(?<inner_type>.+)>\z/
504
+ inner_type = Regexp.last_match[:inner_type]
505
+ value.map { |v| _deserialize(inner_type, v) }
506
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
507
+ k_type = Regexp.last_match[:k_type]
508
+ v_type = Regexp.last_match[:v_type]
509
+ {}.tap do |hash|
510
+ value.each do |k, v|
511
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
512
+ end
513
+ end
514
+ else # model
515
+ PulpPythonClient.const_get(type).build_from_hash(value)
516
+ end
517
+ end
518
+
519
+ # Returns the string representation of the object
520
+ # @return [String] String presentation of the object
521
+ def to_s
522
+ to_hash.to_s
523
+ end
524
+
525
+ # to_body is an alias to to_hash (backward compatibility)
526
+ # @return [Hash] Returns the object in the form of hash
527
+ def to_body
528
+ to_hash
529
+ end
530
+
531
+ # Returns the object in the form of hash
532
+ # @return [Hash] Returns the object in the form of hash
533
+ def to_hash
534
+ hash = {}
535
+ self.class.attribute_map.each_pair do |attr, param|
536
+ value = self.send(attr)
537
+ if value.nil?
538
+ is_nullable = self.class.openapi_nullable.include?(attr)
539
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
540
+ end
541
+
542
+ hash[param] = _to_hash(value)
543
+ end
544
+ hash
545
+ end
546
+
547
+ # Outputs non-array value in the form of hash
548
+ # For object, use to_hash. Otherwise, just return the value
549
+ # @param [Object] value Any valid value
550
+ # @return [Hash] Returns the value in the form of hash
551
+ def _to_hash(value)
552
+ if value.is_a?(Array)
553
+ value.compact.map { |v| _to_hash(v) }
554
+ elsif value.is_a?(Hash)
555
+ {}.tap do |hash|
556
+ value.each { |k, v| hash[k] = _to_hash(v) }
557
+ end
558
+ elsif value.respond_to? :to_hash
559
+ value.to_hash
560
+ else
561
+ value
562
+ end
563
+ end
564
+ end
565
+ end