pulp_rpm_client 3.0.0b4 → 3.0.0b5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -6
  3. data/docs/Addon.md +27 -0
  4. data/docs/Artifact.md +35 -0
  5. data/docs/Checksum.md +19 -0
  6. data/docs/ContentAdvisoriesApi.md +12 -6
  7. data/docs/ContentPackagesApi.md +12 -6
  8. data/docs/DistributionTree.md +53 -0
  9. data/docs/DistributionTreesDistributionTreesApi.md +179 -0
  10. data/docs/DistributionsRpmApi.md +14 -8
  11. data/docs/Image.md +23 -0
  12. data/docs/InlineResponse200.md +3 -3
  13. data/docs/InlineResponse2001.md +3 -3
  14. data/docs/InlineResponse2002.md +4 -4
  15. data/docs/InlineResponse2003.md +4 -4
  16. data/docs/InlineResponse2004.md +4 -4
  17. data/docs/InlineResponse2005.md +23 -0
  18. data/docs/InlineResponse2006.md +23 -0
  19. data/docs/Package.md +10 -8
  20. data/docs/PublicationsRpmApi.md +14 -8
  21. data/docs/RemotesRpmApi.md +14 -8
  22. data/docs/RepoMetadataFile.md +31 -0
  23. data/docs/RepoMetadataFilesRepoMetadataFilesApi.md +179 -0
  24. data/docs/Variant.md +37 -0
  25. data/git_push.sh +10 -7
  26. data/lib/pulp_rpm_client/api/content_advisories_api.rb +15 -9
  27. data/lib/pulp_rpm_client/api/content_packages_api.rb +15 -9
  28. data/lib/pulp_rpm_client/api/distribution_trees_distribution_trees_api.rb +212 -0
  29. data/lib/pulp_rpm_client/api/distributions_rpm_api.rb +21 -15
  30. data/lib/pulp_rpm_client/api/publications_rpm_api.rb +19 -13
  31. data/lib/pulp_rpm_client/api/remotes_rpm_api.rb +22 -16
  32. data/lib/pulp_rpm_client/api/repo_metadata_files_repo_metadata_files_api.rb +212 -0
  33. data/lib/pulp_rpm_client/api/rpm_copy_api.rb +2 -2
  34. data/lib/pulp_rpm_client/api/rpm_upload_api.rb +2 -2
  35. data/lib/pulp_rpm_client/api_client.rb +77 -62
  36. data/lib/pulp_rpm_client/api_error.rb +1 -1
  37. data/lib/pulp_rpm_client/configuration.rb +13 -21
  38. data/lib/pulp_rpm_client/models/addon.rb +372 -0
  39. data/lib/pulp_rpm_client/models/artifact.rb +376 -0
  40. data/lib/pulp_rpm_client/models/async_operation_response.rb +1 -1
  41. data/lib/pulp_rpm_client/models/checksum.rb +255 -0
  42. data/lib/pulp_rpm_client/models/distribution_tree.rb +660 -0
  43. data/lib/pulp_rpm_client/models/image.rb +303 -0
  44. data/lib/pulp_rpm_client/models/inline_response200.rb +11 -11
  45. data/lib/pulp_rpm_client/models/inline_response2001.rb +11 -11
  46. data/lib/pulp_rpm_client/models/inline_response2002.rb +12 -12
  47. data/lib/pulp_rpm_client/models/inline_response2003.rb +12 -12
  48. data/lib/pulp_rpm_client/models/inline_response2004.rb +12 -12
  49. data/lib/pulp_rpm_client/models/inline_response2005.rb +235 -0
  50. data/lib/pulp_rpm_client/models/inline_response2006.rb +235 -0
  51. data/lib/pulp_rpm_client/models/package.rb +69 -40
  52. data/lib/pulp_rpm_client/models/repo_metadata_file.rb +381 -0
  53. data/lib/pulp_rpm_client/models/repository_sync_url.rb +1 -1
  54. data/lib/pulp_rpm_client/models/rpm_distribution.rb +1 -1
  55. data/lib/pulp_rpm_client/models/rpm_publication.rb +1 -1
  56. data/lib/pulp_rpm_client/models/rpm_remote.rb +1 -1
  57. data/lib/pulp_rpm_client/models/update_record.rb +1 -1
  58. data/lib/pulp_rpm_client/models/variant.rb +542 -0
  59. data/lib/pulp_rpm_client/version.rb +2 -2
  60. data/lib/pulp_rpm_client.rb +12 -1
  61. data/pulp_rpm_client.gemspec +3 -9
  62. data/spec/api/content_advisories_api_spec.rb +5 -3
  63. data/spec/api/content_packages_api_spec.rb +5 -3
  64. data/spec/api/distribution_trees_distribution_trees_api_spec.rb +74 -0
  65. data/spec/api/distributions_rpm_api_spec.rb +6 -4
  66. data/spec/api/publications_rpm_api_spec.rb +6 -4
  67. data/spec/api/remotes_rpm_api_spec.rb +6 -4
  68. data/spec/api/repo_metadata_files_repo_metadata_files_api_spec.rb +74 -0
  69. data/spec/api/rpm_copy_api_spec.rb +1 -1
  70. data/spec/api/rpm_upload_api_spec.rb +1 -1
  71. data/spec/api_client_spec.rb +1 -39
  72. data/spec/configuration_spec.rb +1 -1
  73. data/spec/models/addon_spec.rb +71 -0
  74. data/spec/models/artifact_spec.rb +95 -0
  75. data/spec/models/async_operation_response_spec.rb +1 -1
  76. data/spec/models/checksum_spec.rb +47 -0
  77. data/spec/models/distribution_tree_spec.rb +149 -0
  78. data/spec/models/image_spec.rb +59 -0
  79. data/spec/models/inline_response2001_spec.rb +4 -4
  80. data/spec/models/inline_response2002_spec.rb +4 -4
  81. data/spec/models/inline_response2003_spec.rb +4 -4
  82. data/spec/models/inline_response2004_spec.rb +4 -4
  83. data/spec/models/inline_response2005_spec.rb +59 -0
  84. data/spec/models/inline_response2006_spec.rb +59 -0
  85. data/spec/models/inline_response200_spec.rb +4 -4
  86. data/spec/models/package_spec.rb +16 -10
  87. data/spec/models/repo_metadata_file_spec.rb +83 -0
  88. data/spec/models/repository_sync_url_spec.rb +1 -1
  89. data/spec/models/rpm_distribution_spec.rb +1 -1
  90. data/spec/models/rpm_publication_spec.rb +1 -1
  91. data/spec/models/rpm_remote_spec.rb +1 -1
  92. data/spec/models/update_record_spec.rb +1 -1
  93. data/spec/models/variant_spec.rb +101 -0
  94. data/spec/spec_helper.rb +1 -1
  95. metadata +50 -133
  96. data/Gemfile.lock +0 -79
@@ -0,0 +1,376 @@
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 PulpRpmClient
16
+ class Artifact
17
+ attr_accessor :_href
18
+
19
+ # Timestamp of creation.
20
+ attr_accessor :_created
21
+
22
+ # The stored file.
23
+ attr_accessor :file
24
+
25
+ # The size of the file in bytes.
26
+ attr_accessor :size
27
+
28
+ # The MD5 checksum of the file if available.
29
+ attr_accessor :md5
30
+
31
+ # The SHA-1 checksum of the file if available.
32
+ attr_accessor :sha1
33
+
34
+ # The SHA-224 checksum of the file if available.
35
+ attr_accessor :sha224
36
+
37
+ # The SHA-256 checksum of the file if available.
38
+ attr_accessor :sha256
39
+
40
+ # The SHA-384 checksum of the file if available.
41
+ attr_accessor :sha384
42
+
43
+ # The SHA-512 checksum of the file if available.
44
+ attr_accessor :sha512
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'_href' => :'_href',
50
+ :'_created' => :'_created',
51
+ :'file' => :'file',
52
+ :'size' => :'size',
53
+ :'md5' => :'md5',
54
+ :'sha1' => :'sha1',
55
+ :'sha224' => :'sha224',
56
+ :'sha256' => :'sha256',
57
+ :'sha384' => :'sha384',
58
+ :'sha512' => :'sha512'
59
+ }
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'_href' => :'String',
66
+ :'_created' => :'DateTime',
67
+ :'file' => :'String',
68
+ :'size' => :'Integer',
69
+ :'md5' => :'String',
70
+ :'sha1' => :'String',
71
+ :'sha224' => :'String',
72
+ :'sha256' => :'String',
73
+ :'sha384' => :'String',
74
+ :'sha512' => :'String'
75
+ }
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ if (!attributes.is_a?(Hash))
82
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpRpmClient::Artifact` initialize method"
83
+ end
84
+
85
+ # check to see if the attribute exists and convert string to symbol for hash key
86
+ attributes = attributes.each_with_object({}) { |(k, v), h|
87
+ if (!self.class.attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpRpmClient::Artifact`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
89
+ end
90
+ h[k.to_sym] = v
91
+ }
92
+
93
+ if attributes.key?(:'_href')
94
+ self._href = attributes[:'_href']
95
+ end
96
+
97
+ if attributes.key?(:'_created')
98
+ self._created = attributes[:'_created']
99
+ end
100
+
101
+ if attributes.key?(:'file')
102
+ self.file = attributes[:'file']
103
+ end
104
+
105
+ if attributes.key?(:'size')
106
+ self.size = attributes[:'size']
107
+ end
108
+
109
+ if attributes.key?(:'md5')
110
+ self.md5 = attributes[:'md5']
111
+ end
112
+
113
+ if attributes.key?(:'sha1')
114
+ self.sha1 = attributes[:'sha1']
115
+ end
116
+
117
+ if attributes.key?(:'sha224')
118
+ self.sha224 = attributes[:'sha224']
119
+ end
120
+
121
+ if attributes.key?(:'sha256')
122
+ self.sha256 = attributes[:'sha256']
123
+ end
124
+
125
+ if attributes.key?(:'sha384')
126
+ self.sha384 = attributes[:'sha384']
127
+ end
128
+
129
+ if attributes.key?(:'sha512')
130
+ self.sha512 = attributes[:'sha512']
131
+ end
132
+ end
133
+
134
+ # Show invalid properties with the reasons. Usually used together with valid?
135
+ # @return Array for valid properties with the reasons
136
+ def list_invalid_properties
137
+ invalid_properties = Array.new
138
+ if !@md5.nil? && @md5.to_s.length < 1
139
+ invalid_properties.push('invalid value for "md5", the character length must be great than or equal to 1.')
140
+ end
141
+
142
+ if !@sha1.nil? && @sha1.to_s.length < 1
143
+ invalid_properties.push('invalid value for "sha1", the character length must be great than or equal to 1.')
144
+ end
145
+
146
+ if !@sha224.nil? && @sha224.to_s.length < 1
147
+ invalid_properties.push('invalid value for "sha224", the character length must be great than or equal to 1.')
148
+ end
149
+
150
+ if !@sha256.nil? && @sha256.to_s.length < 1
151
+ invalid_properties.push('invalid value for "sha256", the character length must be great than or equal to 1.')
152
+ end
153
+
154
+ if !@sha384.nil? && @sha384.to_s.length < 1
155
+ invalid_properties.push('invalid value for "sha384", the character length must be great than or equal to 1.')
156
+ end
157
+
158
+ if !@sha512.nil? && @sha512.to_s.length < 1
159
+ invalid_properties.push('invalid value for "sha512", the character length must be great than or equal to 1.')
160
+ end
161
+
162
+ invalid_properties
163
+ end
164
+
165
+ # Check to see if the all the properties in the model are valid
166
+ # @return true if the model is valid
167
+ def valid?
168
+ return false if !@md5.nil? && @md5.to_s.length < 1
169
+ return false if !@sha1.nil? && @sha1.to_s.length < 1
170
+ return false if !@sha224.nil? && @sha224.to_s.length < 1
171
+ return false if !@sha256.nil? && @sha256.to_s.length < 1
172
+ return false if !@sha384.nil? && @sha384.to_s.length < 1
173
+ return false if !@sha512.nil? && @sha512.to_s.length < 1
174
+ true
175
+ end
176
+
177
+ # Custom attribute writer method with validation
178
+ # @param [Object] md5 Value to be assigned
179
+ def md5=(md5)
180
+ if !md5.nil? && md5.to_s.length < 1
181
+ fail ArgumentError, 'invalid value for "md5", the character length must be great than or equal to 1.'
182
+ end
183
+
184
+ @md5 = md5
185
+ end
186
+
187
+ # Custom attribute writer method with validation
188
+ # @param [Object] sha1 Value to be assigned
189
+ def sha1=(sha1)
190
+ if !sha1.nil? && sha1.to_s.length < 1
191
+ fail ArgumentError, 'invalid value for "sha1", the character length must be great than or equal to 1.'
192
+ end
193
+
194
+ @sha1 = sha1
195
+ end
196
+
197
+ # Custom attribute writer method with validation
198
+ # @param [Object] sha224 Value to be assigned
199
+ def sha224=(sha224)
200
+ if !sha224.nil? && sha224.to_s.length < 1
201
+ fail ArgumentError, 'invalid value for "sha224", the character length must be great than or equal to 1.'
202
+ end
203
+
204
+ @sha224 = sha224
205
+ end
206
+
207
+ # Custom attribute writer method with validation
208
+ # @param [Object] sha256 Value to be assigned
209
+ def sha256=(sha256)
210
+ if !sha256.nil? && sha256.to_s.length < 1
211
+ fail ArgumentError, 'invalid value for "sha256", the character length must be great than or equal to 1.'
212
+ end
213
+
214
+ @sha256 = sha256
215
+ end
216
+
217
+ # Custom attribute writer method with validation
218
+ # @param [Object] sha384 Value to be assigned
219
+ def sha384=(sha384)
220
+ if !sha384.nil? && sha384.to_s.length < 1
221
+ fail ArgumentError, 'invalid value for "sha384", the character length must be great than or equal to 1.'
222
+ end
223
+
224
+ @sha384 = sha384
225
+ end
226
+
227
+ # Custom attribute writer method with validation
228
+ # @param [Object] sha512 Value to be assigned
229
+ def sha512=(sha512)
230
+ if !sha512.nil? && sha512.to_s.length < 1
231
+ fail ArgumentError, 'invalid value for "sha512", the character length must be great than or equal to 1.'
232
+ end
233
+
234
+ @sha512 = sha512
235
+ end
236
+
237
+ # Checks equality by comparing each attribute.
238
+ # @param [Object] Object to be compared
239
+ def ==(o)
240
+ return true if self.equal?(o)
241
+ self.class == o.class &&
242
+ _href == o._href &&
243
+ _created == o._created &&
244
+ file == o.file &&
245
+ size == o.size &&
246
+ md5 == o.md5 &&
247
+ sha1 == o.sha1 &&
248
+ sha224 == o.sha224 &&
249
+ sha256 == o.sha256 &&
250
+ sha384 == o.sha384 &&
251
+ sha512 == o.sha512
252
+ end
253
+
254
+ # @see the `==` method
255
+ # @param [Object] Object to be compared
256
+ def eql?(o)
257
+ self == o
258
+ end
259
+
260
+ # Calculates hash code according to all attributes.
261
+ # @return [Integer] Hash code
262
+ def hash
263
+ [_href, _created, file, size, md5, sha1, sha224, sha256, sha384, sha512].hash
264
+ end
265
+
266
+ # Builds the object from hash
267
+ # @param [Hash] attributes Model attributes in the form of hash
268
+ # @return [Object] Returns the model itself
269
+ def self.build_from_hash(attributes)
270
+ new.build_from_hash(attributes)
271
+ end
272
+
273
+ # Builds the object from hash
274
+ # @param [Hash] attributes Model attributes in the form of hash
275
+ # @return [Object] Returns the model itself
276
+ def build_from_hash(attributes)
277
+ return nil unless attributes.is_a?(Hash)
278
+ self.class.openapi_types.each_pair do |key, type|
279
+ if type =~ /\AArray<(.*)>/i
280
+ # check to ensure the input is an array given that the attribute
281
+ # is documented as an array but the input is not
282
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
283
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
284
+ end
285
+ elsif !attributes[self.class.attribute_map[key]].nil?
286
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
287
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
288
+ end
289
+
290
+ self
291
+ end
292
+
293
+ # Deserializes the data based on type
294
+ # @param string type Data type
295
+ # @param string value Value to be deserialized
296
+ # @return [Object] Deserialized data
297
+ def _deserialize(type, value)
298
+ case type.to_sym
299
+ when :DateTime
300
+ DateTime.parse(value)
301
+ when :Date
302
+ Date.parse(value)
303
+ when :String
304
+ value.to_s
305
+ when :Integer
306
+ value.to_i
307
+ when :Float
308
+ value.to_f
309
+ when :Boolean
310
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
311
+ true
312
+ else
313
+ false
314
+ end
315
+ when :Object
316
+ # generic object (usually a Hash), return directly
317
+ value
318
+ when /\AArray<(?<inner_type>.+)>\z/
319
+ inner_type = Regexp.last_match[:inner_type]
320
+ value.map { |v| _deserialize(inner_type, v) }
321
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
322
+ k_type = Regexp.last_match[:k_type]
323
+ v_type = Regexp.last_match[:v_type]
324
+ {}.tap do |hash|
325
+ value.each do |k, v|
326
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
327
+ end
328
+ end
329
+ else # model
330
+ PulpRpmClient.const_get(type).build_from_hash(value)
331
+ end
332
+ end
333
+
334
+ # Returns the string representation of the object
335
+ # @return [String] String presentation of the object
336
+ def to_s
337
+ to_hash.to_s
338
+ end
339
+
340
+ # to_body is an alias to to_hash (backward compatibility)
341
+ # @return [Hash] Returns the object in the form of hash
342
+ def to_body
343
+ to_hash
344
+ end
345
+
346
+ # Returns the object in the form of hash
347
+ # @return [Hash] Returns the object in the form of hash
348
+ def to_hash
349
+ hash = {}
350
+ self.class.attribute_map.each_pair do |attr, param|
351
+ value = self.send(attr)
352
+ next if value.nil?
353
+ hash[param] = _to_hash(value)
354
+ end
355
+ hash
356
+ end
357
+
358
+ # Outputs non-array value in the form of hash
359
+ # For object, use to_hash. Otherwise, just return the value
360
+ # @param [Object] value Any valid value
361
+ # @return [Hash] Returns the value in the form of hash
362
+ def _to_hash(value)
363
+ if value.is_a?(Array)
364
+ value.compact.map { |v| _to_hash(v) }
365
+ elsif value.is_a?(Hash)
366
+ {}.tap do |hash|
367
+ value.each { |k, v| hash[k] = _to_hash(v) }
368
+ end
369
+ elsif value.respond_to? :to_hash
370
+ value.to_hash
371
+ else
372
+ value
373
+ end
374
+ end
375
+ end
376
+ end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: v3
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.0
9
+ OpenAPI Generator version: 4.1.3-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
@@ -0,0 +1,255 @@
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 PulpRpmClient
16
+ class Checksum
17
+ # File path.
18
+ attr_accessor :path
19
+
20
+ # Checksum for the file.
21
+ attr_accessor :checksum
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'path' => :'path',
27
+ :'checksum' => :'checksum'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'path' => :'String',
35
+ :'checksum' => :'String'
36
+ }
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpRpmClient::Checksum` initialize method"
44
+ end
45
+
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ if (!self.class.attribute_map.key?(k.to_sym))
49
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpRpmClient::Checksum`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
+ end
51
+ h[k.to_sym] = v
52
+ }
53
+
54
+ if attributes.key?(:'path')
55
+ self.path = attributes[:'path']
56
+ end
57
+
58
+ if attributes.key?(:'checksum')
59
+ self.checksum = attributes[:'checksum']
60
+ end
61
+ end
62
+
63
+ # Show invalid properties with the reasons. Usually used together with valid?
64
+ # @return Array for valid properties with the reasons
65
+ def list_invalid_properties
66
+ invalid_properties = Array.new
67
+ if @path.nil?
68
+ invalid_properties.push('invalid value for "path", path cannot be nil.')
69
+ end
70
+
71
+ if @path.to_s.length < 1
72
+ invalid_properties.push('invalid value for "path", the character length must be great than or equal to 1.')
73
+ end
74
+
75
+ if @checksum.nil?
76
+ invalid_properties.push('invalid value for "checksum", checksum cannot be nil.')
77
+ end
78
+
79
+ if @checksum.to_s.length < 1
80
+ invalid_properties.push('invalid value for "checksum", the character length must be great than or equal to 1.')
81
+ end
82
+
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ return false if @path.nil?
90
+ return false if @path.to_s.length < 1
91
+ return false if @checksum.nil?
92
+ return false if @checksum.to_s.length < 1
93
+ true
94
+ end
95
+
96
+ # Custom attribute writer method with validation
97
+ # @param [Object] path Value to be assigned
98
+ def path=(path)
99
+ if path.nil?
100
+ fail ArgumentError, 'path cannot be nil'
101
+ end
102
+
103
+ if path.to_s.length < 1
104
+ fail ArgumentError, 'invalid value for "path", the character length must be great than or equal to 1.'
105
+ end
106
+
107
+ @path = path
108
+ end
109
+
110
+ # Custom attribute writer method with validation
111
+ # @param [Object] checksum Value to be assigned
112
+ def checksum=(checksum)
113
+ if checksum.nil?
114
+ fail ArgumentError, 'checksum cannot be nil'
115
+ end
116
+
117
+ if checksum.to_s.length < 1
118
+ fail ArgumentError, 'invalid value for "checksum", the character length must be great than or equal to 1.'
119
+ end
120
+
121
+ @checksum = checksum
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ path == o.path &&
130
+ checksum == o.checksum
131
+ end
132
+
133
+ # @see the `==` method
134
+ # @param [Object] Object to be compared
135
+ def eql?(o)
136
+ self == o
137
+ end
138
+
139
+ # Calculates hash code according to all attributes.
140
+ # @return [Integer] Hash code
141
+ def hash
142
+ [path, checksum].hash
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def self.build_from_hash(attributes)
149
+ new.build_from_hash(attributes)
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ self.class.openapi_types.each_pair do |key, type|
158
+ if type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
162
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
163
+ end
164
+ elsif !attributes[self.class.attribute_map[key]].nil?
165
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
166
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
167
+ end
168
+
169
+ self
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def _deserialize(type, value)
177
+ case type.to_sym
178
+ when :DateTime
179
+ DateTime.parse(value)
180
+ when :Date
181
+ Date.parse(value)
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :Boolean
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else # model
209
+ PulpRpmClient.const_get(type).build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ next if value.nil?
232
+ hash[param] = _to_hash(value)
233
+ end
234
+ hash
235
+ end
236
+
237
+ # Outputs non-array value in the form of hash
238
+ # For object, use to_hash. Otherwise, just return the value
239
+ # @param [Object] value Any valid value
240
+ # @return [Hash] Returns the value in the form of hash
241
+ def _to_hash(value)
242
+ if value.is_a?(Array)
243
+ value.compact.map { |v| _to_hash(v) }
244
+ elsif value.is_a?(Hash)
245
+ {}.tap do |hash|
246
+ value.each { |k, v| hash[k] = _to_hash(v) }
247
+ end
248
+ elsif value.respond_to? :to_hash
249
+ value.to_hash
250
+ else
251
+ value
252
+ end
253
+ end
254
+ end
255
+ end