pulp_gem_client 0.6.1 → 0.7.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 (136) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -8
  3. data/docs/AsyncOperationResponse.md +8 -7
  4. data/docs/ContentGemApi.md +268 -66
  5. data/docs/ContentSummaryResponse.md +12 -11
  6. data/docs/DistributionsGemApi.md +388 -183
  7. data/docs/GemGemContentResponse.md +34 -29
  8. data/docs/GemGemDistribution.md +22 -21
  9. data/docs/GemGemDistributionResponse.md +34 -29
  10. data/docs/GemGemPublication.md +10 -9
  11. data/docs/GemGemPublicationResponse.md +18 -15
  12. data/docs/GemGemRemote.md +54 -53
  13. data/docs/GemGemRemoteResponse.md +54 -51
  14. data/docs/GemGemRemoteResponseHiddenFieldsInner.md +20 -0
  15. data/docs/GemGemRepository.md +16 -15
  16. data/docs/GemGemRepositoryResponse.md +28 -25
  17. data/docs/MyPermissionsResponse.md +8 -7
  18. data/docs/NestedRole.md +12 -11
  19. data/docs/NestedRoleResponse.md +12 -11
  20. data/docs/ObjectRolesResponse.md +8 -7
  21. data/docs/PaginatedRepositoryVersionResponseList.md +14 -13
  22. data/docs/PaginatedgemGemContentResponseList.md +14 -13
  23. data/docs/PaginatedgemGemDistributionResponseList.md +14 -13
  24. data/docs/PaginatedgemGemPublicationResponseList.md +14 -13
  25. data/docs/PaginatedgemGemRemoteResponseList.md +14 -13
  26. data/docs/PaginatedgemGemRepositoryResponseList.md +14 -13
  27. data/docs/PatchedgemGemDistribution.md +22 -21
  28. data/docs/PatchedgemGemRemote.md +54 -53
  29. data/docs/PatchedgemGemRepository.md +16 -15
  30. data/docs/PolicyEnum.md +4 -5
  31. data/docs/PublicationsGemApi.md +271 -132
  32. data/docs/RemotesGemApi.md +392 -185
  33. data/docs/Repair.md +8 -7
  34. data/docs/RepositoriesGemApi.md +449 -210
  35. data/docs/RepositoriesGemVersionsApi.md +155 -83
  36. data/docs/RepositoryAddRemoveContent.md +12 -11
  37. data/docs/RepositorySyncURL.md +10 -9
  38. data/docs/RepositoryVersionResponse.md +22 -19
  39. data/docs/SetLabel.md +10 -9
  40. data/docs/SetLabelResponse.md +10 -9
  41. data/docs/UnsetLabel.md +8 -7
  42. data/docs/UnsetLabelResponse.md +10 -9
  43. data/lib/pulp_gem_client/api/content_gem_api.rb +188 -25
  44. data/lib/pulp_gem_client/api/distributions_gem_api.rb +94 -58
  45. data/lib/pulp_gem_client/api/publications_gem_api.rb +81 -58
  46. data/lib/pulp_gem_client/api/remotes_gem_api.rb +109 -70
  47. data/lib/pulp_gem_client/api/repositories_gem_api.rb +116 -72
  48. data/lib/pulp_gem_client/api/repositories_gem_versions_api.rb +50 -37
  49. data/lib/pulp_gem_client/api_client.rb +137 -102
  50. data/lib/pulp_gem_client/api_error.rb +2 -1
  51. data/lib/pulp_gem_client/configuration.rb +162 -21
  52. data/lib/pulp_gem_client/models/async_operation_response.rb +32 -22
  53. data/lib/pulp_gem_client/models/content_summary_response.rb +36 -22
  54. data/lib/pulp_gem_client/models/gem_gem_content_response.rb +57 -25
  55. data/lib/pulp_gem_client/models/gem_gem_distribution.rb +34 -22
  56. data/lib/pulp_gem_client/models/gem_gem_distribution_response.rb +57 -25
  57. data/lib/pulp_gem_client/models/gem_gem_publication.rb +30 -22
  58. data/lib/pulp_gem_client/models/gem_gem_publication_response.rb +43 -25
  59. data/lib/pulp_gem_client/models/gem_gem_remote.rb +56 -22
  60. data/lib/pulp_gem_client/models/gem_gem_remote_response.rb +70 -26
  61. data/lib/pulp_gem_client/models/{gem_gem_remote_response_hidden_fields.rb → gem_gem_remote_response_hidden_fields_inner.rb} +37 -25
  62. data/lib/pulp_gem_client/models/gem_gem_repository.rb +32 -22
  63. data/lib/pulp_gem_client/models/gem_gem_repository_response.rb +45 -25
  64. data/lib/pulp_gem_client/models/my_permissions_response.rb +32 -22
  65. data/lib/pulp_gem_client/models/nested_role.rb +32 -22
  66. data/lib/pulp_gem_client/models/nested_role_response.rb +32 -22
  67. data/lib/pulp_gem_client/models/object_roles_response.rb +32 -22
  68. data/lib/pulp_gem_client/models/paginated_repository_version_response_list.rb +34 -22
  69. data/lib/pulp_gem_client/models/paginatedgem_gem_content_response_list.rb +34 -22
  70. data/lib/pulp_gem_client/models/paginatedgem_gem_distribution_response_list.rb +34 -22
  71. data/lib/pulp_gem_client/models/paginatedgem_gem_publication_response_list.rb +34 -22
  72. data/lib/pulp_gem_client/models/paginatedgem_gem_remote_response_list.rb +34 -22
  73. data/lib/pulp_gem_client/models/paginatedgem_gem_repository_response_list.rb +34 -22
  74. data/lib/pulp_gem_client/models/patchedgem_gem_distribution.rb +40 -24
  75. data/lib/pulp_gem_client/models/patchedgem_gem_remote.rb +62 -24
  76. data/lib/pulp_gem_client/models/patchedgem_gem_repository.rb +35 -23
  77. data/lib/pulp_gem_client/models/policy_enum.rb +8 -4
  78. data/lib/pulp_gem_client/models/repair.rb +30 -22
  79. data/lib/pulp_gem_client/models/repository_add_remove_content.rb +31 -23
  80. data/lib/pulp_gem_client/models/repository_sync_url.rb +30 -22
  81. data/lib/pulp_gem_client/models/repository_version_response.rb +44 -26
  82. data/lib/pulp_gem_client/models/set_label.rb +34 -22
  83. data/lib/pulp_gem_client/models/set_label_response.rb +34 -22
  84. data/lib/pulp_gem_client/models/unset_label.rb +33 -23
  85. data/lib/pulp_gem_client/models/unset_label_response.rb +33 -23
  86. data/lib/pulp_gem_client/version.rb +2 -2
  87. data/lib/pulp_gem_client.rb +2 -3
  88. data/pulp_gem_client.gemspec +9 -6
  89. data/spec/api/content_gem_api_spec.rb +38 -9
  90. data/spec/api/distributions_gem_api_spec.rb +15 -14
  91. data/spec/api/publications_gem_api_spec.rb +22 -20
  92. data/spec/api/remotes_gem_api_spec.rb +22 -20
  93. data/spec/api/repositories_gem_api_spec.rb +19 -18
  94. data/spec/api/repositories_gem_versions_api_spec.rb +16 -14
  95. data/spec/models/async_operation_response_spec.rb +7 -12
  96. data/spec/models/content_summary_response_spec.rb +9 -14
  97. data/spec/models/gem_gem_content_response_spec.rb +30 -23
  98. data/spec/models/gem_gem_distribution_response_spec.rb +30 -23
  99. data/spec/models/gem_gem_distribution_spec.rb +14 -19
  100. data/spec/models/gem_gem_publication_response_spec.rb +17 -16
  101. data/spec/models/gem_gem_publication_spec.rb +8 -13
  102. data/spec/models/{gem_gem_remote_response_hidden_fields_spec.rb → gem_gem_remote_response_hidden_fields_inner_spec.rb} +11 -16
  103. data/spec/models/gem_gem_remote_response_spec.rb +35 -34
  104. data/spec/models/gem_gem_remote_spec.rb +30 -35
  105. data/spec/models/gem_gem_repository_response_spec.rb +22 -21
  106. data/spec/models/gem_gem_repository_spec.rb +11 -16
  107. data/spec/models/my_permissions_response_spec.rb +7 -12
  108. data/spec/models/nested_role_response_spec.rb +9 -14
  109. data/spec/models/nested_role_spec.rb +9 -14
  110. data/spec/models/object_roles_response_spec.rb +7 -12
  111. data/spec/models/paginated_repository_version_response_list_spec.rb +10 -15
  112. data/spec/models/paginatedgem_gem_content_response_list_spec.rb +10 -15
  113. data/spec/models/paginatedgem_gem_distribution_response_list_spec.rb +10 -15
  114. data/spec/models/paginatedgem_gem_publication_response_list_spec.rb +10 -15
  115. data/spec/models/paginatedgem_gem_remote_response_list_spec.rb +10 -15
  116. data/spec/models/paginatedgem_gem_repository_response_list_spec.rb +10 -15
  117. data/spec/models/patchedgem_gem_distribution_spec.rb +14 -19
  118. data/spec/models/patchedgem_gem_remote_spec.rb +30 -35
  119. data/spec/models/patchedgem_gem_repository_spec.rb +11 -16
  120. data/spec/models/policy_enum_spec.rb +6 -11
  121. data/spec/models/repair_spec.rb +7 -12
  122. data/spec/models/repository_add_remove_content_spec.rb +9 -14
  123. data/spec/models/repository_sync_url_spec.rb +8 -13
  124. data/spec/models/repository_version_response_spec.rb +19 -18
  125. data/spec/models/set_label_response_spec.rb +8 -13
  126. data/spec/models/set_label_spec.rb +8 -13
  127. data/spec/models/unset_label_response_spec.rb +8 -13
  128. data/spec/models/unset_label_spec.rb +7 -12
  129. data/spec/spec_helper.rb +1 -1
  130. metadata +83 -63
  131. data/docs/GemGemContent.md +0 -21
  132. data/docs/GemGemRemoteResponseHiddenFields.md +0 -19
  133. data/lib/pulp_gem_client/models/gem_gem_content.rb +0 -228
  134. data/spec/api_client_spec.rb +0 -188
  135. data/spec/configuration_spec.rb +0 -42
  136. data/spec/models/gem_gem_content_spec.rb +0 -53
@@ -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 PulpGemClient
16
17
  # A Serializer for GemDistribution.
@@ -52,6 +53,11 @@ module PulpGemClient
52
53
  }
53
54
  end
54
55
 
56
+ # Returns all the JSON keys this model knows about
57
+ def self.acceptable_attributes
58
+ attribute_map.values
59
+ end
60
+
55
61
  # Attribute type mapping.
56
62
  def self.openapi_types
57
63
  {
@@ -131,6 +137,7 @@ module PulpGemClient
131
137
  # Show invalid properties with the reasons. Usually used together with valid?
132
138
  # @return Array for valid properties with the reasons
133
139
  def list_invalid_properties
140
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
134
141
  invalid_properties = Array.new
135
142
  if !@base_path.nil? && @base_path.to_s.length < 1
136
143
  invalid_properties.push('invalid value for "base_path", the character length must be great than or equal to 1.')
@@ -146,6 +153,7 @@ module PulpGemClient
146
153
  # Check to see if the all the properties in the model are valid
147
154
  # @return true if the model is valid
148
155
  def valid?
156
+ warn '[DEPRECATED] the `valid?` method is obsolete'
149
157
  return false if !@base_path.nil? && @base_path.to_s.length < 1
150
158
  return false if !@name.nil? && @name.to_s.length < 1
151
159
  true
@@ -154,7 +162,11 @@ module PulpGemClient
154
162
  # Custom attribute writer method with validation
155
163
  # @param [Object] base_path Value to be assigned
156
164
  def base_path=(base_path)
157
- if !base_path.nil? && base_path.to_s.length < 1
165
+ if base_path.nil?
166
+ fail ArgumentError, 'base_path cannot be nil'
167
+ end
168
+
169
+ if base_path.to_s.length < 1
158
170
  fail ArgumentError, 'invalid value for "base_path", the character length must be great than or equal to 1.'
159
171
  end
160
172
 
@@ -164,7 +176,11 @@ module PulpGemClient
164
176
  # Custom attribute writer method with validation
165
177
  # @param [Object] name Value to be assigned
166
178
  def name=(name)
167
- if !name.nil? && name.to_s.length < 1
179
+ if name.nil?
180
+ fail ArgumentError, 'name cannot be nil'
181
+ end
182
+
183
+ if name.to_s.length < 1
168
184
  fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
169
185
  end
170
186
 
@@ -202,37 +218,33 @@ module PulpGemClient
202
218
  # @param [Hash] attributes Model attributes in the form of hash
203
219
  # @return [Object] Returns the model itself
204
220
  def self.build_from_hash(attributes)
205
- new.build_from_hash(attributes)
206
- end
207
-
208
- # Builds the object from hash
209
- # @param [Hash] attributes Model attributes in the form of hash
210
- # @return [Object] Returns the model itself
211
- def build_from_hash(attributes)
212
221
  return nil unless attributes.is_a?(Hash)
213
- self.class.openapi_types.each_pair do |key, type|
214
- if type =~ /\AArray<(.*)>/i
222
+ attributes = attributes.transform_keys(&:to_sym)
223
+ transformed_hash = {}
224
+ openapi_types.each_pair do |key, type|
225
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
226
+ transformed_hash["#{key}"] = nil
227
+ elsif type =~ /\AArray<(.*)>/i
215
228
  # check to ensure the input is an array given that the attribute
216
229
  # is documented as an array but the input is not
217
- if attributes[self.class.attribute_map[key]].is_a?(Array)
218
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
230
+ if attributes[attribute_map[key]].is_a?(Array)
231
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
219
232
  end
220
- elsif !attributes[self.class.attribute_map[key]].nil?
221
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
222
- end # or else data not found in attributes(hash), not an issue as the data can be optional
233
+ elsif !attributes[attribute_map[key]].nil?
234
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
235
+ end
223
236
  end
224
-
225
- self
237
+ new(transformed_hash)
226
238
  end
227
239
 
228
240
  # Deserializes the data based on type
229
241
  # @param string type Data type
230
242
  # @param string value Value to be deserialized
231
243
  # @return [Object] Deserialized data
232
- def _deserialize(type, value)
244
+ def self._deserialize(type, value)
233
245
  case type.to_sym
234
- when :DateTime
235
- DateTime.parse(value)
246
+ when :Time
247
+ Time.parse(value)
236
248
  when :Date
237
249
  Date.parse(value)
238
250
  when :String
@@ -262,7 +274,9 @@ module PulpGemClient
262
274
  end
263
275
  end
264
276
  else # model
265
- PulpGemClient.const_get(type).build_from_hash(value)
277
+ # models (e.g. Pet) or oneOf
278
+ klass = PulpGemClient.const_get(type)
279
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
266
280
  end
267
281
  end
268
282
 
@@ -288,7 +302,7 @@ module PulpGemClient
288
302
  is_nullable = self.class.openapi_nullable.include?(attr)
289
303
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
290
304
  end
291
-
305
+
292
306
  hash[param] = _to_hash(value)
293
307
  end
294
308
  hash
@@ -311,5 +325,7 @@ module PulpGemClient
311
325
  value
312
326
  end
313
327
  end
328
+
314
329
  end
330
+
315
331
  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 PulpGemClient
16
17
  # A Serializer for GemRemote.
@@ -83,6 +84,28 @@ module PulpGemClient
83
84
 
84
85
  attr_accessor :excludes
85
86
 
87
+ class EnumAttributeValidator
88
+ attr_reader :datatype
89
+ attr_reader :allowable_values
90
+
91
+ def initialize(datatype, allowable_values)
92
+ @allowable_values = allowable_values.map do |value|
93
+ case datatype.to_s
94
+ when /Integer/i
95
+ value.to_i
96
+ when /Float/i
97
+ value.to_f
98
+ else
99
+ value
100
+ end
101
+ end
102
+ end
103
+
104
+ def valid?(value)
105
+ !value || allowable_values.include?(value)
106
+ end
107
+ end
108
+
86
109
  # Attribute mapping from ruby-style variable name to JSON key.
87
110
  def self.attribute_map
88
111
  {
@@ -113,6 +136,11 @@ module PulpGemClient
113
136
  }
114
137
  end
115
138
 
139
+ # Returns all the JSON keys this model knows about
140
+ def self.acceptable_attributes
141
+ attribute_map.values
142
+ end
143
+
116
144
  # Attribute type mapping.
117
145
  def self.openapi_types
118
146
  {
@@ -291,6 +319,7 @@ module PulpGemClient
291
319
  # Show invalid properties with the reasons. Usually used together with valid?
292
320
  # @return Array for valid properties with the reasons
293
321
  def list_invalid_properties
322
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
294
323
  invalid_properties = Array.new
295
324
  if !@name.nil? && @name.to_s.length < 1
296
325
  invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
@@ -358,6 +387,7 @@ module PulpGemClient
358
387
  # Check to see if the all the properties in the model are valid
359
388
  # @return true if the model is valid
360
389
  def valid?
390
+ warn '[DEPRECATED] the `valid?` method is obsolete'
361
391
  return false if !@name.nil? && @name.to_s.length < 1
362
392
  return false if !@url.nil? && @url.to_s.length < 1
363
393
  return false if !@ca_cert.nil? && @ca_cert.to_s.length < 1
@@ -379,7 +409,11 @@ module PulpGemClient
379
409
  # Custom attribute writer method with validation
380
410
  # @param [Object] name Value to be assigned
381
411
  def name=(name)
382
- if !name.nil? && name.to_s.length < 1
412
+ if name.nil?
413
+ fail ArgumentError, 'name cannot be nil'
414
+ end
415
+
416
+ if name.to_s.length < 1
383
417
  fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
384
418
  end
385
419
 
@@ -389,7 +423,11 @@ module PulpGemClient
389
423
  # Custom attribute writer method with validation
390
424
  # @param [Object] url Value to be assigned
391
425
  def url=(url)
392
- if !url.nil? && url.to_s.length < 1
426
+ if url.nil?
427
+ fail ArgumentError, 'url cannot be nil'
428
+ end
429
+
430
+ if url.to_s.length < 1
393
431
  fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.'
394
432
  end
395
433
 
@@ -573,37 +611,33 @@ module PulpGemClient
573
611
  # @param [Hash] attributes Model attributes in the form of hash
574
612
  # @return [Object] Returns the model itself
575
613
  def self.build_from_hash(attributes)
576
- new.build_from_hash(attributes)
577
- end
578
-
579
- # Builds the object from hash
580
- # @param [Hash] attributes Model attributes in the form of hash
581
- # @return [Object] Returns the model itself
582
- def build_from_hash(attributes)
583
614
  return nil unless attributes.is_a?(Hash)
584
- self.class.openapi_types.each_pair do |key, type|
585
- if type =~ /\AArray<(.*)>/i
615
+ attributes = attributes.transform_keys(&:to_sym)
616
+ transformed_hash = {}
617
+ openapi_types.each_pair do |key, type|
618
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
619
+ transformed_hash["#{key}"] = nil
620
+ elsif type =~ /\AArray<(.*)>/i
586
621
  # check to ensure the input is an array given that the attribute
587
622
  # is documented as an array but the input is not
588
- if attributes[self.class.attribute_map[key]].is_a?(Array)
589
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
623
+ if attributes[attribute_map[key]].is_a?(Array)
624
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
590
625
  end
591
- elsif !attributes[self.class.attribute_map[key]].nil?
592
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
593
- end # or else data not found in attributes(hash), not an issue as the data can be optional
626
+ elsif !attributes[attribute_map[key]].nil?
627
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
628
+ end
594
629
  end
595
-
596
- self
630
+ new(transformed_hash)
597
631
  end
598
632
 
599
633
  # Deserializes the data based on type
600
634
  # @param string type Data type
601
635
  # @param string value Value to be deserialized
602
636
  # @return [Object] Deserialized data
603
- def _deserialize(type, value)
637
+ def self._deserialize(type, value)
604
638
  case type.to_sym
605
- when :DateTime
606
- DateTime.parse(value)
639
+ when :Time
640
+ Time.parse(value)
607
641
  when :Date
608
642
  Date.parse(value)
609
643
  when :String
@@ -633,7 +667,9 @@ module PulpGemClient
633
667
  end
634
668
  end
635
669
  else # model
636
- PulpGemClient.const_get(type).build_from_hash(value)
670
+ # models (e.g. Pet) or oneOf
671
+ klass = PulpGemClient.const_get(type)
672
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
637
673
  end
638
674
  end
639
675
 
@@ -659,7 +695,7 @@ module PulpGemClient
659
695
  is_nullable = self.class.openapi_nullable.include?(attr)
660
696
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
661
697
  end
662
-
698
+
663
699
  hash[param] = _to_hash(value)
664
700
  end
665
701
  hash
@@ -682,5 +718,7 @@ module PulpGemClient
682
718
  value
683
719
  end
684
720
  end
721
+
685
722
  end
723
+
686
724
  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 PulpGemClient
16
17
  # A Serializer for GemRepository.
@@ -40,6 +41,11 @@ module PulpGemClient
40
41
  }
41
42
  end
42
43
 
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
43
49
  # Attribute type mapping.
44
50
  def self.openapi_types
45
51
  {
@@ -101,6 +107,7 @@ module PulpGemClient
101
107
  # Show invalid properties with the reasons. Usually used together with valid?
102
108
  # @return Array for valid properties with the reasons
103
109
  def list_invalid_properties
110
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
104
111
  invalid_properties = Array.new
105
112
  if !@name.nil? && @name.to_s.length < 1
106
113
  invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
@@ -120,6 +127,7 @@ module PulpGemClient
120
127
  # Check to see if the all the properties in the model are valid
121
128
  # @return true if the model is valid
122
129
  def valid?
130
+ warn '[DEPRECATED] the `valid?` method is obsolete'
123
131
  return false if !@name.nil? && @name.to_s.length < 1
124
132
  return false if !@description.nil? && @description.to_s.length < 1
125
133
  return false if !@retain_repo_versions.nil? && @retain_repo_versions < 1
@@ -129,7 +137,11 @@ module PulpGemClient
129
137
  # Custom attribute writer method with validation
130
138
  # @param [Object] name Value to be assigned
131
139
  def name=(name)
132
- if !name.nil? && name.to_s.length < 1
140
+ if name.nil?
141
+ fail ArgumentError, 'name cannot be nil'
142
+ end
143
+
144
+ if name.to_s.length < 1
133
145
  fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
134
146
  end
135
147
 
@@ -184,37 +196,33 @@ module PulpGemClient
184
196
  # @param [Hash] attributes Model attributes in the form of hash
185
197
  # @return [Object] Returns the model itself
186
198
  def self.build_from_hash(attributes)
187
- new.build_from_hash(attributes)
188
- end
189
-
190
- # Builds the object from hash
191
- # @param [Hash] attributes Model attributes in the form of hash
192
- # @return [Object] Returns the model itself
193
- def build_from_hash(attributes)
194
199
  return nil unless attributes.is_a?(Hash)
195
- self.class.openapi_types.each_pair do |key, type|
196
- if type =~ /\AArray<(.*)>/i
200
+ attributes = attributes.transform_keys(&:to_sym)
201
+ transformed_hash = {}
202
+ openapi_types.each_pair do |key, type|
203
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
204
+ transformed_hash["#{key}"] = nil
205
+ elsif type =~ /\AArray<(.*)>/i
197
206
  # check to ensure the input is an array given that the attribute
198
207
  # is documented as an array but the input is not
199
- if attributes[self.class.attribute_map[key]].is_a?(Array)
200
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
208
+ if attributes[attribute_map[key]].is_a?(Array)
209
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
201
210
  end
202
- elsif !attributes[self.class.attribute_map[key]].nil?
203
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
204
- end # or else data not found in attributes(hash), not an issue as the data can be optional
211
+ elsif !attributes[attribute_map[key]].nil?
212
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
213
+ end
205
214
  end
206
-
207
- self
215
+ new(transformed_hash)
208
216
  end
209
217
 
210
218
  # Deserializes the data based on type
211
219
  # @param string type Data type
212
220
  # @param string value Value to be deserialized
213
221
  # @return [Object] Deserialized data
214
- def _deserialize(type, value)
222
+ def self._deserialize(type, value)
215
223
  case type.to_sym
216
- when :DateTime
217
- DateTime.parse(value)
224
+ when :Time
225
+ Time.parse(value)
218
226
  when :Date
219
227
  Date.parse(value)
220
228
  when :String
@@ -244,7 +252,9 @@ module PulpGemClient
244
252
  end
245
253
  end
246
254
  else # model
247
- PulpGemClient.const_get(type).build_from_hash(value)
255
+ # models (e.g. Pet) or oneOf
256
+ klass = PulpGemClient.const_get(type)
257
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
248
258
  end
249
259
  end
250
260
 
@@ -270,7 +280,7 @@ module PulpGemClient
270
280
  is_nullable = self.class.openapi_nullable.include?(attr)
271
281
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
272
282
  end
273
-
283
+
274
284
  hash[param] = _to_hash(value)
275
285
  end
276
286
  hash
@@ -293,5 +303,7 @@ module PulpGemClient
293
303
  value
294
304
  end
295
305
  end
306
+
296
307
  end
308
+
297
309
  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 PulpGemClient
16
17
  class PolicyEnum
@@ -18,6 +19,10 @@ module PulpGemClient
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 PulpGemClient
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 PulpGemClient
16
17
  class Repair
@@ -24,6 +25,11 @@ module PulpGemClient
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 PulpGemClient
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 PulpGemClient
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 PulpGemClient
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 PulpGemClient
156
160
  end
157
161
  end
158
162
  else # model
159
- PulpGemClient.const_get(type).build_from_hash(value)
163
+ # models (e.g. Pet) or oneOf
164
+ klass = PulpGemClient.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 PulpGemClient
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 PulpGemClient
205
211
  value
206
212
  end
207
213
  end
214
+
208
215
  end
216
+
209
217
  end