pulp_rpm_client 3.0.0b71572533171 → 3.0.0rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +63 -22
  3. data/docs/ContentAdvisoriesApi.md +15 -7
  4. data/docs/ContentDistributionTreesApi.md +2 -2
  5. data/docs/ContentModulemdDefaultsApi.md +6 -6
  6. data/docs/{ContentModulemdApi.md → ContentModulemdsApi.md} +14 -14
  7. data/docs/ContentPackagecategoriesApi.md +189 -0
  8. data/docs/ContentPackageenvironmentsApi.md +189 -0
  9. data/docs/ContentPackagegroupsApi.md +189 -0
  10. data/docs/ContentPackagelangpacksApi.md +189 -0
  11. data/docs/ContentPackagesApi.md +4 -4
  12. data/docs/ContentRepoMetadataFilesApi.md +4 -4
  13. data/docs/ContentSummary.md +21 -0
  14. data/docs/DistributionsRpmApi.md +10 -10
  15. data/docs/InlineResponse200.md +1 -1
  16. data/docs/InlineResponse2001.md +1 -1
  17. data/docs/InlineResponse20010.md +23 -0
  18. data/docs/InlineResponse20011.md +23 -0
  19. data/docs/InlineResponse20012.md +23 -0
  20. data/docs/InlineResponse20013.md +23 -0
  21. data/docs/InlineResponse20014.md +23 -0
  22. data/docs/InlineResponse2002.md +1 -1
  23. data/docs/InlineResponse2003.md +1 -1
  24. data/docs/InlineResponse2004.md +1 -1
  25. data/docs/InlineResponse2005.md +1 -1
  26. data/docs/InlineResponse2006.md +1 -1
  27. data/docs/InlineResponse2007.md +1 -1
  28. data/docs/InlineResponse2008.md +1 -1
  29. data/docs/InlineResponse2009.md +23 -0
  30. data/docs/PublicationsRpmApi.md +6 -6
  31. data/docs/RemotesRpmApi.md +12 -68
  32. data/docs/RepositoriesRpmApi.md +465 -0
  33. data/docs/RepositoriesRpmVersionsApi.md +214 -0
  34. data/docs/RepositoryAddRemoveContent.md +21 -0
  35. data/docs/RepositorySyncURL.md +2 -2
  36. data/docs/RepositoryVersion.md +25 -0
  37. data/docs/{DistributionTree.md → RpmDistributionTree.md} +2 -2
  38. data/docs/{Modulemd.md → RpmModulemd.md} +2 -8
  39. data/docs/{ModulemdDefaults.md → RpmModulemdDefaults.md} +2 -8
  40. data/docs/{Package.md → RpmPackage.md} +2 -8
  41. data/docs/RpmPackageCategory.md +33 -0
  42. data/docs/RpmPackageEnvironment.md +37 -0
  43. data/docs/RpmPackageGroup.md +39 -0
  44. data/docs/RpmPackageLangpacks.md +19 -0
  45. data/docs/{RepoMetadataFile.md → RpmRepoMetadataFile.md} +2 -8
  46. data/docs/{RpmDistribution.md → RpmRpmDistribution.md} +2 -2
  47. data/docs/{RpmPublication.md → RpmRpmPublication.md} +2 -2
  48. data/docs/{RpmRemote.md → RpmRpmRemote.md} +10 -14
  49. data/docs/RpmRpmRepository.md +27 -0
  50. data/docs/RpmUpdateCollection.md +21 -0
  51. data/docs/{UpdateRecord.md → RpmUpdateRecord.md} +24 -20
  52. data/lib/pulp_rpm_client/api/content_advisories_api.rb +28 -14
  53. data/lib/pulp_rpm_client/api/content_distribution_trees_api.rb +4 -4
  54. data/lib/pulp_rpm_client/api/content_modulemd_defaults_api.rb +8 -8
  55. data/lib/pulp_rpm_client/api/{content_modulemd_api.rb → content_modulemds_api.rb} +30 -30
  56. data/lib/pulp_rpm_client/api/content_packagecategories_api.rb +227 -0
  57. data/lib/pulp_rpm_client/api/content_packageenvironments_api.rb +227 -0
  58. data/lib/pulp_rpm_client/api/content_packagegroups_api.rb +227 -0
  59. data/lib/pulp_rpm_client/api/content_packagelangpacks_api.rb +227 -0
  60. data/lib/pulp_rpm_client/api/content_packages_api.rb +7 -7
  61. data/lib/pulp_rpm_client/api/content_repo_metadata_files_api.rb +7 -7
  62. data/lib/pulp_rpm_client/api/distributions_rpm_api.rb +13 -13
  63. data/lib/pulp_rpm_client/api/publications_rpm_api.rb +9 -9
  64. data/lib/pulp_rpm_client/api/remotes_rpm_api.rb +16 -86
  65. data/lib/pulp_rpm_client/api/repositories_rpm_api.rb +568 -0
  66. data/lib/pulp_rpm_client/api/repositories_rpm_versions_api.rb +268 -0
  67. data/lib/pulp_rpm_client/api_client.rb +1 -1
  68. data/lib/pulp_rpm_client/api_error.rb +1 -1
  69. data/lib/pulp_rpm_client/configuration.rb +1 -1
  70. data/lib/pulp_rpm_client/models/addon.rb +12 -2
  71. data/lib/pulp_rpm_client/models/artifact.rb +18 -2
  72. data/lib/pulp_rpm_client/models/async_operation_response.rb +12 -2
  73. data/lib/pulp_rpm_client/models/checksum.rb +12 -2
  74. data/lib/pulp_rpm_client/models/content_summary.rb +246 -0
  75. data/lib/pulp_rpm_client/models/image.rb +12 -2
  76. data/lib/pulp_rpm_client/models/inline_response200.rb +15 -3
  77. data/lib/pulp_rpm_client/models/inline_response2001.rb +15 -3
  78. data/lib/pulp_rpm_client/models/inline_response20010.rb +247 -0
  79. data/lib/pulp_rpm_client/models/inline_response20011.rb +247 -0
  80. data/lib/pulp_rpm_client/models/inline_response20012.rb +247 -0
  81. data/lib/pulp_rpm_client/models/inline_response20013.rb +247 -0
  82. data/lib/pulp_rpm_client/models/inline_response20014.rb +247 -0
  83. data/lib/pulp_rpm_client/models/inline_response2002.rb +15 -3
  84. data/lib/pulp_rpm_client/models/inline_response2003.rb +15 -3
  85. data/lib/pulp_rpm_client/models/inline_response2004.rb +15 -3
  86. data/lib/pulp_rpm_client/models/inline_response2005.rb +15 -3
  87. data/lib/pulp_rpm_client/models/inline_response2006.rb +15 -3
  88. data/lib/pulp_rpm_client/models/inline_response2007.rb +15 -3
  89. data/lib/pulp_rpm_client/models/inline_response2008.rb +15 -3
  90. data/lib/pulp_rpm_client/models/inline_response2009.rb +247 -0
  91. data/lib/pulp_rpm_client/models/repository_add_remove_content.rb +231 -0
  92. data/lib/pulp_rpm_client/models/repository_sync_url.rb +22 -12
  93. data/lib/pulp_rpm_client/models/repository_version.rb +244 -0
  94. data/lib/pulp_rpm_client/models/{distribution_tree.rb → rpm_distribution_tree.rb} +15 -5
  95. data/lib/pulp_rpm_client/models/{modulemd.rb → rpm_modulemd.rb} +16 -60
  96. data/lib/pulp_rpm_client/models/{modulemd_defaults.rb → rpm_modulemd_defaults.rb} +16 -60
  97. data/lib/pulp_rpm_client/models/{package.rb → rpm_package.rb} +16 -60
  98. data/lib/pulp_rpm_client/models/rpm_package_category.rb +405 -0
  99. data/lib/pulp_rpm_client/models/rpm_package_environment.rb +432 -0
  100. data/lib/pulp_rpm_client/models/rpm_package_group.rb +435 -0
  101. data/lib/pulp_rpm_client/models/rpm_package_langpacks.rb +246 -0
  102. data/lib/pulp_rpm_client/models/{repo_metadata_file.rb → rpm_repo_metadata_file.rb} +16 -60
  103. data/lib/pulp_rpm_client/models/{rpm_distribution.rb → rpm_rpm_distribution.rb} +17 -23
  104. data/lib/pulp_rpm_client/models/{rpm_publication.rb → rpm_rpm_publication.rb} +16 -5
  105. data/lib/pulp_rpm_client/models/{rpm_remote.rb → rpm_rpm_remote.rb} +69 -105
  106. data/lib/pulp_rpm_client/models/rpm_rpm_repository.rb +294 -0
  107. data/lib/pulp_rpm_client/models/rpm_update_collection.rb +240 -0
  108. data/lib/pulp_rpm_client/models/{update_record.rb → rpm_update_record.rb} +49 -239
  109. data/lib/pulp_rpm_client/models/variant.rb +12 -2
  110. data/lib/pulp_rpm_client/version.rb +2 -2
  111. data/lib/pulp_rpm_client.rb +32 -12
  112. data/pulp_rpm_client.gemspec +1 -1
  113. data/spec/api/content_advisories_api_spec.rb +6 -3
  114. data/spec/api/content_distribution_trees_api_spec.rb +2 -2
  115. data/spec/api/content_modulemd_defaults_api_spec.rb +3 -3
  116. data/spec/api/{content_modulemd_api_spec.rb → content_modulemds_api_spec.rb} +9 -9
  117. data/spec/api/content_packagecategories_api_spec.rb +79 -0
  118. data/spec/api/content_packageenvironments_api_spec.rb +79 -0
  119. data/spec/api/content_packagegroups_api_spec.rb +79 -0
  120. data/spec/api/content_packagelangpacks_api_spec.rb +79 -0
  121. data/spec/api/content_packages_api_spec.rb +3 -3
  122. data/spec/api/content_repo_metadata_files_api_spec.rb +3 -3
  123. data/spec/api/distributions_rpm_api_spec.rb +3 -3
  124. data/spec/api/publications_rpm_api_spec.rb +3 -3
  125. data/spec/api/remotes_rpm_api_spec.rb +4 -17
  126. data/spec/api/repositories_rpm_api_spec.rb +141 -0
  127. data/spec/api/repositories_rpm_versions_api_spec.rb +91 -0
  128. data/spec/api_client_spec.rb +1 -1
  129. data/spec/configuration_spec.rb +1 -1
  130. data/spec/models/addon_spec.rb +1 -1
  131. data/spec/models/artifact_spec.rb +1 -1
  132. data/spec/models/async_operation_response_spec.rb +1 -1
  133. data/spec/models/checksum_spec.rb +1 -1
  134. data/spec/models/content_summary_spec.rb +53 -0
  135. data/spec/models/image_spec.rb +1 -1
  136. data/spec/models/inline_response20010_spec.rb +59 -0
  137. data/spec/models/inline_response20011_spec.rb +59 -0
  138. data/spec/models/inline_response20012_spec.rb +59 -0
  139. data/spec/models/inline_response20013_spec.rb +59 -0
  140. data/spec/models/inline_response20014_spec.rb +59 -0
  141. data/spec/models/inline_response2001_spec.rb +1 -1
  142. data/spec/models/inline_response2002_spec.rb +1 -1
  143. data/spec/models/inline_response2003_spec.rb +1 -1
  144. data/spec/models/inline_response2004_spec.rb +1 -1
  145. data/spec/models/inline_response2005_spec.rb +1 -1
  146. data/spec/models/inline_response2006_spec.rb +1 -1
  147. data/spec/models/inline_response2007_spec.rb +1 -1
  148. data/spec/models/inline_response2008_spec.rb +1 -1
  149. data/spec/models/inline_response2009_spec.rb +59 -0
  150. data/spec/models/inline_response200_spec.rb +1 -1
  151. data/spec/models/repository_add_remove_content_spec.rb +53 -0
  152. data/spec/models/repository_sync_url_spec.rb +2 -2
  153. data/spec/models/repository_version_spec.rb +65 -0
  154. data/spec/models/{distribution_tree_spec.rb → rpm_distribution_tree_spec.rb} +7 -7
  155. data/spec/models/{modulemd_defaults_spec.rb → rpm_modulemd_defaults_spec.rb} +7 -25
  156. data/spec/models/{modulemd_spec.rb → rpm_modulemd_spec.rb} +7 -25
  157. data/spec/models/{repo_metadata_file_spec.rb → rpm_package_category_spec.rb} +16 -16
  158. data/spec/models/rpm_package_environment_spec.rb +101 -0
  159. data/spec/models/rpm_package_group_spec.rb +107 -0
  160. data/spec/models/rpm_package_langpacks_spec.rb +47 -0
  161. data/spec/models/{package_spec.rb → rpm_package_spec.rb} +7 -25
  162. data/spec/models/rpm_repo_metadata_file_spec.rb +71 -0
  163. data/spec/models/{rpm_distribution_spec.rb → rpm_rpm_distribution_spec.rb} +7 -7
  164. data/spec/models/{rpm_publication_spec.rb → rpm_rpm_publication_spec.rb} +7 -7
  165. data/spec/models/{rpm_remote_spec.rb → rpm_rpm_remote_spec.rb} +11 -23
  166. data/spec/models/rpm_rpm_repository_spec.rb +71 -0
  167. data/spec/models/rpm_update_collection_spec.rb +53 -0
  168. data/spec/models/{update_record_spec.rb → rpm_update_record_spec.rb} +19 -7
  169. data/spec/models/variant_spec.rb +1 -1
  170. data/spec/spec_helper.rb +1 -1
  171. metadata +126 -46
  172. data/docs/RpmCopyApi.md +0 -70
  173. data/lib/pulp_rpm_client/api/rpm_copy_api.rb +0 -96
  174. data/spec/api/rpm_copy_api_spec.rb +0 -50
@@ -0,0 +1,432 @@
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.2-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpRpmClient
16
+ class RpmPackageEnvironment
17
+ # Environment id.
18
+ attr_accessor :id
19
+
20
+ # Environment name.
21
+ attr_accessor :name
22
+
23
+ # Environment description.
24
+ attr_accessor :description
25
+
26
+ # Environment display order.
27
+ attr_accessor :display_order
28
+
29
+ # Environment group list.
30
+ attr_accessor :group_ids
31
+
32
+ # Environment option ids
33
+ attr_accessor :option_ids
34
+
35
+ # Environment description by language.
36
+ attr_accessor :desc_by_lang
37
+
38
+ # Environment name by language.
39
+ attr_accessor :name_by_lang
40
+
41
+ # Environment digest.
42
+ attr_accessor :digest
43
+
44
+ # Groups related to this Environment.
45
+ attr_accessor :packagegroups
46
+
47
+ # Groups optionally related to this Environment.
48
+ attr_accessor :optionalgroups
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'id' => :'id',
54
+ :'name' => :'name',
55
+ :'description' => :'description',
56
+ :'display_order' => :'display_order',
57
+ :'group_ids' => :'group_ids',
58
+ :'option_ids' => :'option_ids',
59
+ :'desc_by_lang' => :'desc_by_lang',
60
+ :'name_by_lang' => :'name_by_lang',
61
+ :'digest' => :'digest',
62
+ :'packagegroups' => :'packagegroups',
63
+ :'optionalgroups' => :'optionalgroups'
64
+ }
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.openapi_types
69
+ {
70
+ :'id' => :'String',
71
+ :'name' => :'String',
72
+ :'description' => :'String',
73
+ :'display_order' => :'Integer',
74
+ :'group_ids' => :'Object',
75
+ :'option_ids' => :'Object',
76
+ :'desc_by_lang' => :'Object',
77
+ :'name_by_lang' => :'Object',
78
+ :'digest' => :'String',
79
+ :'packagegroups' => :'Array<String>',
80
+ :'optionalgroups' => :'Array<String>'
81
+ }
82
+ end
83
+
84
+ # List of attributes with nullable: true
85
+ def self.openapi_nullable
86
+ Set.new([
87
+ ])
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ if (!attributes.is_a?(Hash))
94
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpRpmClient::RpmPackageEnvironment` initialize method"
95
+ end
96
+
97
+ # check to see if the attribute exists and convert string to symbol for hash key
98
+ attributes = attributes.each_with_object({}) { |(k, v), h|
99
+ if (!self.class.attribute_map.key?(k.to_sym))
100
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpRpmClient::RpmPackageEnvironment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
101
+ end
102
+ h[k.to_sym] = v
103
+ }
104
+
105
+ if attributes.key?(:'id')
106
+ self.id = attributes[:'id']
107
+ end
108
+
109
+ if attributes.key?(:'name')
110
+ self.name = attributes[:'name']
111
+ end
112
+
113
+ if attributes.key?(:'description')
114
+ self.description = attributes[:'description']
115
+ end
116
+
117
+ if attributes.key?(:'display_order')
118
+ self.display_order = attributes[:'display_order']
119
+ end
120
+
121
+ if attributes.key?(:'group_ids')
122
+ self.group_ids = attributes[:'group_ids']
123
+ end
124
+
125
+ if attributes.key?(:'option_ids')
126
+ self.option_ids = attributes[:'option_ids']
127
+ end
128
+
129
+ if attributes.key?(:'desc_by_lang')
130
+ self.desc_by_lang = attributes[:'desc_by_lang']
131
+ end
132
+
133
+ if attributes.key?(:'name_by_lang')
134
+ self.name_by_lang = attributes[:'name_by_lang']
135
+ end
136
+
137
+ if attributes.key?(:'digest')
138
+ self.digest = attributes[:'digest']
139
+ end
140
+
141
+ if attributes.key?(:'packagegroups')
142
+ if (value = attributes[:'packagegroups']).is_a?(Array)
143
+ self.packagegroups = value
144
+ end
145
+ end
146
+
147
+ if attributes.key?(:'optionalgroups')
148
+ if (value = attributes[:'optionalgroups']).is_a?(Array)
149
+ self.optionalgroups = value
150
+ end
151
+ end
152
+ end
153
+
154
+ # Show invalid properties with the reasons. Usually used together with valid?
155
+ # @return Array for valid properties with the reasons
156
+ def list_invalid_properties
157
+ invalid_properties = Array.new
158
+ if @id.nil?
159
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
160
+ end
161
+
162
+ if @id.to_s.length < 1
163
+ invalid_properties.push('invalid value for "id", the character length must be great than or equal to 1.')
164
+ end
165
+
166
+ if @name.nil?
167
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
168
+ end
169
+
170
+ if @name.to_s.length < 1
171
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
172
+ end
173
+
174
+ if @description.nil?
175
+ invalid_properties.push('invalid value for "description", description cannot be nil.')
176
+ end
177
+
178
+ if @description.to_s.length < 1
179
+ invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.')
180
+ end
181
+
182
+ if @display_order.nil?
183
+ invalid_properties.push('invalid value for "display_order", display_order cannot be nil.')
184
+ end
185
+
186
+ if @group_ids.nil?
187
+ invalid_properties.push('invalid value for "group_ids", group_ids cannot be nil.')
188
+ end
189
+
190
+ if @option_ids.nil?
191
+ invalid_properties.push('invalid value for "option_ids", option_ids cannot be nil.')
192
+ end
193
+
194
+ if @desc_by_lang.nil?
195
+ invalid_properties.push('invalid value for "desc_by_lang", desc_by_lang cannot be nil.')
196
+ end
197
+
198
+ if @name_by_lang.nil?
199
+ invalid_properties.push('invalid value for "name_by_lang", name_by_lang cannot be nil.')
200
+ end
201
+
202
+ if @digest.nil?
203
+ invalid_properties.push('invalid value for "digest", digest cannot be nil.')
204
+ end
205
+
206
+ if @digest.to_s.length < 1
207
+ invalid_properties.push('invalid value for "digest", the character length must be great than or equal to 1.')
208
+ end
209
+
210
+ invalid_properties
211
+ end
212
+
213
+ # Check to see if the all the properties in the model are valid
214
+ # @return true if the model is valid
215
+ def valid?
216
+ return false if @id.nil?
217
+ return false if @id.to_s.length < 1
218
+ return false if @name.nil?
219
+ return false if @name.to_s.length < 1
220
+ return false if @description.nil?
221
+ return false if @description.to_s.length < 1
222
+ return false if @display_order.nil?
223
+ return false if @group_ids.nil?
224
+ return false if @option_ids.nil?
225
+ return false if @desc_by_lang.nil?
226
+ return false if @name_by_lang.nil?
227
+ return false if @digest.nil?
228
+ return false if @digest.to_s.length < 1
229
+ true
230
+ end
231
+
232
+ # Custom attribute writer method with validation
233
+ # @param [Object] id Value to be assigned
234
+ def id=(id)
235
+ if id.nil?
236
+ fail ArgumentError, 'id cannot be nil'
237
+ end
238
+
239
+ if id.to_s.length < 1
240
+ fail ArgumentError, 'invalid value for "id", the character length must be great than or equal to 1.'
241
+ end
242
+
243
+ @id = id
244
+ end
245
+
246
+ # Custom attribute writer method with validation
247
+ # @param [Object] name Value to be assigned
248
+ def name=(name)
249
+ if name.nil?
250
+ fail ArgumentError, 'name cannot be nil'
251
+ end
252
+
253
+ if name.to_s.length < 1
254
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
255
+ end
256
+
257
+ @name = name
258
+ end
259
+
260
+ # Custom attribute writer method with validation
261
+ # @param [Object] description Value to be assigned
262
+ def description=(description)
263
+ if description.nil?
264
+ fail ArgumentError, 'description cannot be nil'
265
+ end
266
+
267
+ if description.to_s.length < 1
268
+ fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.'
269
+ end
270
+
271
+ @description = description
272
+ end
273
+
274
+ # Custom attribute writer method with validation
275
+ # @param [Object] digest Value to be assigned
276
+ def digest=(digest)
277
+ if digest.nil?
278
+ fail ArgumentError, 'digest cannot be nil'
279
+ end
280
+
281
+ if digest.to_s.length < 1
282
+ fail ArgumentError, 'invalid value for "digest", the character length must be great than or equal to 1.'
283
+ end
284
+
285
+ @digest = digest
286
+ end
287
+
288
+ # Checks equality by comparing each attribute.
289
+ # @param [Object] Object to be compared
290
+ def ==(o)
291
+ return true if self.equal?(o)
292
+ self.class == o.class &&
293
+ id == o.id &&
294
+ name == o.name &&
295
+ description == o.description &&
296
+ display_order == o.display_order &&
297
+ group_ids == o.group_ids &&
298
+ option_ids == o.option_ids &&
299
+ desc_by_lang == o.desc_by_lang &&
300
+ name_by_lang == o.name_by_lang &&
301
+ digest == o.digest &&
302
+ packagegroups == o.packagegroups &&
303
+ optionalgroups == o.optionalgroups
304
+ end
305
+
306
+ # @see the `==` method
307
+ # @param [Object] Object to be compared
308
+ def eql?(o)
309
+ self == o
310
+ end
311
+
312
+ # Calculates hash code according to all attributes.
313
+ # @return [Integer] Hash code
314
+ def hash
315
+ [id, name, description, display_order, group_ids, option_ids, desc_by_lang, name_by_lang, digest, packagegroups, optionalgroups].hash
316
+ end
317
+
318
+ # Builds the object from hash
319
+ # @param [Hash] attributes Model attributes in the form of hash
320
+ # @return [Object] Returns the model itself
321
+ def self.build_from_hash(attributes)
322
+ new.build_from_hash(attributes)
323
+ end
324
+
325
+ # Builds the object from hash
326
+ # @param [Hash] attributes Model attributes in the form of hash
327
+ # @return [Object] Returns the model itself
328
+ def build_from_hash(attributes)
329
+ return nil unless attributes.is_a?(Hash)
330
+ self.class.openapi_types.each_pair do |key, type|
331
+ if type =~ /\AArray<(.*)>/i
332
+ # check to ensure the input is an array given that the attribute
333
+ # is documented as an array but the input is not
334
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
335
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
336
+ end
337
+ elsif !attributes[self.class.attribute_map[key]].nil?
338
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
339
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
340
+ end
341
+
342
+ self
343
+ end
344
+
345
+ # Deserializes the data based on type
346
+ # @param string type Data type
347
+ # @param string value Value to be deserialized
348
+ # @return [Object] Deserialized data
349
+ def _deserialize(type, value)
350
+ case type.to_sym
351
+ when :DateTime
352
+ DateTime.parse(value)
353
+ when :Date
354
+ Date.parse(value)
355
+ when :String
356
+ value.to_s
357
+ when :Integer
358
+ value.to_i
359
+ when :Float
360
+ value.to_f
361
+ when :Boolean
362
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
363
+ true
364
+ else
365
+ false
366
+ end
367
+ when :Object
368
+ # generic object (usually a Hash), return directly
369
+ value
370
+ when /\AArray<(?<inner_type>.+)>\z/
371
+ inner_type = Regexp.last_match[:inner_type]
372
+ value.map { |v| _deserialize(inner_type, v) }
373
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
374
+ k_type = Regexp.last_match[:k_type]
375
+ v_type = Regexp.last_match[:v_type]
376
+ {}.tap do |hash|
377
+ value.each do |k, v|
378
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
379
+ end
380
+ end
381
+ else # model
382
+ PulpRpmClient.const_get(type).build_from_hash(value)
383
+ end
384
+ end
385
+
386
+ # Returns the string representation of the object
387
+ # @return [String] String presentation of the object
388
+ def to_s
389
+ to_hash.to_s
390
+ end
391
+
392
+ # to_body is an alias to to_hash (backward compatibility)
393
+ # @return [Hash] Returns the object in the form of hash
394
+ def to_body
395
+ to_hash
396
+ end
397
+
398
+ # Returns the object in the form of hash
399
+ # @return [Hash] Returns the object in the form of hash
400
+ def to_hash
401
+ hash = {}
402
+ self.class.attribute_map.each_pair do |attr, param|
403
+ value = self.send(attr)
404
+ if value.nil?
405
+ is_nullable = self.class.openapi_nullable.include?(attr)
406
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
407
+ end
408
+
409
+ hash[param] = _to_hash(value)
410
+ end
411
+ hash
412
+ end
413
+
414
+ # Outputs non-array value in the form of hash
415
+ # For object, use to_hash. Otherwise, just return the value
416
+ # @param [Object] value Any valid value
417
+ # @return [Hash] Returns the value in the form of hash
418
+ def _to_hash(value)
419
+ if value.is_a?(Array)
420
+ value.compact.map { |v| _to_hash(v) }
421
+ elsif value.is_a?(Hash)
422
+ {}.tap do |hash|
423
+ value.each { |k, v| hash[k] = _to_hash(v) }
424
+ end
425
+ elsif value.respond_to? :to_hash
426
+ value.to_hash
427
+ else
428
+ value
429
+ end
430
+ end
431
+ end
432
+ end