pulp_rpm_client 3.17.22 → 3.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -4
- data/docs/AcsRpmApi.md +11 -13
- data/docs/ContentAdvisoriesApi.md +8 -8
- data/docs/ContentDistributionTreesApi.md +8 -8
- data/docs/ContentModulemdDefaultsApi.md +13 -29
- data/docs/ContentModulemdObsoletesApi.md +192 -0
- data/docs/ContentModulemdsApi.md +13 -41
- data/docs/ContentPackagecategoriesApi.md +8 -8
- data/docs/ContentPackageenvironmentsApi.md +8 -8
- data/docs/ContentPackagegroupsApi.md +8 -8
- data/docs/ContentPackagelangpacksApi.md +8 -8
- data/docs/ContentPackagesApi.md +12 -12
- data/docs/ContentRepoMetadataFilesApi.md +8 -8
- data/docs/DistributionsRpmApi.md +8 -8
- data/docs/PaginatedrpmModulemdObsoleteResponseList.md +23 -0
- data/docs/PatchedrpmRpmRepository.md +1 -1
- data/docs/PublicationsRpmApi.md +8 -8
- data/docs/RemotesRpmApi.md +8 -8
- data/docs/RemotesUlnApi.md +8 -8
- data/docs/RepositoriesRpmApi.md +8 -8
- data/docs/RepositoriesRpmVersionsApi.md +8 -8
- data/docs/RpmModulemd.md +8 -12
- data/docs/RpmModulemdDefaults.md +4 -12
- data/docs/RpmModulemdDefaultsResponse.md +0 -14
- data/docs/RpmModulemdObsolete.md +35 -0
- data/docs/RpmModulemdObsoleteResponse.md +37 -0
- data/docs/RpmModulemdResponse.md +5 -15
- data/docs/RpmPackage.md +1 -1
- data/docs/RpmRpmPublication.md +1 -1
- data/docs/RpmRpmPublicationResponse.md +1 -1
- data/docs/RpmRpmRepository.md +1 -1
- data/docs/RpmRpmRepositoryResponse.md +1 -1
- data/lib/pulp_rpm_client/api/acs_rpm_api.rb +16 -24
- data/lib/pulp_rpm_client/api/content_advisories_api.rb +12 -12
- data/lib/pulp_rpm_client/api/content_distribution_trees_api.rb +12 -12
- data/lib/pulp_rpm_client/api/content_modulemd_defaults_api.rb +23 -69
- data/lib/pulp_rpm_client/api/content_modulemd_obsoletes_api.rb +238 -0
- data/lib/pulp_rpm_client/api/content_modulemds_api.rb +23 -107
- data/lib/pulp_rpm_client/api/content_packagecategories_api.rb +12 -12
- data/lib/pulp_rpm_client/api/content_packageenvironments_api.rb +12 -12
- data/lib/pulp_rpm_client/api/content_packagegroups_api.rb +12 -12
- data/lib/pulp_rpm_client/api/content_packagelangpacks_api.rb +12 -12
- data/lib/pulp_rpm_client/api/content_packages_api.rb +20 -24
- data/lib/pulp_rpm_client/api/content_repo_metadata_files_api.rb +12 -12
- data/lib/pulp_rpm_client/api/distributions_rpm_api.rb +12 -12
- data/lib/pulp_rpm_client/api/publications_rpm_api.rb +12 -12
- data/lib/pulp_rpm_client/api/remotes_rpm_api.rb +12 -12
- data/lib/pulp_rpm_client/api/remotes_uln_api.rb +12 -12
- data/lib/pulp_rpm_client/api/repositories_rpm_api.rb +12 -12
- data/lib/pulp_rpm_client/api/repositories_rpm_versions_api.rb +12 -12
- data/lib/pulp_rpm_client/models/paginatedrpm_modulemd_obsolete_response_list.rb +237 -0
- data/lib/pulp_rpm_client/models/patchedrpm_rpm_repository.rb +1 -1
- data/lib/pulp_rpm_client/models/rpm_modulemd.rb +83 -78
- data/lib/pulp_rpm_client/models/rpm_modulemd_defaults.rb +38 -78
- data/lib/pulp_rpm_client/models/rpm_modulemd_defaults_response.rb +1 -71
- data/lib/pulp_rpm_client/models/rpm_modulemd_obsolete.rb +464 -0
- data/lib/pulp_rpm_client/models/rpm_modulemd_obsolete_response.rb +332 -0
- data/lib/pulp_rpm_client/models/rpm_modulemd_response.rb +30 -74
- data/lib/pulp_rpm_client/models/rpm_package.rb +3 -12
- data/lib/pulp_rpm_client/models/rpm_rpm_publication.rb +1 -1
- data/lib/pulp_rpm_client/models/rpm_rpm_publication_response.rb +1 -1
- data/lib/pulp_rpm_client/models/rpm_rpm_repository.rb +1 -1
- data/lib/pulp_rpm_client/models/rpm_rpm_repository_response.rb +1 -1
- data/lib/pulp_rpm_client/version.rb +1 -1
- data/lib/pulp_rpm_client.rb +4 -0
- data/spec/api/acs_rpm_api_spec.rb +4 -5
- data/spec/api/content_advisories_api_spec.rb +4 -4
- data/spec/api/content_distribution_trees_api_spec.rb +4 -4
- data/spec/api/content_modulemd_defaults_api_spec.rb +5 -12
- data/spec/api/content_modulemd_obsoletes_api_spec.rb +80 -0
- data/spec/api/content_modulemds_api_spec.rb +5 -18
- data/spec/api/content_packagecategories_api_spec.rb +4 -4
- data/spec/api/content_packageenvironments_api_spec.rb +4 -4
- data/spec/api/content_packagegroups_api_spec.rb +4 -4
- data/spec/api/content_packagelangpacks_api_spec.rb +4 -4
- data/spec/api/content_packages_api_spec.rb +5 -5
- data/spec/api/content_repo_metadata_files_api_spec.rb +4 -4
- data/spec/api/distributions_rpm_api_spec.rb +4 -4
- data/spec/api/publications_rpm_api_spec.rb +4 -4
- data/spec/api/remotes_rpm_api_spec.rb +4 -4
- data/spec/api/remotes_uln_api_spec.rb +4 -4
- data/spec/api/repositories_rpm_api_spec.rb +4 -4
- data/spec/api/repositories_rpm_versions_api_spec.rb +4 -4
- data/spec/models/paginatedrpm_modulemd_obsolete_response_list_spec.rb +59 -0
- data/spec/models/rpm_modulemd_defaults_response_spec.rb +0 -42
- data/spec/models/rpm_modulemd_defaults_spec.rb +4 -28
- data/spec/models/rpm_modulemd_obsolete_response_spec.rb +101 -0
- data/spec/models/rpm_modulemd_obsolete_spec.rb +95 -0
- data/spec/models/rpm_modulemd_response_spec.rb +11 -41
- data/spec/models/rpm_modulemd_spec.rb +12 -24
- metadata +85 -69
@@ -0,0 +1,464 @@
|
|
1
|
+
=begin
|
2
|
+
#Pulp 3 API
|
3
|
+
|
4
|
+
#Fetch, Upload, Organize, and Distribute Software Packages
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3
|
7
|
+
Contact: pulp-list@redhat.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpRpmClient
|
16
|
+
# ModulemdObsolete serializer.
|
17
|
+
class RpmModulemdObsolete
|
18
|
+
# Obsolete modified time.
|
19
|
+
attr_accessor :modified
|
20
|
+
|
21
|
+
# Modulemd name.
|
22
|
+
attr_accessor :module_name
|
23
|
+
|
24
|
+
# Modulemd's stream.
|
25
|
+
attr_accessor :module_stream
|
26
|
+
|
27
|
+
# Obsolete description.
|
28
|
+
attr_accessor :message
|
29
|
+
|
30
|
+
# Reset previous obsoletes.
|
31
|
+
attr_accessor :override_previous
|
32
|
+
|
33
|
+
# Modulemd's context.
|
34
|
+
attr_accessor :module_context
|
35
|
+
|
36
|
+
# End of Life date.
|
37
|
+
attr_accessor :eol_date
|
38
|
+
|
39
|
+
# Obsolete by module name.
|
40
|
+
attr_accessor :obsoleted_by_module_name
|
41
|
+
|
42
|
+
# Obsolete by module stream.
|
43
|
+
attr_accessor :obsoleted_by_module_stream
|
44
|
+
|
45
|
+
# Module Obsolete snippet.
|
46
|
+
attr_accessor :snippet
|
47
|
+
|
48
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
49
|
+
def self.attribute_map
|
50
|
+
{
|
51
|
+
:'modified' => :'modified',
|
52
|
+
:'module_name' => :'module_name',
|
53
|
+
:'module_stream' => :'module_stream',
|
54
|
+
:'message' => :'message',
|
55
|
+
:'override_previous' => :'override_previous',
|
56
|
+
:'module_context' => :'module_context',
|
57
|
+
:'eol_date' => :'eol_date',
|
58
|
+
:'obsoleted_by_module_name' => :'obsoleted_by_module_name',
|
59
|
+
:'obsoleted_by_module_stream' => :'obsoleted_by_module_stream',
|
60
|
+
:'snippet' => :'snippet'
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Attribute type mapping.
|
65
|
+
def self.openapi_types
|
66
|
+
{
|
67
|
+
:'modified' => :'DateTime',
|
68
|
+
:'module_name' => :'String',
|
69
|
+
:'module_stream' => :'String',
|
70
|
+
:'message' => :'String',
|
71
|
+
:'override_previous' => :'String',
|
72
|
+
:'module_context' => :'String',
|
73
|
+
:'eol_date' => :'DateTime',
|
74
|
+
:'obsoleted_by_module_name' => :'String',
|
75
|
+
:'obsoleted_by_module_stream' => :'String',
|
76
|
+
:'snippet' => :'String'
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
# List of attributes with nullable: true
|
81
|
+
def self.openapi_nullable
|
82
|
+
Set.new([
|
83
|
+
:'override_previous',
|
84
|
+
:'module_context',
|
85
|
+
:'eol_date',
|
86
|
+
:'obsoleted_by_module_name',
|
87
|
+
:'obsoleted_by_module_stream',
|
88
|
+
])
|
89
|
+
end
|
90
|
+
|
91
|
+
# Initializes the object
|
92
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
93
|
+
def initialize(attributes = {})
|
94
|
+
if (!attributes.is_a?(Hash))
|
95
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpRpmClient::RpmModulemdObsolete` initialize method"
|
96
|
+
end
|
97
|
+
|
98
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
99
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
100
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
101
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpRpmClient::RpmModulemdObsolete`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
102
|
+
end
|
103
|
+
h[k.to_sym] = v
|
104
|
+
}
|
105
|
+
|
106
|
+
if attributes.key?(:'modified')
|
107
|
+
self.modified = attributes[:'modified']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.key?(:'module_name')
|
111
|
+
self.module_name = attributes[:'module_name']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.key?(:'module_stream')
|
115
|
+
self.module_stream = attributes[:'module_stream']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.key?(:'message')
|
119
|
+
self.message = attributes[:'message']
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.key?(:'override_previous')
|
123
|
+
self.override_previous = attributes[:'override_previous']
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.key?(:'module_context')
|
127
|
+
self.module_context = attributes[:'module_context']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.key?(:'eol_date')
|
131
|
+
self.eol_date = attributes[:'eol_date']
|
132
|
+
end
|
133
|
+
|
134
|
+
if attributes.key?(:'obsoleted_by_module_name')
|
135
|
+
self.obsoleted_by_module_name = attributes[:'obsoleted_by_module_name']
|
136
|
+
end
|
137
|
+
|
138
|
+
if attributes.key?(:'obsoleted_by_module_stream')
|
139
|
+
self.obsoleted_by_module_stream = attributes[:'obsoleted_by_module_stream']
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes.key?(:'snippet')
|
143
|
+
self.snippet = attributes[:'snippet']
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
148
|
+
# @return Array for valid properties with the reasons
|
149
|
+
def list_invalid_properties
|
150
|
+
invalid_properties = Array.new
|
151
|
+
if @modified.nil?
|
152
|
+
invalid_properties.push('invalid value for "modified", modified cannot be nil.')
|
153
|
+
end
|
154
|
+
|
155
|
+
if @module_name.nil?
|
156
|
+
invalid_properties.push('invalid value for "module_name", module_name cannot be nil.')
|
157
|
+
end
|
158
|
+
|
159
|
+
if @module_name.to_s.length < 1
|
160
|
+
invalid_properties.push('invalid value for "module_name", the character length must be great than or equal to 1.')
|
161
|
+
end
|
162
|
+
|
163
|
+
if @module_stream.nil?
|
164
|
+
invalid_properties.push('invalid value for "module_stream", module_stream cannot be nil.')
|
165
|
+
end
|
166
|
+
|
167
|
+
if @module_stream.to_s.length < 1
|
168
|
+
invalid_properties.push('invalid value for "module_stream", the character length must be great than or equal to 1.')
|
169
|
+
end
|
170
|
+
|
171
|
+
if @message.nil?
|
172
|
+
invalid_properties.push('invalid value for "message", message cannot be nil.')
|
173
|
+
end
|
174
|
+
|
175
|
+
if @message.to_s.length < 1
|
176
|
+
invalid_properties.push('invalid value for "message", the character length must be great than or equal to 1.')
|
177
|
+
end
|
178
|
+
|
179
|
+
if @override_previous.to_s.length < 1
|
180
|
+
invalid_properties.push('invalid value for "override_previous", the character length must be great than or equal to 1.')
|
181
|
+
end
|
182
|
+
|
183
|
+
if @module_context.to_s.length < 1
|
184
|
+
invalid_properties.push('invalid value for "module_context", the character length must be great than or equal to 1.')
|
185
|
+
end
|
186
|
+
|
187
|
+
if @obsoleted_by_module_name.to_s.length < 1
|
188
|
+
invalid_properties.push('invalid value for "obsoleted_by_module_name", the character length must be great than or equal to 1.')
|
189
|
+
end
|
190
|
+
|
191
|
+
if @obsoleted_by_module_stream.to_s.length < 1
|
192
|
+
invalid_properties.push('invalid value for "obsoleted_by_module_stream", the character length must be great than or equal to 1.')
|
193
|
+
end
|
194
|
+
|
195
|
+
if @snippet.nil?
|
196
|
+
invalid_properties.push('invalid value for "snippet", snippet cannot be nil.')
|
197
|
+
end
|
198
|
+
|
199
|
+
if @snippet.to_s.length < 1
|
200
|
+
invalid_properties.push('invalid value for "snippet", the character length must be great than or equal to 1.')
|
201
|
+
end
|
202
|
+
|
203
|
+
invalid_properties
|
204
|
+
end
|
205
|
+
|
206
|
+
# Check to see if the all the properties in the model are valid
|
207
|
+
# @return true if the model is valid
|
208
|
+
def valid?
|
209
|
+
return false if @modified.nil?
|
210
|
+
return false if @module_name.nil?
|
211
|
+
return false if @module_name.to_s.length < 1
|
212
|
+
return false if @module_stream.nil?
|
213
|
+
return false if @module_stream.to_s.length < 1
|
214
|
+
return false if @message.nil?
|
215
|
+
return false if @message.to_s.length < 1
|
216
|
+
return false if @override_previous.to_s.length < 1
|
217
|
+
return false if @module_context.to_s.length < 1
|
218
|
+
return false if @obsoleted_by_module_name.to_s.length < 1
|
219
|
+
return false if @obsoleted_by_module_stream.to_s.length < 1
|
220
|
+
return false if @snippet.nil?
|
221
|
+
return false if @snippet.to_s.length < 1
|
222
|
+
true
|
223
|
+
end
|
224
|
+
|
225
|
+
# Custom attribute writer method with validation
|
226
|
+
# @param [Object] module_name Value to be assigned
|
227
|
+
def module_name=(module_name)
|
228
|
+
if module_name.nil?
|
229
|
+
fail ArgumentError, 'module_name cannot be nil'
|
230
|
+
end
|
231
|
+
|
232
|
+
if module_name.to_s.length < 1
|
233
|
+
fail ArgumentError, 'invalid value for "module_name", the character length must be great than or equal to 1.'
|
234
|
+
end
|
235
|
+
|
236
|
+
@module_name = module_name
|
237
|
+
end
|
238
|
+
|
239
|
+
# Custom attribute writer method with validation
|
240
|
+
# @param [Object] module_stream Value to be assigned
|
241
|
+
def module_stream=(module_stream)
|
242
|
+
if module_stream.nil?
|
243
|
+
fail ArgumentError, 'module_stream cannot be nil'
|
244
|
+
end
|
245
|
+
|
246
|
+
if module_stream.to_s.length < 1
|
247
|
+
fail ArgumentError, 'invalid value for "module_stream", the character length must be great than or equal to 1.'
|
248
|
+
end
|
249
|
+
|
250
|
+
@module_stream = module_stream
|
251
|
+
end
|
252
|
+
|
253
|
+
# Custom attribute writer method with validation
|
254
|
+
# @param [Object] message Value to be assigned
|
255
|
+
def message=(message)
|
256
|
+
if message.nil?
|
257
|
+
fail ArgumentError, 'message cannot be nil'
|
258
|
+
end
|
259
|
+
|
260
|
+
if message.to_s.length < 1
|
261
|
+
fail ArgumentError, 'invalid value for "message", the character length must be great than or equal to 1.'
|
262
|
+
end
|
263
|
+
|
264
|
+
@message = message
|
265
|
+
end
|
266
|
+
|
267
|
+
# Custom attribute writer method with validation
|
268
|
+
# @param [Object] override_previous Value to be assigned
|
269
|
+
def override_previous=(override_previous)
|
270
|
+
if override_previous.to_s.length < 1
|
271
|
+
fail ArgumentError, 'invalid value for "override_previous", the character length must be great than or equal to 1.'
|
272
|
+
end
|
273
|
+
|
274
|
+
@override_previous = override_previous
|
275
|
+
end
|
276
|
+
|
277
|
+
# Custom attribute writer method with validation
|
278
|
+
# @param [Object] module_context Value to be assigned
|
279
|
+
def module_context=(module_context)
|
280
|
+
if module_context.to_s.length < 1
|
281
|
+
fail ArgumentError, 'invalid value for "module_context", the character length must be great than or equal to 1.'
|
282
|
+
end
|
283
|
+
|
284
|
+
@module_context = module_context
|
285
|
+
end
|
286
|
+
|
287
|
+
# Custom attribute writer method with validation
|
288
|
+
# @param [Object] obsoleted_by_module_name Value to be assigned
|
289
|
+
def obsoleted_by_module_name=(obsoleted_by_module_name)
|
290
|
+
if obsoleted_by_module_name.to_s.length < 1
|
291
|
+
fail ArgumentError, 'invalid value for "obsoleted_by_module_name", the character length must be great than or equal to 1.'
|
292
|
+
end
|
293
|
+
|
294
|
+
@obsoleted_by_module_name = obsoleted_by_module_name
|
295
|
+
end
|
296
|
+
|
297
|
+
# Custom attribute writer method with validation
|
298
|
+
# @param [Object] obsoleted_by_module_stream Value to be assigned
|
299
|
+
def obsoleted_by_module_stream=(obsoleted_by_module_stream)
|
300
|
+
if obsoleted_by_module_stream.to_s.length < 1
|
301
|
+
fail ArgumentError, 'invalid value for "obsoleted_by_module_stream", the character length must be great than or equal to 1.'
|
302
|
+
end
|
303
|
+
|
304
|
+
@obsoleted_by_module_stream = obsoleted_by_module_stream
|
305
|
+
end
|
306
|
+
|
307
|
+
# Custom attribute writer method with validation
|
308
|
+
# @param [Object] snippet Value to be assigned
|
309
|
+
def snippet=(snippet)
|
310
|
+
if snippet.nil?
|
311
|
+
fail ArgumentError, 'snippet cannot be nil'
|
312
|
+
end
|
313
|
+
|
314
|
+
if snippet.to_s.length < 1
|
315
|
+
fail ArgumentError, 'invalid value for "snippet", the character length must be great than or equal to 1.'
|
316
|
+
end
|
317
|
+
|
318
|
+
@snippet = snippet
|
319
|
+
end
|
320
|
+
|
321
|
+
# Checks equality by comparing each attribute.
|
322
|
+
# @param [Object] Object to be compared
|
323
|
+
def ==(o)
|
324
|
+
return true if self.equal?(o)
|
325
|
+
self.class == o.class &&
|
326
|
+
modified == o.modified &&
|
327
|
+
module_name == o.module_name &&
|
328
|
+
module_stream == o.module_stream &&
|
329
|
+
message == o.message &&
|
330
|
+
override_previous == o.override_previous &&
|
331
|
+
module_context == o.module_context &&
|
332
|
+
eol_date == o.eol_date &&
|
333
|
+
obsoleted_by_module_name == o.obsoleted_by_module_name &&
|
334
|
+
obsoleted_by_module_stream == o.obsoleted_by_module_stream &&
|
335
|
+
snippet == o.snippet
|
336
|
+
end
|
337
|
+
|
338
|
+
# @see the `==` method
|
339
|
+
# @param [Object] Object to be compared
|
340
|
+
def eql?(o)
|
341
|
+
self == o
|
342
|
+
end
|
343
|
+
|
344
|
+
# Calculates hash code according to all attributes.
|
345
|
+
# @return [Integer] Hash code
|
346
|
+
def hash
|
347
|
+
[modified, module_name, module_stream, message, override_previous, module_context, eol_date, obsoleted_by_module_name, obsoleted_by_module_stream, snippet].hash
|
348
|
+
end
|
349
|
+
|
350
|
+
# Builds the object from hash
|
351
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
352
|
+
# @return [Object] Returns the model itself
|
353
|
+
def self.build_from_hash(attributes)
|
354
|
+
new.build_from_hash(attributes)
|
355
|
+
end
|
356
|
+
|
357
|
+
# Builds the object from hash
|
358
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
359
|
+
# @return [Object] Returns the model itself
|
360
|
+
def build_from_hash(attributes)
|
361
|
+
return nil unless attributes.is_a?(Hash)
|
362
|
+
self.class.openapi_types.each_pair do |key, type|
|
363
|
+
if type =~ /\AArray<(.*)>/i
|
364
|
+
# check to ensure the input is an array given that the attribute
|
365
|
+
# is documented as an array but the input is not
|
366
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
367
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
368
|
+
end
|
369
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
370
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
371
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
372
|
+
end
|
373
|
+
|
374
|
+
self
|
375
|
+
end
|
376
|
+
|
377
|
+
# Deserializes the data based on type
|
378
|
+
# @param string type Data type
|
379
|
+
# @param string value Value to be deserialized
|
380
|
+
# @return [Object] Deserialized data
|
381
|
+
def _deserialize(type, value)
|
382
|
+
case type.to_sym
|
383
|
+
when :DateTime
|
384
|
+
DateTime.parse(value)
|
385
|
+
when :Date
|
386
|
+
Date.parse(value)
|
387
|
+
when :String
|
388
|
+
value.to_s
|
389
|
+
when :Integer
|
390
|
+
value.to_i
|
391
|
+
when :Float
|
392
|
+
value.to_f
|
393
|
+
when :Boolean
|
394
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
395
|
+
true
|
396
|
+
else
|
397
|
+
false
|
398
|
+
end
|
399
|
+
when :Object
|
400
|
+
# generic object (usually a Hash), return directly
|
401
|
+
value
|
402
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
403
|
+
inner_type = Regexp.last_match[:inner_type]
|
404
|
+
value.map { |v| _deserialize(inner_type, v) }
|
405
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
406
|
+
k_type = Regexp.last_match[:k_type]
|
407
|
+
v_type = Regexp.last_match[:v_type]
|
408
|
+
{}.tap do |hash|
|
409
|
+
value.each do |k, v|
|
410
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
411
|
+
end
|
412
|
+
end
|
413
|
+
else # model
|
414
|
+
PulpRpmClient.const_get(type).build_from_hash(value)
|
415
|
+
end
|
416
|
+
end
|
417
|
+
|
418
|
+
# Returns the string representation of the object
|
419
|
+
# @return [String] String presentation of the object
|
420
|
+
def to_s
|
421
|
+
to_hash.to_s
|
422
|
+
end
|
423
|
+
|
424
|
+
# to_body is an alias to to_hash (backward compatibility)
|
425
|
+
# @return [Hash] Returns the object in the form of hash
|
426
|
+
def to_body
|
427
|
+
to_hash
|
428
|
+
end
|
429
|
+
|
430
|
+
# Returns the object in the form of hash
|
431
|
+
# @return [Hash] Returns the object in the form of hash
|
432
|
+
def to_hash
|
433
|
+
hash = {}
|
434
|
+
self.class.attribute_map.each_pair do |attr, param|
|
435
|
+
value = self.send(attr)
|
436
|
+
if value.nil?
|
437
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
438
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
439
|
+
end
|
440
|
+
|
441
|
+
hash[param] = _to_hash(value)
|
442
|
+
end
|
443
|
+
hash
|
444
|
+
end
|
445
|
+
|
446
|
+
# Outputs non-array value in the form of hash
|
447
|
+
# For object, use to_hash. Otherwise, just return the value
|
448
|
+
# @param [Object] value Any valid value
|
449
|
+
# @return [Hash] Returns the value in the form of hash
|
450
|
+
def _to_hash(value)
|
451
|
+
if value.is_a?(Array)
|
452
|
+
value.compact.map { |v| _to_hash(v) }
|
453
|
+
elsif value.is_a?(Hash)
|
454
|
+
{}.tap do |hash|
|
455
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
456
|
+
end
|
457
|
+
elsif value.respond_to? :to_hash
|
458
|
+
value.to_hash
|
459
|
+
else
|
460
|
+
value
|
461
|
+
end
|
462
|
+
end
|
463
|
+
end
|
464
|
+
end
|