pulp_file_client 3.69.1 → 3.70.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -7
  3. data/docs/AcsFileApi.md +343 -157
  4. data/docs/AsyncOperationResponse.md +8 -7
  5. data/docs/ContentFilesApi.md +114 -64
  6. data/docs/ContentSummaryResponse.md +12 -11
  7. data/docs/DistributionsFileApi.md +385 -182
  8. data/docs/FileFileAlternateContentSource.md +14 -13
  9. data/docs/FileFileAlternateContentSourceResponse.md +22 -21
  10. data/docs/FileFileContentResponse.md +30 -29
  11. data/docs/FileFileDistribution.md +20 -19
  12. data/docs/FileFileDistributionResponse.md +32 -31
  13. data/docs/FileFilePublication.md +12 -11
  14. data/docs/FileFilePublicationResponse.md +22 -21
  15. data/docs/FileFileRemote.md +48 -47
  16. data/docs/FileFileRemoteResponse.md +48 -47
  17. data/docs/FileFileRemoteResponseHiddenFieldsInner.md +20 -0
  18. data/docs/FileFileRepository.md +20 -19
  19. data/docs/FileFileRepositoryResponse.md +32 -31
  20. data/docs/MyPermissionsResponse.md +8 -7
  21. data/docs/NestedRole.md +12 -11
  22. data/docs/NestedRoleResponse.md +12 -11
  23. data/docs/ObjectRolesResponse.md +8 -7
  24. data/docs/PaginatedRepositoryVersionResponseList.md +14 -13
  25. data/docs/PaginatedfileFileAlternateContentSourceResponseList.md +14 -13
  26. data/docs/PaginatedfileFileContentResponseList.md +14 -13
  27. data/docs/PaginatedfileFileDistributionResponseList.md +14 -13
  28. data/docs/PaginatedfileFilePublicationResponseList.md +14 -13
  29. data/docs/PaginatedfileFileRemoteResponseList.md +14 -13
  30. data/docs/PaginatedfileFileRepositoryResponseList.md +14 -13
  31. data/docs/PatchedfileFileAlternateContentSource.md +14 -13
  32. data/docs/PatchedfileFileDistribution.md +20 -19
  33. data/docs/PatchedfileFileRemote.md +48 -47
  34. data/docs/PatchedfileFileRepository.md +20 -19
  35. data/docs/PolicyEnum.md +4 -5
  36. data/docs/PublicationsFileApi.md +267 -130
  37. data/docs/RemotesFileApi.md +389 -184
  38. data/docs/Repair.md +8 -7
  39. data/docs/RepositoriesFileApi.md +444 -207
  40. data/docs/RepositoriesFileVersionsApi.md +152 -82
  41. data/docs/RepositoryAddRemoveContent.md +12 -11
  42. data/docs/RepositorySyncURL.md +10 -9
  43. data/docs/RepositoryVersionResponse.md +22 -21
  44. data/docs/SetLabel.md +10 -9
  45. data/docs/SetLabelResponse.md +10 -9
  46. data/docs/TaskGroupOperationResponse.md +8 -7
  47. data/docs/UnsetLabel.md +8 -7
  48. data/docs/UnsetLabelResponse.md +10 -9
  49. data/lib/pulp_file_client/api/acs_file_api.rb +76 -50
  50. data/lib/pulp_file_client/api/content_files_api.rb +20 -14
  51. data/lib/pulp_file_client/api/distributions_file_api.rb +89 -56
  52. data/lib/pulp_file_client/api/publications_file_api.rb +67 -47
  53. data/lib/pulp_file_client/api/remotes_file_api.rb +104 -68
  54. data/lib/pulp_file_client/api/repositories_file_api.rb +107 -66
  55. data/lib/pulp_file_client/api/repositories_file_versions_api.rb +40 -30
  56. data/lib/pulp_file_client/api_client.rb +137 -102
  57. data/lib/pulp_file_client/api_error.rb +2 -1
  58. data/lib/pulp_file_client/configuration.rb +162 -21
  59. data/lib/pulp_file_client/models/async_operation_response.rb +32 -22
  60. data/lib/pulp_file_client/models/content_summary_response.rb +36 -22
  61. data/lib/pulp_file_client/models/file_file_alternate_content_source.rb +35 -23
  62. data/lib/pulp_file_client/models/file_file_alternate_content_source_response.rb +37 -25
  63. data/lib/pulp_file_client/models/file_file_content_response.rb +34 -24
  64. data/lib/pulp_file_client/models/file_file_distribution.rb +34 -22
  65. data/lib/pulp_file_client/models/file_file_distribution_response.rb +36 -24
  66. data/lib/pulp_file_client/models/file_file_publication.rb +30 -22
  67. data/lib/pulp_file_client/models/file_file_publication_response.rb +32 -24
  68. data/lib/pulp_file_client/models/file_file_remote.rb +56 -22
  69. data/lib/pulp_file_client/models/file_file_remote_response.rb +59 -25
  70. data/lib/pulp_file_client/models/{file_file_remote_response_hidden_fields.rb → file_file_remote_response_hidden_fields_inner.rb} +37 -25
  71. data/lib/pulp_file_client/models/file_file_repository.rb +32 -22
  72. data/lib/pulp_file_client/models/file_file_repository_response.rb +34 -24
  73. data/lib/pulp_file_client/models/my_permissions_response.rb +32 -22
  74. data/lib/pulp_file_client/models/nested_role.rb +32 -22
  75. data/lib/pulp_file_client/models/nested_role_response.rb +32 -22
  76. data/lib/pulp_file_client/models/object_roles_response.rb +32 -22
  77. data/lib/pulp_file_client/models/paginated_repository_version_response_list.rb +34 -22
  78. data/lib/pulp_file_client/models/paginatedfile_file_alternate_content_source_response_list.rb +34 -22
  79. data/lib/pulp_file_client/models/paginatedfile_file_content_response_list.rb +34 -22
  80. data/lib/pulp_file_client/models/paginatedfile_file_distribution_response_list.rb +34 -22
  81. data/lib/pulp_file_client/models/paginatedfile_file_publication_response_list.rb +34 -22
  82. data/lib/pulp_file_client/models/paginatedfile_file_remote_response_list.rb +34 -22
  83. data/lib/pulp_file_client/models/paginatedfile_file_repository_response_list.rb +34 -22
  84. data/lib/pulp_file_client/models/patchedfile_file_alternate_content_source.rb +36 -24
  85. data/lib/pulp_file_client/models/patchedfile_file_distribution.rb +40 -24
  86. data/lib/pulp_file_client/models/patchedfile_file_remote.rb +62 -24
  87. data/lib/pulp_file_client/models/patchedfile_file_repository.rb +35 -23
  88. data/lib/pulp_file_client/models/policy_enum.rb +8 -4
  89. data/lib/pulp_file_client/models/repair.rb +30 -22
  90. data/lib/pulp_file_client/models/repository_add_remove_content.rb +30 -22
  91. data/lib/pulp_file_client/models/repository_sync_url.rb +30 -22
  92. data/lib/pulp_file_client/models/repository_version_response.rb +32 -24
  93. data/lib/pulp_file_client/models/set_label.rb +34 -22
  94. data/lib/pulp_file_client/models/set_label_response.rb +34 -22
  95. data/lib/pulp_file_client/models/task_group_operation_response.rb +32 -22
  96. data/lib/pulp_file_client/models/unset_label.rb +32 -22
  97. data/lib/pulp_file_client/models/unset_label_response.rb +32 -22
  98. data/lib/pulp_file_client/version.rb +2 -2
  99. data/lib/pulp_file_client.rb +2 -3
  100. data/pulp_file_client.gemspec +9 -6
  101. data/spec/api/acs_file_api_spec.rb +12 -12
  102. data/spec/api/content_files_api_spec.rb +4 -4
  103. data/spec/api/distributions_file_api_spec.rb +13 -13
  104. data/spec/api/publications_file_api_spec.rb +16 -15
  105. data/spec/api/remotes_file_api_spec.rb +20 -19
  106. data/spec/api/repositories_file_api_spec.rb +15 -15
  107. data/spec/api/repositories_file_versions_api_spec.rb +12 -11
  108. data/spec/models/async_operation_response_spec.rb +7 -12
  109. data/spec/models/content_summary_response_spec.rb +9 -14
  110. data/spec/models/file_file_alternate_content_source_response_spec.rb +14 -19
  111. data/spec/models/file_file_alternate_content_source_spec.rb +10 -15
  112. data/spec/models/file_file_content_response_spec.rb +18 -23
  113. data/spec/models/file_file_distribution_response_spec.rb +19 -24
  114. data/spec/models/file_file_distribution_spec.rb +13 -18
  115. data/spec/models/file_file_publication_response_spec.rb +14 -19
  116. data/spec/models/file_file_publication_spec.rb +9 -14
  117. data/spec/models/{file_file_remote_response_hidden_fields_spec.rb → file_file_remote_response_hidden_fields_inner_spec.rb} +11 -16
  118. data/spec/models/file_file_remote_response_spec.rb +27 -32
  119. data/spec/models/file_file_remote_spec.rb +27 -32
  120. data/spec/models/file_file_repository_response_spec.rb +19 -24
  121. data/spec/models/file_file_repository_spec.rb +13 -18
  122. data/spec/models/my_permissions_response_spec.rb +7 -12
  123. data/spec/models/nested_role_response_spec.rb +9 -14
  124. data/spec/models/nested_role_spec.rb +9 -14
  125. data/spec/models/object_roles_response_spec.rb +7 -12
  126. data/spec/models/paginated_repository_version_response_list_spec.rb +10 -15
  127. data/spec/models/paginatedfile_file_alternate_content_source_response_list_spec.rb +10 -15
  128. data/spec/models/paginatedfile_file_content_response_list_spec.rb +10 -15
  129. data/spec/models/paginatedfile_file_distribution_response_list_spec.rb +10 -15
  130. data/spec/models/paginatedfile_file_publication_response_list_spec.rb +10 -15
  131. data/spec/models/paginatedfile_file_remote_response_list_spec.rb +10 -15
  132. data/spec/models/paginatedfile_file_repository_response_list_spec.rb +10 -15
  133. data/spec/models/patchedfile_file_alternate_content_source_spec.rb +10 -15
  134. data/spec/models/patchedfile_file_distribution_spec.rb +13 -18
  135. data/spec/models/patchedfile_file_remote_spec.rb +27 -32
  136. data/spec/models/patchedfile_file_repository_spec.rb +13 -18
  137. data/spec/models/policy_enum_spec.rb +6 -11
  138. data/spec/models/repair_spec.rb +7 -12
  139. data/spec/models/repository_add_remove_content_spec.rb +9 -14
  140. data/spec/models/repository_sync_url_spec.rb +8 -13
  141. data/spec/models/repository_version_response_spec.rb +14 -19
  142. data/spec/models/set_label_response_spec.rb +8 -13
  143. data/spec/models/set_label_spec.rb +8 -13
  144. data/spec/models/task_group_operation_response_spec.rb +7 -12
  145. data/spec/models/unset_label_response_spec.rb +8 -13
  146. data/spec/models/unset_label_spec.rb +7 -12
  147. data/spec/spec_helper.rb +1 -1
  148. metadata +45 -25
  149. data/docs/FileFileContent.md +0 -27
  150. data/docs/FileFileRemoteResponseHiddenFields.md +0 -19
  151. data/lib/pulp_file_client/models/file_file_content.rb +0 -297
  152. data/spec/api_client_spec.rb +0 -188
  153. data/spec/configuration_spec.rb +0 -42
  154. data/spec/models/file_file_content_spec.rb +0 -71
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v3
7
7
  Contact: pulp-list@redhat.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.10.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module PulpFileClient
16
17
  # Serializer for File Remotes.
@@ -77,6 +78,28 @@ module PulpFileClient
77
78
  # Limits requests per second for each concurrent downloader
78
79
  attr_accessor :rate_limit
79
80
 
81
+ class EnumAttributeValidator
82
+ attr_reader :datatype
83
+ attr_reader :allowable_values
84
+
85
+ def initialize(datatype, allowable_values)
86
+ @allowable_values = allowable_values.map do |value|
87
+ case datatype.to_s
88
+ when /Integer/i
89
+ value.to_i
90
+ when /Float/i
91
+ value.to_f
92
+ else
93
+ value
94
+ end
95
+ end
96
+ end
97
+
98
+ def valid?(value)
99
+ !value || allowable_values.include?(value)
100
+ end
101
+ end
102
+
80
103
  # Attribute mapping from ruby-style variable name to JSON key.
81
104
  def self.attribute_map
82
105
  {
@@ -104,6 +127,11 @@ module PulpFileClient
104
127
  }
105
128
  end
106
129
 
130
+ # Returns all the JSON keys this model knows about
131
+ def self.acceptable_attributes
132
+ attribute_map.values
133
+ end
134
+
107
135
  # Attribute type mapping.
108
136
  def self.openapi_types
109
137
  {
@@ -259,6 +287,7 @@ module PulpFileClient
259
287
  # Show invalid properties with the reasons. Usually used together with valid?
260
288
  # @return Array for valid properties with the reasons
261
289
  def list_invalid_properties
290
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
262
291
  invalid_properties = Array.new
263
292
  if !@name.nil? && @name.to_s.length < 1
264
293
  invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
@@ -326,6 +355,7 @@ module PulpFileClient
326
355
  # Check to see if the all the properties in the model are valid
327
356
  # @return true if the model is valid
328
357
  def valid?
358
+ warn '[DEPRECATED] the `valid?` method is obsolete'
329
359
  return false if !@name.nil? && @name.to_s.length < 1
330
360
  return false if !@url.nil? && @url.to_s.length < 1
331
361
  return false if !@ca_cert.nil? && @ca_cert.to_s.length < 1
@@ -347,7 +377,11 @@ module PulpFileClient
347
377
  # Custom attribute writer method with validation
348
378
  # @param [Object] name Value to be assigned
349
379
  def name=(name)
350
- if !name.nil? && name.to_s.length < 1
380
+ if name.nil?
381
+ fail ArgumentError, 'name cannot be nil'
382
+ end
383
+
384
+ if name.to_s.length < 1
351
385
  fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
352
386
  end
353
387
 
@@ -357,7 +391,11 @@ module PulpFileClient
357
391
  # Custom attribute writer method with validation
358
392
  # @param [Object] url Value to be assigned
359
393
  def url=(url)
360
- if !url.nil? && url.to_s.length < 1
394
+ if url.nil?
395
+ fail ArgumentError, 'url cannot be nil'
396
+ end
397
+
398
+ if url.to_s.length < 1
361
399
  fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.'
362
400
  end
363
401
 
@@ -538,37 +576,33 @@ module PulpFileClient
538
576
  # @param [Hash] attributes Model attributes in the form of hash
539
577
  # @return [Object] Returns the model itself
540
578
  def self.build_from_hash(attributes)
541
- new.build_from_hash(attributes)
542
- end
543
-
544
- # Builds the object from hash
545
- # @param [Hash] attributes Model attributes in the form of hash
546
- # @return [Object] Returns the model itself
547
- def build_from_hash(attributes)
548
579
  return nil unless attributes.is_a?(Hash)
549
- self.class.openapi_types.each_pair do |key, type|
550
- if type =~ /\AArray<(.*)>/i
580
+ attributes = attributes.transform_keys(&:to_sym)
581
+ transformed_hash = {}
582
+ openapi_types.each_pair do |key, type|
583
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
584
+ transformed_hash["#{key}"] = nil
585
+ elsif type =~ /\AArray<(.*)>/i
551
586
  # check to ensure the input is an array given that the attribute
552
587
  # is documented as an array but the input is not
553
- if attributes[self.class.attribute_map[key]].is_a?(Array)
554
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
588
+ if attributes[attribute_map[key]].is_a?(Array)
589
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
555
590
  end
556
- elsif !attributes[self.class.attribute_map[key]].nil?
557
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
558
- end # or else data not found in attributes(hash), not an issue as the data can be optional
591
+ elsif !attributes[attribute_map[key]].nil?
592
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
593
+ end
559
594
  end
560
-
561
- self
595
+ new(transformed_hash)
562
596
  end
563
597
 
564
598
  # Deserializes the data based on type
565
599
  # @param string type Data type
566
600
  # @param string value Value to be deserialized
567
601
  # @return [Object] Deserialized data
568
- def _deserialize(type, value)
602
+ def self._deserialize(type, value)
569
603
  case type.to_sym
570
- when :DateTime
571
- DateTime.parse(value)
604
+ when :Time
605
+ Time.parse(value)
572
606
  when :Date
573
607
  Date.parse(value)
574
608
  when :String
@@ -598,7 +632,9 @@ module PulpFileClient
598
632
  end
599
633
  end
600
634
  else # model
601
- PulpFileClient.const_get(type).build_from_hash(value)
635
+ # models (e.g. Pet) or oneOf
636
+ klass = PulpFileClient.const_get(type)
637
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
602
638
  end
603
639
  end
604
640
 
@@ -624,7 +660,7 @@ module PulpFileClient
624
660
  is_nullable = self.class.openapi_nullable.include?(attr)
625
661
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
626
662
  end
627
-
663
+
628
664
  hash[param] = _to_hash(value)
629
665
  end
630
666
  hash
@@ -647,5 +683,7 @@ module PulpFileClient
647
683
  value
648
684
  end
649
685
  end
686
+
650
687
  end
688
+
651
689
  end
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v3
7
7
  Contact: pulp-list@redhat.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.10.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module PulpFileClient
16
17
  # Serializer for File Repositories.
@@ -48,6 +49,11 @@ module PulpFileClient
48
49
  }
49
50
  end
50
51
 
52
+ # Returns all the JSON keys this model knows about
53
+ def self.acceptable_attributes
54
+ attribute_map.values
55
+ end
56
+
51
57
  # Attribute type mapping.
52
58
  def self.openapi_types
53
59
  {
@@ -124,6 +130,7 @@ module PulpFileClient
124
130
  # Show invalid properties with the reasons. Usually used together with valid?
125
131
  # @return Array for valid properties with the reasons
126
132
  def list_invalid_properties
133
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
127
134
  invalid_properties = Array.new
128
135
  if !@name.nil? && @name.to_s.length < 1
129
136
  invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
@@ -147,6 +154,7 @@ module PulpFileClient
147
154
  # Check to see if the all the properties in the model are valid
148
155
  # @return true if the model is valid
149
156
  def valid?
157
+ warn '[DEPRECATED] the `valid?` method is obsolete'
150
158
  return false if !@name.nil? && @name.to_s.length < 1
151
159
  return false if !@description.nil? && @description.to_s.length < 1
152
160
  return false if !@retain_repo_versions.nil? && @retain_repo_versions < 1
@@ -157,7 +165,11 @@ module PulpFileClient
157
165
  # Custom attribute writer method with validation
158
166
  # @param [Object] name Value to be assigned
159
167
  def name=(name)
160
- if !name.nil? && name.to_s.length < 1
168
+ if name.nil?
169
+ fail ArgumentError, 'name cannot be nil'
170
+ end
171
+
172
+ if name.to_s.length < 1
161
173
  fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
162
174
  end
163
175
 
@@ -224,37 +236,33 @@ module PulpFileClient
224
236
  # @param [Hash] attributes Model attributes in the form of hash
225
237
  # @return [Object] Returns the model itself
226
238
  def self.build_from_hash(attributes)
227
- new.build_from_hash(attributes)
228
- end
229
-
230
- # Builds the object from hash
231
- # @param [Hash] attributes Model attributes in the form of hash
232
- # @return [Object] Returns the model itself
233
- def build_from_hash(attributes)
234
239
  return nil unless attributes.is_a?(Hash)
235
- self.class.openapi_types.each_pair do |key, type|
236
- if type =~ /\AArray<(.*)>/i
240
+ attributes = attributes.transform_keys(&:to_sym)
241
+ transformed_hash = {}
242
+ openapi_types.each_pair do |key, type|
243
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
244
+ transformed_hash["#{key}"] = nil
245
+ elsif type =~ /\AArray<(.*)>/i
237
246
  # check to ensure the input is an array given that the attribute
238
247
  # is documented as an array but the input is not
239
- if attributes[self.class.attribute_map[key]].is_a?(Array)
240
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
248
+ if attributes[attribute_map[key]].is_a?(Array)
249
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
241
250
  end
242
- elsif !attributes[self.class.attribute_map[key]].nil?
243
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
244
- end # or else data not found in attributes(hash), not an issue as the data can be optional
251
+ elsif !attributes[attribute_map[key]].nil?
252
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
253
+ end
245
254
  end
246
-
247
- self
255
+ new(transformed_hash)
248
256
  end
249
257
 
250
258
  # Deserializes the data based on type
251
259
  # @param string type Data type
252
260
  # @param string value Value to be deserialized
253
261
  # @return [Object] Deserialized data
254
- def _deserialize(type, value)
262
+ def self._deserialize(type, value)
255
263
  case type.to_sym
256
- when :DateTime
257
- DateTime.parse(value)
264
+ when :Time
265
+ Time.parse(value)
258
266
  when :Date
259
267
  Date.parse(value)
260
268
  when :String
@@ -284,7 +292,9 @@ module PulpFileClient
284
292
  end
285
293
  end
286
294
  else # model
287
- PulpFileClient.const_get(type).build_from_hash(value)
295
+ # models (e.g. Pet) or oneOf
296
+ klass = PulpFileClient.const_get(type)
297
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
288
298
  end
289
299
  end
290
300
 
@@ -310,7 +320,7 @@ module PulpFileClient
310
320
  is_nullable = self.class.openapi_nullable.include?(attr)
311
321
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
312
322
  end
313
-
323
+
314
324
  hash[param] = _to_hash(value)
315
325
  end
316
326
  hash
@@ -333,5 +343,7 @@ module PulpFileClient
333
343
  value
334
344
  end
335
345
  end
346
+
336
347
  end
348
+
337
349
  end
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v3
7
7
  Contact: pulp-list@redhat.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.10.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module PulpFileClient
16
17
  class PolicyEnum
@@ -18,6 +19,10 @@ module PulpFileClient
18
19
  ON_DEMAND = "on_demand".freeze
19
20
  STREAMED = "streamed".freeze
20
21
 
22
+ def self.all_vars
23
+ @all_vars ||= [IMMEDIATE, ON_DEMAND, STREAMED].freeze
24
+ end
25
+
21
26
  # Builds the enum from string
22
27
  # @param [String] The enum value in the form of the string
23
28
  # @return [String] The enum value
@@ -29,9 +34,8 @@ module PulpFileClient
29
34
  # @param [String] The enum value in the form of the string
30
35
  # @return [String] The enum value
31
36
  def build_from_hash(value)
32
- constantValues = PolicyEnum.constants.select { |c| PolicyEnum::const_get(c) == value }
33
- raise "Invalid ENUM value #{value} for class #PolicyEnum" if constantValues.empty?
34
- value
37
+ return value if PolicyEnum.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #PolicyEnum"
35
39
  end
36
40
  end
37
41
  end
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v3
7
7
  Contact: pulp-list@redhat.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.10.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module PulpFileClient
16
17
  class Repair
@@ -24,6 +25,11 @@ module PulpFileClient
24
25
  }
25
26
  end
26
27
 
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
27
33
  # Attribute type mapping.
28
34
  def self.openapi_types
29
35
  {
@@ -62,6 +68,7 @@ module PulpFileClient
62
68
  # Show invalid properties with the reasons. Usually used together with valid?
63
69
  # @return Array for valid properties with the reasons
64
70
  def list_invalid_properties
71
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
65
72
  invalid_properties = Array.new
66
73
  invalid_properties
67
74
  end
@@ -69,6 +76,7 @@ module PulpFileClient
69
76
  # Check to see if the all the properties in the model are valid
70
77
  # @return true if the model is valid
71
78
  def valid?
79
+ warn '[DEPRECATED] the `valid?` method is obsolete'
72
80
  true
73
81
  end
74
82
 
@@ -96,37 +104,33 @@ module PulpFileClient
96
104
  # @param [Hash] attributes Model attributes in the form of hash
97
105
  # @return [Object] Returns the model itself
98
106
  def self.build_from_hash(attributes)
99
- new.build_from_hash(attributes)
100
- end
101
-
102
- # Builds the object from hash
103
- # @param [Hash] attributes Model attributes in the form of hash
104
- # @return [Object] Returns the model itself
105
- def build_from_hash(attributes)
106
107
  return nil unless attributes.is_a?(Hash)
107
- self.class.openapi_types.each_pair do |key, type|
108
- if type =~ /\AArray<(.*)>/i
108
+ attributes = attributes.transform_keys(&:to_sym)
109
+ transformed_hash = {}
110
+ openapi_types.each_pair do |key, type|
111
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
112
+ transformed_hash["#{key}"] = nil
113
+ elsif type =~ /\AArray<(.*)>/i
109
114
  # check to ensure the input is an array given that the attribute
110
115
  # is documented as an array but the input is not
111
- if attributes[self.class.attribute_map[key]].is_a?(Array)
112
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
116
+ if attributes[attribute_map[key]].is_a?(Array)
117
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
113
118
  end
114
- elsif !attributes[self.class.attribute_map[key]].nil?
115
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
116
- end # or else data not found in attributes(hash), not an issue as the data can be optional
119
+ elsif !attributes[attribute_map[key]].nil?
120
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
121
+ end
117
122
  end
118
-
119
- self
123
+ new(transformed_hash)
120
124
  end
121
125
 
122
126
  # Deserializes the data based on type
123
127
  # @param string type Data type
124
128
  # @param string value Value to be deserialized
125
129
  # @return [Object] Deserialized data
126
- def _deserialize(type, value)
130
+ def self._deserialize(type, value)
127
131
  case type.to_sym
128
- when :DateTime
129
- DateTime.parse(value)
132
+ when :Time
133
+ Time.parse(value)
130
134
  when :Date
131
135
  Date.parse(value)
132
136
  when :String
@@ -156,7 +160,9 @@ module PulpFileClient
156
160
  end
157
161
  end
158
162
  else # model
159
- PulpFileClient.const_get(type).build_from_hash(value)
163
+ # models (e.g. Pet) or oneOf
164
+ klass = PulpFileClient.const_get(type)
165
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
160
166
  end
161
167
  end
162
168
 
@@ -182,7 +188,7 @@ module PulpFileClient
182
188
  is_nullable = self.class.openapi_nullable.include?(attr)
183
189
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
184
190
  end
185
-
191
+
186
192
  hash[param] = _to_hash(value)
187
193
  end
188
194
  hash
@@ -205,5 +211,7 @@ module PulpFileClient
205
211
  value
206
212
  end
207
213
  end
214
+
208
215
  end
216
+
209
217
  end
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v3
7
7
  Contact: pulp-list@redhat.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.10.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module PulpFileClient
16
17
  # Base serializer for use with [pulpcore.app.models.Model][] This ensures that all Serializers provide values for the 'pulp_href` field. The class provides a default for the ``ref_name`` attribute in the ModelSerializers's ``Meta`` class. This ensures that the OpenAPI definitions of plugins are namespaced properly.
@@ -33,6 +34,11 @@ module PulpFileClient
33
34
  }
34
35
  end
35
36
 
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
36
42
  # Attribute type mapping.
37
43
  def self.openapi_types
38
44
  {
@@ -83,6 +89,7 @@ module PulpFileClient
83
89
  # Show invalid properties with the reasons. Usually used together with valid?
84
90
  # @return Array for valid properties with the reasons
85
91
  def list_invalid_properties
92
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
86
93
  invalid_properties = Array.new
87
94
  invalid_properties
88
95
  end
@@ -90,6 +97,7 @@ module PulpFileClient
90
97
  # Check to see if the all the properties in the model are valid
91
98
  # @return true if the model is valid
92
99
  def valid?
100
+ warn '[DEPRECATED] the `valid?` method is obsolete'
93
101
  true
94
102
  end
95
103
 
@@ -119,37 +127,33 @@ module PulpFileClient
119
127
  # @param [Hash] attributes Model attributes in the form of hash
120
128
  # @return [Object] Returns the model itself
121
129
  def self.build_from_hash(attributes)
122
- new.build_from_hash(attributes)
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 build_from_hash(attributes)
129
130
  return nil unless attributes.is_a?(Hash)
130
- self.class.openapi_types.each_pair do |key, type|
131
- if type =~ /\AArray<(.*)>/i
131
+ attributes = attributes.transform_keys(&:to_sym)
132
+ transformed_hash = {}
133
+ openapi_types.each_pair do |key, type|
134
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
135
+ transformed_hash["#{key}"] = nil
136
+ elsif type =~ /\AArray<(.*)>/i
132
137
  # check to ensure the input is an array given that the attribute
133
138
  # is documented as an array but the input is not
134
- if attributes[self.class.attribute_map[key]].is_a?(Array)
135
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
139
+ if attributes[attribute_map[key]].is_a?(Array)
140
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
136
141
  end
137
- elsif !attributes[self.class.attribute_map[key]].nil?
138
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
139
- end # or else data not found in attributes(hash), not an issue as the data can be optional
142
+ elsif !attributes[attribute_map[key]].nil?
143
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
144
+ end
140
145
  end
141
-
142
- self
146
+ new(transformed_hash)
143
147
  end
144
148
 
145
149
  # Deserializes the data based on type
146
150
  # @param string type Data type
147
151
  # @param string value Value to be deserialized
148
152
  # @return [Object] Deserialized data
149
- def _deserialize(type, value)
153
+ def self._deserialize(type, value)
150
154
  case type.to_sym
151
- when :DateTime
152
- DateTime.parse(value)
155
+ when :Time
156
+ Time.parse(value)
153
157
  when :Date
154
158
  Date.parse(value)
155
159
  when :String
@@ -179,7 +183,9 @@ module PulpFileClient
179
183
  end
180
184
  end
181
185
  else # model
182
- PulpFileClient.const_get(type).build_from_hash(value)
186
+ # models (e.g. Pet) or oneOf
187
+ klass = PulpFileClient.const_get(type)
188
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
183
189
  end
184
190
  end
185
191
 
@@ -205,7 +211,7 @@ module PulpFileClient
205
211
  is_nullable = self.class.openapi_nullable.include?(attr)
206
212
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
213
  end
208
-
214
+
209
215
  hash[param] = _to_hash(value)
210
216
  end
211
217
  hash
@@ -228,5 +234,7 @@ module PulpFileClient
228
234
  value
229
235
  end
230
236
  end
237
+
231
238
  end
239
+
232
240
  end