pulp_npm_client 0.1.0a4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -10
  3. data/docs/AsyncOperationResponse.md +8 -7
  4. data/docs/ContentPackagesApi.md +126 -64
  5. data/docs/ContentSummaryResponse.md +12 -11
  6. data/docs/DistributionsNpmApi.md +362 -93
  7. data/docs/NpmNpmDistribution.md +20 -15
  8. data/docs/NpmNpmDistributionResponse.md +32 -21
  9. data/docs/NpmNpmRemote.md +48 -47
  10. data/docs/NpmNpmRemoteResponse.md +48 -43
  11. data/docs/NpmNpmRemoteResponseHiddenFieldsInner.md +20 -0
  12. data/docs/NpmNpmRepository.md +16 -15
  13. data/docs/NpmNpmRepositoryResponse.md +28 -23
  14. data/docs/NpmPackageResponse.md +22 -17
  15. data/docs/PaginatedRepositoryVersionResponseList.md +14 -13
  16. data/docs/PaginatednpmNpmDistributionResponseList.md +14 -13
  17. data/docs/PaginatednpmNpmRemoteResponseList.md +14 -13
  18. data/docs/PaginatednpmNpmRepositoryResponseList.md +14 -13
  19. data/docs/PaginatednpmPackageResponseList.md +14 -13
  20. data/docs/PatchednpmNpmDistribution.md +20 -15
  21. data/docs/PatchednpmNpmRemote.md +48 -47
  22. data/docs/PatchednpmNpmRepository.md +16 -15
  23. data/docs/PolicyEnum.md +4 -5
  24. data/docs/RemotesNpmApi.md +364 -99
  25. data/docs/Repair.md +8 -7
  26. data/docs/RepositoriesNpmApi.md +429 -110
  27. data/docs/RepositoriesNpmVersionsApi.md +156 -80
  28. data/docs/RepositoryAddRemoveContent.md +12 -11
  29. data/docs/RepositorySyncURL.md +10 -9
  30. data/docs/RepositoryVersionResponse.md +22 -17
  31. data/docs/SetLabel.md +20 -0
  32. data/docs/SetLabelResponse.md +20 -0
  33. data/docs/UnsetLabel.md +18 -0
  34. data/docs/UnsetLabelResponse.md +20 -0
  35. data/lib/pulp_npm_client/api/content_packages_api.rb +72 -44
  36. data/lib/pulp_npm_client/api/distributions_npm_api.rb +243 -47
  37. data/lib/pulp_npm_client/api/remotes_npm_api.rb +247 -57
  38. data/lib/pulp_npm_client/api/repositories_npm_api.rb +283 -55
  39. data/lib/pulp_npm_client/api/repositories_npm_versions_api.rb +71 -52
  40. data/lib/pulp_npm_client/api_client.rb +137 -102
  41. data/lib/pulp_npm_client/api_error.rb +2 -1
  42. data/lib/pulp_npm_client/configuration.rb +163 -22
  43. data/lib/pulp_npm_client/models/async_operation_response.rb +32 -22
  44. data/lib/pulp_npm_client/models/content_summary_response.rb +36 -22
  45. data/lib/pulp_npm_client/models/npm_npm_distribution.rb +66 -29
  46. data/lib/pulp_npm_client/models/npm_npm_distribution_response.rb +98 -31
  47. data/lib/pulp_npm_client/models/npm_npm_remote.rb +62 -26
  48. data/lib/pulp_npm_client/models/npm_npm_remote_response.rb +100 -42
  49. data/lib/pulp_npm_client/models/npm_npm_remote_response_hidden_fields_inner.rb +237 -0
  50. data/lib/pulp_npm_client/models/npm_npm_repository.rb +38 -26
  51. data/lib/pulp_npm_client/models/npm_npm_repository_response.rb +60 -28
  52. data/lib/pulp_npm_client/models/npm_package_response.rb +59 -25
  53. data/lib/pulp_npm_client/models/paginated_repository_version_response_list.rb +44 -22
  54. data/lib/pulp_npm_client/models/paginatednpm_npm_distribution_response_list.rb +44 -22
  55. data/lib/pulp_npm_client/models/paginatednpm_npm_remote_response_list.rb +44 -22
  56. data/lib/pulp_npm_client/models/paginatednpm_npm_repository_response_list.rb +44 -22
  57. data/lib/pulp_npm_client/models/paginatednpm_package_response_list.rb +44 -22
  58. data/lib/pulp_npm_client/models/patchednpm_npm_distribution.rb +72 -31
  59. data/lib/pulp_npm_client/models/patchednpm_npm_remote.rb +68 -28
  60. data/lib/pulp_npm_client/models/patchednpm_npm_repository.rb +41 -27
  61. data/lib/pulp_npm_client/models/policy_enum.rb +8 -4
  62. data/lib/pulp_npm_client/models/repair.rb +30 -22
  63. data/lib/pulp_npm_client/models/repository_add_remove_content.rb +33 -25
  64. data/lib/pulp_npm_client/models/repository_sync_url.rb +30 -22
  65. data/lib/pulp_npm_client/models/repository_version_response.rb +53 -25
  66. data/lib/pulp_npm_client/models/set_label.rb +264 -0
  67. data/lib/pulp_npm_client/models/set_label_response.rb +255 -0
  68. data/lib/pulp_npm_client/models/unset_label.rb +252 -0
  69. data/lib/pulp_npm_client/models/unset_label_response.rb +252 -0
  70. data/lib/pulp_npm_client/version.rb +2 -2
  71. data/lib/pulp_npm_client.rb +6 -3
  72. data/pulp_npm_client.gemspec +10 -7
  73. data/spec/api/content_packages_api_spec.rb +22 -16
  74. data/spec/api/distributions_npm_api_spec.rb +51 -14
  75. data/spec/api/remotes_npm_api_spec.rb +54 -19
  76. data/spec/api/repositories_npm_api_spec.rb +60 -15
  77. data/spec/api/repositories_npm_versions_api_spec.rb +23 -19
  78. data/spec/models/async_operation_response_spec.rb +7 -12
  79. data/spec/models/content_summary_response_spec.rb +9 -14
  80. data/spec/models/npm_npm_distribution_response_spec.rb +44 -19
  81. data/spec/models/npm_npm_distribution_spec.rb +23 -16
  82. data/spec/models/npm_npm_remote_response_hidden_fields_inner_spec.rb +42 -0
  83. data/spec/models/npm_npm_remote_response_spec.rb +42 -35
  84. data/spec/models/npm_npm_remote_spec.rb +27 -32
  85. data/spec/models/npm_npm_repository_response_spec.rb +27 -20
  86. data/spec/models/npm_npm_repository_spec.rb +11 -16
  87. data/spec/models/npm_package_response_spec.rb +24 -17
  88. data/spec/models/paginated_repository_version_response_list_spec.rb +10 -15
  89. data/spec/models/paginatednpm_npm_distribution_response_list_spec.rb +10 -15
  90. data/spec/models/paginatednpm_npm_remote_response_list_spec.rb +10 -15
  91. data/spec/models/paginatednpm_npm_repository_response_list_spec.rb +10 -15
  92. data/spec/models/paginatednpm_package_response_list_spec.rb +10 -15
  93. data/spec/models/patchednpm_npm_distribution_spec.rb +23 -16
  94. data/spec/models/patchednpm_npm_remote_spec.rb +27 -32
  95. data/spec/models/patchednpm_npm_repository_spec.rb +11 -16
  96. data/spec/models/policy_enum_spec.rb +6 -11
  97. data/spec/models/repair_spec.rb +7 -12
  98. data/spec/models/repository_add_remove_content_spec.rb +9 -14
  99. data/spec/models/repository_sync_url_spec.rb +8 -13
  100. data/spec/models/repository_version_response_spec.rb +24 -17
  101. data/spec/models/set_label_response_spec.rb +42 -0
  102. data/spec/models/set_label_spec.rb +42 -0
  103. data/spec/models/unset_label_response_spec.rb +42 -0
  104. data/spec/models/unset_label_spec.rb +36 -0
  105. data/spec/spec_helper.rb +1 -1
  106. metadata +94 -59
  107. data/docs/NpmPackage.md +0 -29
  108. data/docs/PulpNpmPackagesApi.md +0 -60
  109. data/git_push.sh +0 -58
  110. data/lib/pulp_npm_client/api/pulp_npm_packages_api.rb +0 -86
  111. data/lib/pulp_npm_client/models/npm_package.rb +0 -337
  112. data/spec/api/pulp_npm_packages_api_spec.rb +0 -48
  113. data/spec/api_client_spec.rb +0 -188
  114. data/spec/configuration_spec.rb +0 -42
  115. data/spec/models/npm_package_spec.rb +0 -77
@@ -6,14 +6,15 @@
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 PulpNpmClient
16
- # A Serializer for NpmRemote. Add any new fields if defined on NpmRemote. Similar to the example above, in PackageSerializer. Additional validators can be added to the parent validators list For example:: class Meta: validators = platform.RemoteSerializer.Meta.validators + [myValidator1, myValidator2] By default the 'policy' field in platform.RemoteSerializer only validates the choice 'immediate'. To add on-demand support for more 'policy' options, e.g. 'streamed' or 'on_demand', re-define the 'policy' option as follows::
17
+ # A Serializer for NpmRemote. Add any new fields if defined on NpmRemote. Similar to the example above, in PackageSerializer. Additional validators can be added to the parent validators list For example:: class Meta: validators = core_serializers.RemoteSerializer.Meta.validators + [myValidator1, ...] By default the 'policy' field in core_serializers.RemoteSerializer only validates the choice 'immediate'. To add on-demand support for more 'policy' options, e.g. 'streamed' or 'on_demand', re-define the 'policy' option as follows::
17
18
  class PatchednpmNpmRemote
18
19
  # A unique name for this remote.
19
20
  attr_accessor :name
@@ -56,7 +57,7 @@ module PulpNpmClient
56
57
  # Maximum number of retry attempts after a download failure. If not set then the default value (3) will be used.
57
58
  attr_accessor :max_retries
58
59
 
59
- # The policy to use when downloading content. The possible values include: 'immediate', 'on_demand', and 'streamed'. 'immediate' is the default.
60
+ # The policy to use when downloading content. The possible values include: 'immediate', 'on_demand', and 'streamed'. 'immediate' is the default. * `immediate` - When syncing, download all metadata and content now. * `on_demand` - When syncing, download metadata, but do not download content now. Instead, download content as clients request it, and save it in Pulp to be served for future client requests. * `streamed` - When syncing, download metadata, but do not download content now. Instead,download content as clients request it, but never save it in Pulp. This causes future requests for that same content to have to be downloaded again.
60
61
  attr_accessor :policy
61
62
 
62
63
  # aiohttp.ClientTimeout.total (q.v.) for download-connections. The default is null, which will cause the default from the aiohttp library to be used.
@@ -77,6 +78,28 @@ module PulpNpmClient
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 PulpNpmClient
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
  {
@@ -118,7 +146,7 @@ module PulpNpmClient
118
146
  :'proxy_password' => :'String',
119
147
  :'username' => :'String',
120
148
  :'password' => :'String',
121
- :'pulp_labels' => :'Object',
149
+ :'pulp_labels' => :'Hash<String, String>',
122
150
  :'download_concurrency' => :'Integer',
123
151
  :'max_retries' => :'Integer',
124
152
  :'policy' => :'PolicyEnum',
@@ -212,7 +240,9 @@ module PulpNpmClient
212
240
  end
213
241
 
214
242
  if attributes.key?(:'pulp_labels')
215
- self.pulp_labels = attributes[:'pulp_labels']
243
+ if (value = attributes[:'pulp_labels']).is_a?(Hash)
244
+ self.pulp_labels = value
245
+ end
216
246
  end
217
247
 
218
248
  if attributes.key?(:'download_concurrency')
@@ -257,6 +287,7 @@ module PulpNpmClient
257
287
  # Show invalid properties with the reasons. Usually used together with valid?
258
288
  # @return Array for valid properties with the reasons
259
289
  def list_invalid_properties
290
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
260
291
  invalid_properties = Array.new
261
292
  if !@name.nil? && @name.to_s.length < 1
262
293
  invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
@@ -324,6 +355,7 @@ module PulpNpmClient
324
355
  # Check to see if the all the properties in the model are valid
325
356
  # @return true if the model is valid
326
357
  def valid?
358
+ warn '[DEPRECATED] the `valid?` method is obsolete'
327
359
  return false if !@name.nil? && @name.to_s.length < 1
328
360
  return false if !@url.nil? && @url.to_s.length < 1
329
361
  return false if !@ca_cert.nil? && @ca_cert.to_s.length < 1
@@ -345,7 +377,11 @@ module PulpNpmClient
345
377
  # Custom attribute writer method with validation
346
378
  # @param [Object] name Value to be assigned
347
379
  def name=(name)
348
- 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
349
385
  fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
350
386
  end
351
387
 
@@ -355,7 +391,11 @@ module PulpNpmClient
355
391
  # Custom attribute writer method with validation
356
392
  # @param [Object] url Value to be assigned
357
393
  def url=(url)
358
- 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
359
399
  fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.'
360
400
  end
361
401
 
@@ -536,37 +576,33 @@ module PulpNpmClient
536
576
  # @param [Hash] attributes Model attributes in the form of hash
537
577
  # @return [Object] Returns the model itself
538
578
  def self.build_from_hash(attributes)
539
- new.build_from_hash(attributes)
540
- end
541
-
542
- # Builds the object from hash
543
- # @param [Hash] attributes Model attributes in the form of hash
544
- # @return [Object] Returns the model itself
545
- def build_from_hash(attributes)
546
579
  return nil unless attributes.is_a?(Hash)
547
- self.class.openapi_types.each_pair do |key, type|
548
- 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
549
586
  # check to ensure the input is an array given that the attribute
550
587
  # is documented as an array but the input is not
551
- if attributes[self.class.attribute_map[key]].is_a?(Array)
552
- 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) }
553
590
  end
554
- elsif !attributes[self.class.attribute_map[key]].nil?
555
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
556
- 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
557
594
  end
558
-
559
- self
595
+ new(transformed_hash)
560
596
  end
561
597
 
562
598
  # Deserializes the data based on type
563
599
  # @param string type Data type
564
600
  # @param string value Value to be deserialized
565
601
  # @return [Object] Deserialized data
566
- def _deserialize(type, value)
602
+ def self._deserialize(type, value)
567
603
  case type.to_sym
568
- when :DateTime
569
- DateTime.parse(value)
604
+ when :Time
605
+ Time.parse(value)
570
606
  when :Date
571
607
  Date.parse(value)
572
608
  when :String
@@ -596,7 +632,9 @@ module PulpNpmClient
596
632
  end
597
633
  end
598
634
  else # model
599
- PulpNpmClient.const_get(type).build_from_hash(value)
635
+ # models (e.g. Pet) or oneOf
636
+ klass = PulpNpmClient.const_get(type)
637
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
600
638
  end
601
639
  end
602
640
 
@@ -622,7 +660,7 @@ module PulpNpmClient
622
660
  is_nullable = self.class.openapi_nullable.include?(attr)
623
661
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
624
662
  end
625
-
663
+
626
664
  hash[param] = _to_hash(value)
627
665
  end
628
666
  hash
@@ -645,5 +683,7 @@ module PulpNpmClient
645
683
  value
646
684
  end
647
685
  end
686
+
648
687
  end
688
+
649
689
  end
@@ -6,14 +6,15 @@
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 PulpNpmClient
16
- # A Serializer for NpmRepository. Add any new fields if defined on NpmRepository. Similar to the example above, in PackageSerializer. Additional validators can be added to the parent validators list For example:: class Meta: validators = platform.RepositorySerializer.Meta.validators + [myValidator1, myValidator2]
17
+ # A Serializer for NpmRepository. Add any new fields if defined on NpmRepository. Similar to the example above, in PackageSerializer. Additional validators can be added to the parent validators list For example:: class Meta: validators = core_serializers.RepositorySerializer.Meta.validators + [myValidator1, ...]
17
18
  class PatchednpmNpmRepository
18
19
  attr_accessor :pulp_labels
19
20
 
@@ -23,7 +24,7 @@ module PulpNpmClient
23
24
  # An optional description.
24
25
  attr_accessor :description
25
26
 
26
- # Retain X versions of the repository. Default is null which retains all versions. This is provided as a tech preview in Pulp 3 and may change in the future.
27
+ # Retain X versions of the repository. Default is null which retains all versions.
27
28
  attr_accessor :retain_repo_versions
28
29
 
29
30
  # An optional remote to use by default when syncing.
@@ -40,10 +41,15 @@ module PulpNpmClient
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
  {
46
- :'pulp_labels' => :'Object',
52
+ :'pulp_labels' => :'Hash<String, String>',
47
53
  :'name' => :'String',
48
54
  :'description' => :'String',
49
55
  :'retain_repo_versions' => :'Integer',
@@ -76,7 +82,9 @@ module PulpNpmClient
76
82
  }
77
83
 
78
84
  if attributes.key?(:'pulp_labels')
79
- self.pulp_labels = attributes[:'pulp_labels']
85
+ if (value = attributes[:'pulp_labels']).is_a?(Hash)
86
+ self.pulp_labels = value
87
+ end
80
88
  end
81
89
 
82
90
  if attributes.key?(:'name')
@@ -99,6 +107,7 @@ module PulpNpmClient
99
107
  # Show invalid properties with the reasons. Usually used together with valid?
100
108
  # @return Array for valid properties with the reasons
101
109
  def list_invalid_properties
110
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
102
111
  invalid_properties = Array.new
103
112
  if !@name.nil? && @name.to_s.length < 1
104
113
  invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
@@ -118,6 +127,7 @@ module PulpNpmClient
118
127
  # Check to see if the all the properties in the model are valid
119
128
  # @return true if the model is valid
120
129
  def valid?
130
+ warn '[DEPRECATED] the `valid?` method is obsolete'
121
131
  return false if !@name.nil? && @name.to_s.length < 1
122
132
  return false if !@description.nil? && @description.to_s.length < 1
123
133
  return false if !@retain_repo_versions.nil? && @retain_repo_versions < 1
@@ -127,7 +137,11 @@ module PulpNpmClient
127
137
  # Custom attribute writer method with validation
128
138
  # @param [Object] name Value to be assigned
129
139
  def name=(name)
130
- 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
131
145
  fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
132
146
  end
133
147
 
@@ -182,37 +196,33 @@ module PulpNpmClient
182
196
  # @param [Hash] attributes Model attributes in the form of hash
183
197
  # @return [Object] Returns the model itself
184
198
  def self.build_from_hash(attributes)
185
- new.build_from_hash(attributes)
186
- end
187
-
188
- # Builds the object from hash
189
- # @param [Hash] attributes Model attributes in the form of hash
190
- # @return [Object] Returns the model itself
191
- def build_from_hash(attributes)
192
199
  return nil unless attributes.is_a?(Hash)
193
- self.class.openapi_types.each_pair do |key, type|
194
- 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
195
206
  # check to ensure the input is an array given that the attribute
196
207
  # is documented as an array but the input is not
197
- if attributes[self.class.attribute_map[key]].is_a?(Array)
198
- 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) }
199
210
  end
200
- elsif !attributes[self.class.attribute_map[key]].nil?
201
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
202
- 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
203
214
  end
204
-
205
- self
215
+ new(transformed_hash)
206
216
  end
207
217
 
208
218
  # Deserializes the data based on type
209
219
  # @param string type Data type
210
220
  # @param string value Value to be deserialized
211
221
  # @return [Object] Deserialized data
212
- def _deserialize(type, value)
222
+ def self._deserialize(type, value)
213
223
  case type.to_sym
214
- when :DateTime
215
- DateTime.parse(value)
224
+ when :Time
225
+ Time.parse(value)
216
226
  when :Date
217
227
  Date.parse(value)
218
228
  when :String
@@ -242,7 +252,9 @@ module PulpNpmClient
242
252
  end
243
253
  end
244
254
  else # model
245
- PulpNpmClient.const_get(type).build_from_hash(value)
255
+ # models (e.g. Pet) or oneOf
256
+ klass = PulpNpmClient.const_get(type)
257
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
246
258
  end
247
259
  end
248
260
 
@@ -268,7 +280,7 @@ module PulpNpmClient
268
280
  is_nullable = self.class.openapi_nullable.include?(attr)
269
281
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
270
282
  end
271
-
283
+
272
284
  hash[param] = _to_hash(value)
273
285
  end
274
286
  hash
@@ -291,5 +303,7 @@ module PulpNpmClient
291
303
  value
292
304
  end
293
305
  end
306
+
294
307
  end
308
+
295
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 PulpNpmClient
16
17
  class PolicyEnum
@@ -18,6 +19,10 @@ module PulpNpmClient
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 PulpNpmClient
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 PulpNpmClient
16
17
  class Repair
@@ -24,6 +25,11 @@ module PulpNpmClient
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 PulpNpmClient
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 PulpNpmClient
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 PulpNpmClient
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 PulpNpmClient
156
160
  end
157
161
  end
158
162
  else # model
159
- PulpNpmClient.const_get(type).build_from_hash(value)
163
+ # models (e.g. Pet) or oneOf
164
+ klass = PulpNpmClient.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 PulpNpmClient
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 PulpNpmClient
205
211
  value
206
212
  end
207
213
  end
214
+
208
215
  end
216
+
209
217
  end
@@ -6,14 +6,15 @@
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 PulpNpmClient
16
- # Base serializer for use with :class:`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.
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.
17
18
  class RepositoryAddRemoveContent
18
19
  # A list of content units to add to a new repository version. This content is added after remove_content_units are removed.
19
20
  attr_accessor :add_content_units
@@ -33,11 +34,16 @@ module PulpNpmClient
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
  {
39
- :'add_content_units' => :'Array<AnyType>',
40
- :'remove_content_units' => :'Array<AnyType>',
45
+ :'add_content_units' => :'Array<String>',
46
+ :'remove_content_units' => :'Array<String>',
41
47
  :'base_version' => :'String'
42
48
  }
43
49
  end
@@ -83,6 +89,7 @@ module PulpNpmClient
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 PulpNpmClient
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 PulpNpmClient
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 PulpNpmClient
179
183
  end
180
184
  end
181
185
  else # model
182
- PulpNpmClient.const_get(type).build_from_hash(value)
186
+ # models (e.g. Pet) or oneOf
187
+ klass = PulpNpmClient.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 PulpNpmClient
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 PulpNpmClient
228
234
  value
229
235
  end
230
236
  end
237
+
231
238
  end
239
+
232
240
  end