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,550 @@
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 PythonPythonPackageContentRead
17
+ attr_accessor :pulp_href
18
+
19
+ # Timestamp of creation.
20
+ attr_accessor :pulp_created
21
+
22
+ # Artifact file representing the physical content
23
+ attr_accessor :artifact
24
+
25
+ # The name of the distribution package, usually of the format: {distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.{packagetype}
26
+ attr_accessor :filename
27
+
28
+ # The type of the distribution package (e.g. sdist, bdist_wheel, bdist_egg, etc)
29
+ attr_accessor :packagetype
30
+
31
+ # The name of the python project.
32
+ attr_accessor :name
33
+
34
+ # The packages version number.
35
+ attr_accessor :version
36
+
37
+ # Version of the file format
38
+ attr_accessor :metadata_version
39
+
40
+ # A one-line summary of what the package does.
41
+ attr_accessor :summary
42
+
43
+ # A longer description of the package that can run to several paragraphs.
44
+ attr_accessor :description
45
+
46
+ # Additional keywords to be used to assist searching for the package in a larger catalog.
47
+ attr_accessor :keywords
48
+
49
+ # The URL for the package's home page.
50
+ attr_accessor :home_page
51
+
52
+ # Legacy field denoting the URL from which this package can be downloaded.
53
+ attr_accessor :download_url
54
+
55
+ # Text containing the author's name. Contact information can also be added, separated with newlines.
56
+ attr_accessor :author
57
+
58
+ # The author's e-mail address.
59
+ attr_accessor :author_email
60
+
61
+ # The maintainer's name at a minimum; additional contact information may be provided.
62
+ attr_accessor :maintainer
63
+
64
+ # The maintainer's e-mail address.
65
+ attr_accessor :maintainer_email
66
+
67
+ # Text indicating the license covering the distribution
68
+ attr_accessor :license
69
+
70
+ # The Python version(s) that the distribution is guaranteed to be compatible with.
71
+ attr_accessor :requires_python
72
+
73
+ # A browsable URL for the project and a label for it, separated by a comma.
74
+ attr_accessor :project_url
75
+
76
+ # A comma-separated list of platform specifications, summarizing the operating systems supported by the package.
77
+ attr_accessor :platform
78
+
79
+ # Field to specify the OS and CPU for which the binary package was compiled.
80
+ attr_accessor :supported_platform
81
+
82
+ # A JSON list containing names of some other distutils project required by this distribution.
83
+ attr_accessor :requires_dist
84
+
85
+ # A JSON list containing names of a Distutils project which is contained within this distribution.
86
+ attr_accessor :provides_dist
87
+
88
+ # A JSON list containing names of a distutils project's distribution which this distribution renders obsolete, meaning that the two projects should not be installed at the same time.
89
+ attr_accessor :obsoletes_dist
90
+
91
+ # A JSON list containing some dependency in the system that the distribution is to be used.
92
+ attr_accessor :requires_external
93
+
94
+ # A JSON list containing classification values for a Python package.
95
+ attr_accessor :classifiers
96
+
97
+ # Attribute mapping from ruby-style variable name to JSON key.
98
+ def self.attribute_map
99
+ {
100
+ :'pulp_href' => :'pulp_href',
101
+ :'pulp_created' => :'pulp_created',
102
+ :'artifact' => :'artifact',
103
+ :'filename' => :'filename',
104
+ :'packagetype' => :'packagetype',
105
+ :'name' => :'name',
106
+ :'version' => :'version',
107
+ :'metadata_version' => :'metadata_version',
108
+ :'summary' => :'summary',
109
+ :'description' => :'description',
110
+ :'keywords' => :'keywords',
111
+ :'home_page' => :'home_page',
112
+ :'download_url' => :'download_url',
113
+ :'author' => :'author',
114
+ :'author_email' => :'author_email',
115
+ :'maintainer' => :'maintainer',
116
+ :'maintainer_email' => :'maintainer_email',
117
+ :'license' => :'license',
118
+ :'requires_python' => :'requires_python',
119
+ :'project_url' => :'project_url',
120
+ :'platform' => :'platform',
121
+ :'supported_platform' => :'supported_platform',
122
+ :'requires_dist' => :'requires_dist',
123
+ :'provides_dist' => :'provides_dist',
124
+ :'obsoletes_dist' => :'obsoletes_dist',
125
+ :'requires_external' => :'requires_external',
126
+ :'classifiers' => :'classifiers'
127
+ }
128
+ end
129
+
130
+ # Attribute type mapping.
131
+ def self.openapi_types
132
+ {
133
+ :'pulp_href' => :'String',
134
+ :'pulp_created' => :'DateTime',
135
+ :'artifact' => :'String',
136
+ :'filename' => :'String',
137
+ :'packagetype' => :'String',
138
+ :'name' => :'String',
139
+ :'version' => :'String',
140
+ :'metadata_version' => :'String',
141
+ :'summary' => :'String',
142
+ :'description' => :'String',
143
+ :'keywords' => :'String',
144
+ :'home_page' => :'String',
145
+ :'download_url' => :'String',
146
+ :'author' => :'String',
147
+ :'author_email' => :'String',
148
+ :'maintainer' => :'String',
149
+ :'maintainer_email' => :'String',
150
+ :'license' => :'String',
151
+ :'requires_python' => :'String',
152
+ :'project_url' => :'String',
153
+ :'platform' => :'String',
154
+ :'supported_platform' => :'String',
155
+ :'requires_dist' => :'Object',
156
+ :'provides_dist' => :'Object',
157
+ :'obsoletes_dist' => :'Object',
158
+ :'requires_external' => :'Object',
159
+ :'classifiers' => :'Object'
160
+ }
161
+ end
162
+
163
+ # List of attributes with nullable: true
164
+ def self.openapi_nullable
165
+ Set.new([
166
+ ])
167
+ end
168
+
169
+ # Initializes the object
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ def initialize(attributes = {})
172
+ if (!attributes.is_a?(Hash))
173
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpPythonClient::PythonPythonPackageContentRead` initialize method"
174
+ end
175
+
176
+ # check to see if the attribute exists and convert string to symbol for hash key
177
+ attributes = attributes.each_with_object({}) { |(k, v), h|
178
+ if (!self.class.attribute_map.key?(k.to_sym))
179
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpPythonClient::PythonPythonPackageContentRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
180
+ end
181
+ h[k.to_sym] = v
182
+ }
183
+
184
+ if attributes.key?(:'pulp_href')
185
+ self.pulp_href = attributes[:'pulp_href']
186
+ end
187
+
188
+ if attributes.key?(:'pulp_created')
189
+ self.pulp_created = attributes[:'pulp_created']
190
+ end
191
+
192
+ if attributes.key?(:'artifact')
193
+ self.artifact = attributes[:'artifact']
194
+ end
195
+
196
+ if attributes.key?(:'filename')
197
+ self.filename = attributes[:'filename']
198
+ end
199
+
200
+ if attributes.key?(:'packagetype')
201
+ self.packagetype = attributes[:'packagetype']
202
+ end
203
+
204
+ if attributes.key?(:'name')
205
+ self.name = attributes[:'name']
206
+ end
207
+
208
+ if attributes.key?(:'version')
209
+ self.version = attributes[:'version']
210
+ end
211
+
212
+ if attributes.key?(:'metadata_version')
213
+ self.metadata_version = attributes[:'metadata_version']
214
+ end
215
+
216
+ if attributes.key?(:'summary')
217
+ self.summary = attributes[:'summary']
218
+ end
219
+
220
+ if attributes.key?(:'description')
221
+ self.description = attributes[:'description']
222
+ end
223
+
224
+ if attributes.key?(:'keywords')
225
+ self.keywords = attributes[:'keywords']
226
+ end
227
+
228
+ if attributes.key?(:'home_page')
229
+ self.home_page = attributes[:'home_page']
230
+ end
231
+
232
+ if attributes.key?(:'download_url')
233
+ self.download_url = attributes[:'download_url']
234
+ end
235
+
236
+ if attributes.key?(:'author')
237
+ self.author = attributes[:'author']
238
+ end
239
+
240
+ if attributes.key?(:'author_email')
241
+ self.author_email = attributes[:'author_email']
242
+ end
243
+
244
+ if attributes.key?(:'maintainer')
245
+ self.maintainer = attributes[:'maintainer']
246
+ end
247
+
248
+ if attributes.key?(:'maintainer_email')
249
+ self.maintainer_email = attributes[:'maintainer_email']
250
+ end
251
+
252
+ if attributes.key?(:'license')
253
+ self.license = attributes[:'license']
254
+ end
255
+
256
+ if attributes.key?(:'requires_python')
257
+ self.requires_python = attributes[:'requires_python']
258
+ end
259
+
260
+ if attributes.key?(:'project_url')
261
+ self.project_url = attributes[:'project_url']
262
+ end
263
+
264
+ if attributes.key?(:'platform')
265
+ self.platform = attributes[:'platform']
266
+ end
267
+
268
+ if attributes.key?(:'supported_platform')
269
+ self.supported_platform = attributes[:'supported_platform']
270
+ end
271
+
272
+ if attributes.key?(:'requires_dist')
273
+ self.requires_dist = attributes[:'requires_dist']
274
+ end
275
+
276
+ if attributes.key?(:'provides_dist')
277
+ self.provides_dist = attributes[:'provides_dist']
278
+ end
279
+
280
+ if attributes.key?(:'obsoletes_dist')
281
+ self.obsoletes_dist = attributes[:'obsoletes_dist']
282
+ end
283
+
284
+ if attributes.key?(:'requires_external')
285
+ self.requires_external = attributes[:'requires_external']
286
+ end
287
+
288
+ if attributes.key?(:'classifiers')
289
+ self.classifiers = attributes[:'classifiers']
290
+ end
291
+ end
292
+
293
+ # Show invalid properties with the reasons. Usually used together with valid?
294
+ # @return Array for valid properties with the reasons
295
+ def list_invalid_properties
296
+ invalid_properties = Array.new
297
+ if @filename.nil?
298
+ invalid_properties.push('invalid value for "filename", filename cannot be nil.')
299
+ end
300
+
301
+ if @filename.to_s.length < 1
302
+ invalid_properties.push('invalid value for "filename", the character length must be great than or equal to 1.')
303
+ end
304
+
305
+ if !@packagetype.nil? && @packagetype.to_s.length < 1
306
+ invalid_properties.push('invalid value for "packagetype", the character length must be great than or equal to 1.')
307
+ end
308
+
309
+ if !@name.nil? && @name.to_s.length < 1
310
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
311
+ end
312
+
313
+ if !@version.nil? && @version.to_s.length < 1
314
+ invalid_properties.push('invalid value for "version", the character length must be great than or equal to 1.')
315
+ end
316
+
317
+ if !@metadata_version.nil? && @metadata_version.to_s.length < 1
318
+ invalid_properties.push('invalid value for "metadata_version", the character length must be great than or equal to 1.')
319
+ end
320
+
321
+ invalid_properties
322
+ end
323
+
324
+ # Check to see if the all the properties in the model are valid
325
+ # @return true if the model is valid
326
+ def valid?
327
+ return false if @filename.nil?
328
+ return false if @filename.to_s.length < 1
329
+ return false if !@packagetype.nil? && @packagetype.to_s.length < 1
330
+ return false if !@name.nil? && @name.to_s.length < 1
331
+ return false if !@version.nil? && @version.to_s.length < 1
332
+ return false if !@metadata_version.nil? && @metadata_version.to_s.length < 1
333
+ true
334
+ end
335
+
336
+ # Custom attribute writer method with validation
337
+ # @param [Object] filename Value to be assigned
338
+ def filename=(filename)
339
+ if filename.nil?
340
+ fail ArgumentError, 'filename cannot be nil'
341
+ end
342
+
343
+ if filename.to_s.length < 1
344
+ fail ArgumentError, 'invalid value for "filename", the character length must be great than or equal to 1.'
345
+ end
346
+
347
+ @filename = filename
348
+ end
349
+
350
+ # Custom attribute writer method with validation
351
+ # @param [Object] packagetype Value to be assigned
352
+ def packagetype=(packagetype)
353
+ if !packagetype.nil? && packagetype.to_s.length < 1
354
+ fail ArgumentError, 'invalid value for "packagetype", the character length must be great than or equal to 1.'
355
+ end
356
+
357
+ @packagetype = packagetype
358
+ end
359
+
360
+ # Custom attribute writer method with validation
361
+ # @param [Object] name Value to be assigned
362
+ def name=(name)
363
+ if !name.nil? && name.to_s.length < 1
364
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
365
+ end
366
+
367
+ @name = name
368
+ end
369
+
370
+ # Custom attribute writer method with validation
371
+ # @param [Object] version Value to be assigned
372
+ def version=(version)
373
+ if !version.nil? && version.to_s.length < 1
374
+ fail ArgumentError, 'invalid value for "version", the character length must be great than or equal to 1.'
375
+ end
376
+
377
+ @version = version
378
+ end
379
+
380
+ # Custom attribute writer method with validation
381
+ # @param [Object] metadata_version Value to be assigned
382
+ def metadata_version=(metadata_version)
383
+ if !metadata_version.nil? && metadata_version.to_s.length < 1
384
+ fail ArgumentError, 'invalid value for "metadata_version", the character length must be great than or equal to 1.'
385
+ end
386
+
387
+ @metadata_version = metadata_version
388
+ end
389
+
390
+ # Checks equality by comparing each attribute.
391
+ # @param [Object] Object to be compared
392
+ def ==(o)
393
+ return true if self.equal?(o)
394
+ self.class == o.class &&
395
+ pulp_href == o.pulp_href &&
396
+ pulp_created == o.pulp_created &&
397
+ artifact == o.artifact &&
398
+ filename == o.filename &&
399
+ packagetype == o.packagetype &&
400
+ name == o.name &&
401
+ version == o.version &&
402
+ metadata_version == o.metadata_version &&
403
+ summary == o.summary &&
404
+ description == o.description &&
405
+ keywords == o.keywords &&
406
+ home_page == o.home_page &&
407
+ download_url == o.download_url &&
408
+ author == o.author &&
409
+ author_email == o.author_email &&
410
+ maintainer == o.maintainer &&
411
+ maintainer_email == o.maintainer_email &&
412
+ license == o.license &&
413
+ requires_python == o.requires_python &&
414
+ project_url == o.project_url &&
415
+ platform == o.platform &&
416
+ supported_platform == o.supported_platform &&
417
+ requires_dist == o.requires_dist &&
418
+ provides_dist == o.provides_dist &&
419
+ obsoletes_dist == o.obsoletes_dist &&
420
+ requires_external == o.requires_external &&
421
+ classifiers == o.classifiers
422
+ end
423
+
424
+ # @see the `==` method
425
+ # @param [Object] Object to be compared
426
+ def eql?(o)
427
+ self == o
428
+ end
429
+
430
+ # Calculates hash code according to all attributes.
431
+ # @return [Integer] Hash code
432
+ def hash
433
+ [pulp_href, pulp_created, artifact, filename, packagetype, name, version, metadata_version, summary, description, keywords, home_page, download_url, author, author_email, maintainer, maintainer_email, license, requires_python, project_url, platform, supported_platform, requires_dist, provides_dist, obsoletes_dist, requires_external, classifiers].hash
434
+ end
435
+
436
+ # Builds the object from hash
437
+ # @param [Hash] attributes Model attributes in the form of hash
438
+ # @return [Object] Returns the model itself
439
+ def self.build_from_hash(attributes)
440
+ new.build_from_hash(attributes)
441
+ end
442
+
443
+ # Builds the object from hash
444
+ # @param [Hash] attributes Model attributes in the form of hash
445
+ # @return [Object] Returns the model itself
446
+ def build_from_hash(attributes)
447
+ return nil unless attributes.is_a?(Hash)
448
+ self.class.openapi_types.each_pair do |key, type|
449
+ if type =~ /\AArray<(.*)>/i
450
+ # check to ensure the input is an array given that the attribute
451
+ # is documented as an array but the input is not
452
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
453
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
454
+ end
455
+ elsif !attributes[self.class.attribute_map[key]].nil?
456
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
457
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
458
+ end
459
+
460
+ self
461
+ end
462
+
463
+ # Deserializes the data based on type
464
+ # @param string type Data type
465
+ # @param string value Value to be deserialized
466
+ # @return [Object] Deserialized data
467
+ def _deserialize(type, value)
468
+ case type.to_sym
469
+ when :DateTime
470
+ DateTime.parse(value)
471
+ when :Date
472
+ Date.parse(value)
473
+ when :String
474
+ value.to_s
475
+ when :Integer
476
+ value.to_i
477
+ when :Float
478
+ value.to_f
479
+ when :Boolean
480
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
481
+ true
482
+ else
483
+ false
484
+ end
485
+ when :Object
486
+ # generic object (usually a Hash), return directly
487
+ value
488
+ when /\AArray<(?<inner_type>.+)>\z/
489
+ inner_type = Regexp.last_match[:inner_type]
490
+ value.map { |v| _deserialize(inner_type, v) }
491
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
492
+ k_type = Regexp.last_match[:k_type]
493
+ v_type = Regexp.last_match[:v_type]
494
+ {}.tap do |hash|
495
+ value.each do |k, v|
496
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
497
+ end
498
+ end
499
+ else # model
500
+ PulpPythonClient.const_get(type).build_from_hash(value)
501
+ end
502
+ end
503
+
504
+ # Returns the string representation of the object
505
+ # @return [String] String presentation of the object
506
+ def to_s
507
+ to_hash.to_s
508
+ end
509
+
510
+ # to_body is an alias to to_hash (backward compatibility)
511
+ # @return [Hash] Returns the object in the form of hash
512
+ def to_body
513
+ to_hash
514
+ end
515
+
516
+ # Returns the object in the form of hash
517
+ # @return [Hash] Returns the object in the form of hash
518
+ def to_hash
519
+ hash = {}
520
+ self.class.attribute_map.each_pair do |attr, param|
521
+ value = self.send(attr)
522
+ if value.nil?
523
+ is_nullable = self.class.openapi_nullable.include?(attr)
524
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
525
+ end
526
+
527
+ hash[param] = _to_hash(value)
528
+ end
529
+ hash
530
+ end
531
+
532
+ # Outputs non-array value in the form of hash
533
+ # For object, use to_hash. Otherwise, just return the value
534
+ # @param [Object] value Any valid value
535
+ # @return [Hash] Returns the value in the form of hash
536
+ def _to_hash(value)
537
+ if value.is_a?(Array)
538
+ value.compact.map { |v| _to_hash(v) }
539
+ elsif value.is_a?(Hash)
540
+ {}.tap do |hash|
541
+ value.each { |k, v| hash[k] = _to_hash(v) }
542
+ end
543
+ elsif value.respond_to? :to_hash
544
+ value.to_hash
545
+ else
546
+ value
547
+ end
548
+ end
549
+ end
550
+ end