pulp_deb_client 2.0.0b2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +163 -0
  4. data/Rakefile +10 -0
  5. data/docs/AsyncOperationResponse.md +17 -0
  6. data/docs/ContentGenericContentsApi.md +194 -0
  7. data/docs/ContentInstallerFileIndexApi.md +186 -0
  8. data/docs/ContentInstallerPackagesApi.md +194 -0
  9. data/docs/ContentPackageIndexApi.md +186 -0
  10. data/docs/ContentPackagesApi.md +194 -0
  11. data/docs/ContentReleasesApi.md +186 -0
  12. data/docs/DebDistribution.md +29 -0
  13. data/docs/DebPublication.md +31 -0
  14. data/docs/DebRemote.md +57 -0
  15. data/docs/DistributionsAptApi.md +358 -0
  16. data/docs/GenericContent.md +41 -0
  17. data/docs/InlineResponse200.md +23 -0
  18. data/docs/InlineResponse2001.md +23 -0
  19. data/docs/InlineResponse2002.md +23 -0
  20. data/docs/InlineResponse2003.md +23 -0
  21. data/docs/InlineResponse2004.md +23 -0
  22. data/docs/InlineResponse2005.md +23 -0
  23. data/docs/InlineResponse2006.md +23 -0
  24. data/docs/InlineResponse2007.md +23 -0
  25. data/docs/InlineResponse2008.md +23 -0
  26. data/docs/InlineResponse2009.md +23 -0
  27. data/docs/InstallerFileIndex.md +31 -0
  28. data/docs/InstallerPackage.md +99 -0
  29. data/docs/Package.md +99 -0
  30. data/docs/PackageIndex.md +31 -0
  31. data/docs/PublicationsAptApi.md +235 -0
  32. data/docs/PublicationsVerbatimApi.md +235 -0
  33. data/docs/Release.md +31 -0
  34. data/docs/RemotesAptApi.md +417 -0
  35. data/docs/RepositorySyncURL.md +19 -0
  36. data/docs/VerbatimPublication.md +27 -0
  37. data/git_push.sh +58 -0
  38. data/lib/pulp_deb_client/api/content_generic_contents_api.rb +239 -0
  39. data/lib/pulp_deb_client/api/content_installer_file_index_api.rb +225 -0
  40. data/lib/pulp_deb_client/api/content_installer_packages_api.rb +235 -0
  41. data/lib/pulp_deb_client/api/content_package_index_api.rb +225 -0
  42. data/lib/pulp_deb_client/api/content_packages_api.rb +235 -0
  43. data/lib/pulp_deb_client/api/content_releases_api.rb +225 -0
  44. data/lib/pulp_deb_client/api/distributions_apt_api.rb +436 -0
  45. data/lib/pulp_deb_client/api/publications_apt_api.rb +279 -0
  46. data/lib/pulp_deb_client/api/publications_verbatim_api.rb +279 -0
  47. data/lib/pulp_deb_client/api/remotes_apt_api.rb +510 -0
  48. data/lib/pulp_deb_client/api_client.rb +402 -0
  49. data/lib/pulp_deb_client/api_error.rb +57 -0
  50. data/lib/pulp_deb_client/configuration.rb +243 -0
  51. data/lib/pulp_deb_client/models/async_operation_response.rb +202 -0
  52. data/lib/pulp_deb_client/models/deb_distribution.rb +337 -0
  53. data/lib/pulp_deb_client/models/deb_publication.rb +282 -0
  54. data/lib/pulp_deb_client/models/deb_remote.rb +653 -0
  55. data/lib/pulp_deb_client/models/generic_content.rb +444 -0
  56. data/lib/pulp_deb_client/models/inline_response200.rb +235 -0
  57. data/lib/pulp_deb_client/models/inline_response2001.rb +235 -0
  58. data/lib/pulp_deb_client/models/inline_response2002.rb +235 -0
  59. data/lib/pulp_deb_client/models/inline_response2003.rb +235 -0
  60. data/lib/pulp_deb_client/models/inline_response2004.rb +235 -0
  61. data/lib/pulp_deb_client/models/inline_response2005.rb +235 -0
  62. data/lib/pulp_deb_client/models/inline_response2006.rb +235 -0
  63. data/lib/pulp_deb_client/models/inline_response2007.rb +235 -0
  64. data/lib/pulp_deb_client/models/inline_response2008.rb +235 -0
  65. data/lib/pulp_deb_client/models/inline_response2009.rb +235 -0
  66. data/lib/pulp_deb_client/models/installer_file_index.rb +355 -0
  67. data/lib/pulp_deb_client/models/installer_package.rb +1101 -0
  68. data/lib/pulp_deb_client/models/package.rb +1101 -0
  69. data/lib/pulp_deb_client/models/package_index.rb +355 -0
  70. data/lib/pulp_deb_client/models/release.rb +356 -0
  71. data/lib/pulp_deb_client/models/repository_sync_url.rb +214 -0
  72. data/lib/pulp_deb_client/models/verbatim_publication.rb +258 -0
  73. data/lib/pulp_deb_client/version.rb +15 -0
  74. data/lib/pulp_deb_client.rb +71 -0
  75. data/pulp_deb_client.gemspec +39 -0
  76. data/spec/api/content_generic_contents_api_spec.rb +80 -0
  77. data/spec/api/content_installer_file_index_api_spec.rb +77 -0
  78. data/spec/api/content_installer_packages_api_spec.rb +80 -0
  79. data/spec/api/content_package_index_api_spec.rb +77 -0
  80. data/spec/api/content_packages_api_spec.rb +80 -0
  81. data/spec/api/content_releases_api_spec.rb +77 -0
  82. data/spec/api/distributions_apt_api_spec.rb +118 -0
  83. data/spec/api/publications_apt_api_spec.rb +87 -0
  84. data/spec/api/publications_verbatim_api_spec.rb +87 -0
  85. data/spec/api/remotes_apt_api_spec.rb +132 -0
  86. data/spec/api_client_spec.rb +188 -0
  87. data/spec/configuration_spec.rb +42 -0
  88. data/spec/models/async_operation_response_spec.rb +41 -0
  89. data/spec/models/deb_distribution_spec.rb +77 -0
  90. data/spec/models/deb_publication_spec.rb +83 -0
  91. data/spec/models/deb_remote_spec.rb +165 -0
  92. data/spec/models/generic_content_spec.rb +113 -0
  93. data/spec/models/inline_response2001_spec.rb +59 -0
  94. data/spec/models/inline_response2002_spec.rb +59 -0
  95. data/spec/models/inline_response2003_spec.rb +59 -0
  96. data/spec/models/inline_response2004_spec.rb +59 -0
  97. data/spec/models/inline_response2005_spec.rb +59 -0
  98. data/spec/models/inline_response2006_spec.rb +59 -0
  99. data/spec/models/inline_response2007_spec.rb +59 -0
  100. data/spec/models/inline_response2008_spec.rb +59 -0
  101. data/spec/models/inline_response2009_spec.rb +59 -0
  102. data/spec/models/inline_response200_spec.rb +59 -0
  103. data/spec/models/installer_file_index_spec.rb +83 -0
  104. data/spec/models/installer_package_spec.rb +287 -0
  105. data/spec/models/package_index_spec.rb +83 -0
  106. data/spec/models/package_spec.rb +287 -0
  107. data/spec/models/release_spec.rb +83 -0
  108. data/spec/models/repository_sync_url_spec.rb +47 -0
  109. data/spec/models/verbatim_publication_spec.rb +71 -0
  110. data/spec/spec_helper.rb +111 -0
  111. metadata +242 -0
@@ -0,0 +1,444 @@
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.1.3-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpDebClient
16
+ class GenericContent
17
+ attr_accessor :_href
18
+
19
+ # Timestamp of creation.
20
+ attr_accessor :_created
21
+
22
+ attr_accessor :_type
23
+
24
+ # Artifact file representing the physical content
25
+ attr_accessor :artifact
26
+
27
+ # Path where the artifact is located relative to distributions base_path
28
+ attr_accessor :relative_path
29
+
30
+ # An uploaded file that should be turned into the artifact of the content unit.
31
+ attr_accessor :file
32
+
33
+ # A URI of a repository the new content unit should be associated with.
34
+ attr_accessor :repository
35
+
36
+ # The MD5 checksum if available.
37
+ attr_accessor :md5
38
+
39
+ # The SHA-1 checksum if available.
40
+ attr_accessor :sha1
41
+
42
+ # The SHA-224 checksum if available.
43
+ attr_accessor :sha224
44
+
45
+ # The SHA-256 checksum if available.
46
+ attr_accessor :sha256
47
+
48
+ # The SHA-384 checksum if available.
49
+ attr_accessor :sha384
50
+
51
+ # The SHA-512 checksum if available.
52
+ attr_accessor :sha512
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'_href' => :'_href',
58
+ :'_created' => :'_created',
59
+ :'_type' => :'_type',
60
+ :'artifact' => :'artifact',
61
+ :'relative_path' => :'relative_path',
62
+ :'file' => :'file',
63
+ :'repository' => :'repository',
64
+ :'md5' => :'md5',
65
+ :'sha1' => :'sha1',
66
+ :'sha224' => :'sha224',
67
+ :'sha256' => :'sha256',
68
+ :'sha384' => :'sha384',
69
+ :'sha512' => :'sha512'
70
+ }
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'_href' => :'String',
77
+ :'_created' => :'DateTime',
78
+ :'_type' => :'String',
79
+ :'artifact' => :'String',
80
+ :'relative_path' => :'String',
81
+ :'file' => :'String',
82
+ :'repository' => :'String',
83
+ :'md5' => :'String',
84
+ :'sha1' => :'String',
85
+ :'sha224' => :'String',
86
+ :'sha256' => :'String',
87
+ :'sha384' => :'String',
88
+ :'sha512' => :'String'
89
+ }
90
+ end
91
+
92
+ # Initializes the object
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ def initialize(attributes = {})
95
+ if (!attributes.is_a?(Hash))
96
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpDebClient::GenericContent` initialize method"
97
+ end
98
+
99
+ # check to see if the attribute exists and convert string to symbol for hash key
100
+ attributes = attributes.each_with_object({}) { |(k, v), h|
101
+ if (!self.class.attribute_map.key?(k.to_sym))
102
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpDebClient::GenericContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
103
+ end
104
+ h[k.to_sym] = v
105
+ }
106
+
107
+ if attributes.key?(:'_href')
108
+ self._href = attributes[:'_href']
109
+ end
110
+
111
+ if attributes.key?(:'_created')
112
+ self._created = attributes[:'_created']
113
+ end
114
+
115
+ if attributes.key?(:'_type')
116
+ self._type = attributes[:'_type']
117
+ end
118
+
119
+ if attributes.key?(:'artifact')
120
+ self.artifact = attributes[:'artifact']
121
+ end
122
+
123
+ if attributes.key?(:'relative_path')
124
+ self.relative_path = attributes[:'relative_path']
125
+ end
126
+
127
+ if attributes.key?(:'file')
128
+ self.file = attributes[:'file']
129
+ end
130
+
131
+ if attributes.key?(:'repository')
132
+ self.repository = attributes[:'repository']
133
+ end
134
+
135
+ if attributes.key?(:'md5')
136
+ self.md5 = attributes[:'md5']
137
+ end
138
+
139
+ if attributes.key?(:'sha1')
140
+ self.sha1 = attributes[:'sha1']
141
+ end
142
+
143
+ if attributes.key?(:'sha224')
144
+ self.sha224 = attributes[:'sha224']
145
+ end
146
+
147
+ if attributes.key?(:'sha256')
148
+ self.sha256 = attributes[:'sha256']
149
+ end
150
+
151
+ if attributes.key?(:'sha384')
152
+ self.sha384 = attributes[:'sha384']
153
+ end
154
+
155
+ if attributes.key?(:'sha512')
156
+ self.sha512 = attributes[:'sha512']
157
+ end
158
+ end
159
+
160
+ # Show invalid properties with the reasons. Usually used together with valid?
161
+ # @return Array for valid properties with the reasons
162
+ def list_invalid_properties
163
+ invalid_properties = Array.new
164
+ if !@_type.nil? && @_type.to_s.length < 1
165
+ invalid_properties.push('invalid value for "_type", the character length must be great than or equal to 1.')
166
+ end
167
+
168
+ if @relative_path.nil?
169
+ invalid_properties.push('invalid value for "relative_path", relative_path cannot be nil.')
170
+ end
171
+
172
+ if @relative_path.to_s.length < 1
173
+ invalid_properties.push('invalid value for "relative_path", the character length must be great than or equal to 1.')
174
+ end
175
+
176
+ if !@md5.nil? && @md5.to_s.length < 1
177
+ invalid_properties.push('invalid value for "md5", the character length must be great than or equal to 1.')
178
+ end
179
+
180
+ if !@sha1.nil? && @sha1.to_s.length < 1
181
+ invalid_properties.push('invalid value for "sha1", the character length must be great than or equal to 1.')
182
+ end
183
+
184
+ if !@sha224.nil? && @sha224.to_s.length < 1
185
+ invalid_properties.push('invalid value for "sha224", the character length must be great than or equal to 1.')
186
+ end
187
+
188
+ if !@sha256.nil? && @sha256.to_s.length < 1
189
+ invalid_properties.push('invalid value for "sha256", the character length must be great than or equal to 1.')
190
+ end
191
+
192
+ if !@sha384.nil? && @sha384.to_s.length < 1
193
+ invalid_properties.push('invalid value for "sha384", the character length must be great than or equal to 1.')
194
+ end
195
+
196
+ if !@sha512.nil? && @sha512.to_s.length < 1
197
+ invalid_properties.push('invalid value for "sha512", the character length must be great than or equal to 1.')
198
+ end
199
+
200
+ invalid_properties
201
+ end
202
+
203
+ # Check to see if the all the properties in the model are valid
204
+ # @return true if the model is valid
205
+ def valid?
206
+ return false if !@_type.nil? && @_type.to_s.length < 1
207
+ return false if @relative_path.nil?
208
+ return false if @relative_path.to_s.length < 1
209
+ return false if !@md5.nil? && @md5.to_s.length < 1
210
+ return false if !@sha1.nil? && @sha1.to_s.length < 1
211
+ return false if !@sha224.nil? && @sha224.to_s.length < 1
212
+ return false if !@sha256.nil? && @sha256.to_s.length < 1
213
+ return false if !@sha384.nil? && @sha384.to_s.length < 1
214
+ return false if !@sha512.nil? && @sha512.to_s.length < 1
215
+ true
216
+ end
217
+
218
+ # Custom attribute writer method with validation
219
+ # @param [Object] _type Value to be assigned
220
+ def _type=(_type)
221
+ if !_type.nil? && _type.to_s.length < 1
222
+ fail ArgumentError, 'invalid value for "_type", the character length must be great than or equal to 1.'
223
+ end
224
+
225
+ @_type = _type
226
+ end
227
+
228
+ # Custom attribute writer method with validation
229
+ # @param [Object] relative_path Value to be assigned
230
+ def relative_path=(relative_path)
231
+ if relative_path.nil?
232
+ fail ArgumentError, 'relative_path cannot be nil'
233
+ end
234
+
235
+ if relative_path.to_s.length < 1
236
+ fail ArgumentError, 'invalid value for "relative_path", the character length must be great than or equal to 1.'
237
+ end
238
+
239
+ @relative_path = relative_path
240
+ end
241
+
242
+ # Custom attribute writer method with validation
243
+ # @param [Object] md5 Value to be assigned
244
+ def md5=(md5)
245
+ if !md5.nil? && md5.to_s.length < 1
246
+ fail ArgumentError, 'invalid value for "md5", the character length must be great than or equal to 1.'
247
+ end
248
+
249
+ @md5 = md5
250
+ end
251
+
252
+ # Custom attribute writer method with validation
253
+ # @param [Object] sha1 Value to be assigned
254
+ def sha1=(sha1)
255
+ if !sha1.nil? && sha1.to_s.length < 1
256
+ fail ArgumentError, 'invalid value for "sha1", the character length must be great than or equal to 1.'
257
+ end
258
+
259
+ @sha1 = sha1
260
+ end
261
+
262
+ # Custom attribute writer method with validation
263
+ # @param [Object] sha224 Value to be assigned
264
+ def sha224=(sha224)
265
+ if !sha224.nil? && sha224.to_s.length < 1
266
+ fail ArgumentError, 'invalid value for "sha224", the character length must be great than or equal to 1.'
267
+ end
268
+
269
+ @sha224 = sha224
270
+ end
271
+
272
+ # Custom attribute writer method with validation
273
+ # @param [Object] sha256 Value to be assigned
274
+ def sha256=(sha256)
275
+ if !sha256.nil? && sha256.to_s.length < 1
276
+ fail ArgumentError, 'invalid value for "sha256", the character length must be great than or equal to 1.'
277
+ end
278
+
279
+ @sha256 = sha256
280
+ end
281
+
282
+ # Custom attribute writer method with validation
283
+ # @param [Object] sha384 Value to be assigned
284
+ def sha384=(sha384)
285
+ if !sha384.nil? && sha384.to_s.length < 1
286
+ fail ArgumentError, 'invalid value for "sha384", the character length must be great than or equal to 1.'
287
+ end
288
+
289
+ @sha384 = sha384
290
+ end
291
+
292
+ # Custom attribute writer method with validation
293
+ # @param [Object] sha512 Value to be assigned
294
+ def sha512=(sha512)
295
+ if !sha512.nil? && sha512.to_s.length < 1
296
+ fail ArgumentError, 'invalid value for "sha512", the character length must be great than or equal to 1.'
297
+ end
298
+
299
+ @sha512 = sha512
300
+ end
301
+
302
+ # Checks equality by comparing each attribute.
303
+ # @param [Object] Object to be compared
304
+ def ==(o)
305
+ return true if self.equal?(o)
306
+ self.class == o.class &&
307
+ _href == o._href &&
308
+ _created == o._created &&
309
+ _type == o._type &&
310
+ artifact == o.artifact &&
311
+ relative_path == o.relative_path &&
312
+ file == o.file &&
313
+ repository == o.repository &&
314
+ md5 == o.md5 &&
315
+ sha1 == o.sha1 &&
316
+ sha224 == o.sha224 &&
317
+ sha256 == o.sha256 &&
318
+ sha384 == o.sha384 &&
319
+ sha512 == o.sha512
320
+ end
321
+
322
+ # @see the `==` method
323
+ # @param [Object] Object to be compared
324
+ def eql?(o)
325
+ self == o
326
+ end
327
+
328
+ # Calculates hash code according to all attributes.
329
+ # @return [Integer] Hash code
330
+ def hash
331
+ [_href, _created, _type, artifact, relative_path, file, repository, md5, sha1, sha224, sha256, sha384, sha512].hash
332
+ end
333
+
334
+ # Builds the object from hash
335
+ # @param [Hash] attributes Model attributes in the form of hash
336
+ # @return [Object] Returns the model itself
337
+ def self.build_from_hash(attributes)
338
+ new.build_from_hash(attributes)
339
+ end
340
+
341
+ # Builds the object from hash
342
+ # @param [Hash] attributes Model attributes in the form of hash
343
+ # @return [Object] Returns the model itself
344
+ def build_from_hash(attributes)
345
+ return nil unless attributes.is_a?(Hash)
346
+ self.class.openapi_types.each_pair do |key, type|
347
+ if type =~ /\AArray<(.*)>/i
348
+ # check to ensure the input is an array given that the attribute
349
+ # is documented as an array but the input is not
350
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
351
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
352
+ end
353
+ elsif !attributes[self.class.attribute_map[key]].nil?
354
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
355
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
356
+ end
357
+
358
+ self
359
+ end
360
+
361
+ # Deserializes the data based on type
362
+ # @param string type Data type
363
+ # @param string value Value to be deserialized
364
+ # @return [Object] Deserialized data
365
+ def _deserialize(type, value)
366
+ case type.to_sym
367
+ when :DateTime
368
+ DateTime.parse(value)
369
+ when :Date
370
+ Date.parse(value)
371
+ when :String
372
+ value.to_s
373
+ when :Integer
374
+ value.to_i
375
+ when :Float
376
+ value.to_f
377
+ when :Boolean
378
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
379
+ true
380
+ else
381
+ false
382
+ end
383
+ when :Object
384
+ # generic object (usually a Hash), return directly
385
+ value
386
+ when /\AArray<(?<inner_type>.+)>\z/
387
+ inner_type = Regexp.last_match[:inner_type]
388
+ value.map { |v| _deserialize(inner_type, v) }
389
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
390
+ k_type = Regexp.last_match[:k_type]
391
+ v_type = Regexp.last_match[:v_type]
392
+ {}.tap do |hash|
393
+ value.each do |k, v|
394
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
395
+ end
396
+ end
397
+ else # model
398
+ PulpDebClient.const_get(type).build_from_hash(value)
399
+ end
400
+ end
401
+
402
+ # Returns the string representation of the object
403
+ # @return [String] String presentation of the object
404
+ def to_s
405
+ to_hash.to_s
406
+ end
407
+
408
+ # to_body is an alias to to_hash (backward compatibility)
409
+ # @return [Hash] Returns the object in the form of hash
410
+ def to_body
411
+ to_hash
412
+ end
413
+
414
+ # Returns the object in the form of hash
415
+ # @return [Hash] Returns the object in the form of hash
416
+ def to_hash
417
+ hash = {}
418
+ self.class.attribute_map.each_pair do |attr, param|
419
+ value = self.send(attr)
420
+ next if value.nil?
421
+ hash[param] = _to_hash(value)
422
+ end
423
+ hash
424
+ end
425
+
426
+ # Outputs non-array value in the form of hash
427
+ # For object, use to_hash. Otherwise, just return the value
428
+ # @param [Object] value Any valid value
429
+ # @return [Hash] Returns the value in the form of hash
430
+ def _to_hash(value)
431
+ if value.is_a?(Array)
432
+ value.compact.map { |v| _to_hash(v) }
433
+ elsif value.is_a?(Hash)
434
+ {}.tap do |hash|
435
+ value.each { |k, v| hash[k] = _to_hash(v) }
436
+ end
437
+ elsif value.respond_to? :to_hash
438
+ value.to_hash
439
+ else
440
+ value
441
+ end
442
+ end
443
+ end
444
+ end
@@ -0,0 +1,235 @@
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.1.3-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpDebClient
16
+ class InlineResponse200
17
+ attr_accessor :count
18
+
19
+ attr_accessor :_next
20
+
21
+ attr_accessor :previous
22
+
23
+ attr_accessor :results
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'count' => :'count',
29
+ :'_next' => :'next',
30
+ :'previous' => :'previous',
31
+ :'results' => :'results'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'count' => :'Integer',
39
+ :'_next' => :'String',
40
+ :'previous' => :'String',
41
+ :'results' => :'Array<GenericContent>'
42
+ }
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpDebClient::InlineResponse200` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpDebClient::InlineResponse200`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'count')
61
+ self.count = attributes[:'count']
62
+ end
63
+
64
+ if attributes.key?(:'_next')
65
+ self._next = attributes[:'_next']
66
+ end
67
+
68
+ if attributes.key?(:'previous')
69
+ self.previous = attributes[:'previous']
70
+ end
71
+
72
+ if attributes.key?(:'results')
73
+ if (value = attributes[:'results']).is_a?(Array)
74
+ self.results = value
75
+ end
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ if @count.nil?
84
+ invalid_properties.push('invalid value for "count", count cannot be nil.')
85
+ end
86
+
87
+ if @results.nil?
88
+ invalid_properties.push('invalid value for "results", results cannot be nil.')
89
+ end
90
+
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ return false if @count.nil?
98
+ return false if @results.nil?
99
+ true
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(o)
105
+ return true if self.equal?(o)
106
+ self.class == o.class &&
107
+ count == o.count &&
108
+ _next == o._next &&
109
+ previous == o.previous &&
110
+ results == o.results
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [count, _next, previous, results].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ new.build_from_hash(attributes)
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ self.class.openapi_types.each_pair do |key, type|
138
+ if type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
143
+ end
144
+ elsif !attributes[self.class.attribute_map[key]].nil?
145
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
147
+ end
148
+
149
+ self
150
+ end
151
+
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
156
+ def _deserialize(type, value)
157
+ case type.to_sym
158
+ when :DateTime
159
+ DateTime.parse(value)
160
+ when :Date
161
+ Date.parse(value)
162
+ when :String
163
+ value.to_s
164
+ when :Integer
165
+ value.to_i
166
+ when :Float
167
+ value.to_f
168
+ when :Boolean
169
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
170
+ true
171
+ else
172
+ false
173
+ end
174
+ when :Object
175
+ # generic object (usually a Hash), return directly
176
+ value
177
+ when /\AArray<(?<inner_type>.+)>\z/
178
+ inner_type = Regexp.last_match[:inner_type]
179
+ value.map { |v| _deserialize(inner_type, v) }
180
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
181
+ k_type = Regexp.last_match[:k_type]
182
+ v_type = Regexp.last_match[:v_type]
183
+ {}.tap do |hash|
184
+ value.each do |k, v|
185
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
186
+ end
187
+ end
188
+ else # model
189
+ PulpDebClient.const_get(type).build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ next if value.nil?
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+ end
235
+ end