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,20 +6,27 @@
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 Package. Add serializers for the new fields defined in Package and add those fields to the Meta class keeping fields from the parent class as well. For example:: field1 = serializers.TextField() field2 = serializers.IntegerField() field3 = serializers.CharField() class Meta: fields = platform.SingleArtifactContentSerializer.Meta.fields + ( 'field1', 'field2', 'field3' ) model = models.Package
17
+ # A Serializer for Package. Add serializers for the new fields defined in Package and add those fields to the Meta class keeping fields from the parent class as well. For example:: field1 = serializers.TextField() field2 = serializers.IntegerField() field3 = serializers.CharField() class Meta: fields = core_serializers.SingleArtifactContentSerializer.Meta.fields + ( 'field1', 'field2', 'field3' ) model = models.Package
17
18
  class NpmPackageResponse
18
19
  attr_accessor :pulp_href
19
20
 
21
+ # The Pulp Resource Name (PRN).
22
+ attr_accessor :prn
23
+
20
24
  # Timestamp of creation.
21
25
  attr_accessor :pulp_created
22
26
 
27
+ # Timestamp of the last time this resource was updated. Note: for immutable resources - like content, repository versions, and publication - pulp_created and pulp_last_updated dates will be the same.
28
+ attr_accessor :pulp_last_updated
29
+
23
30
  # Artifact file representing the physical content
24
31
  attr_accessor :artifact
25
32
 
@@ -33,7 +40,9 @@ module PulpNpmClient
33
40
  def self.attribute_map
34
41
  {
35
42
  :'pulp_href' => :'pulp_href',
43
+ :'prn' => :'prn',
36
44
  :'pulp_created' => :'pulp_created',
45
+ :'pulp_last_updated' => :'pulp_last_updated',
37
46
  :'artifact' => :'artifact',
38
47
  :'relative_path' => :'relative_path',
39
48
  :'name' => :'name',
@@ -41,11 +50,18 @@ module PulpNpmClient
41
50
  }
42
51
  end
43
52
 
53
+ # Returns all the JSON keys this model knows about
54
+ def self.acceptable_attributes
55
+ attribute_map.values
56
+ end
57
+
44
58
  # Attribute type mapping.
45
59
  def self.openapi_types
46
60
  {
47
61
  :'pulp_href' => :'String',
48
- :'pulp_created' => :'DateTime',
62
+ :'prn' => :'String',
63
+ :'pulp_created' => :'Time',
64
+ :'pulp_last_updated' => :'Time',
49
65
  :'artifact' => :'String',
50
66
  :'relative_path' => :'String',
51
67
  :'name' => :'String',
@@ -78,30 +94,45 @@ module PulpNpmClient
78
94
  self.pulp_href = attributes[:'pulp_href']
79
95
  end
80
96
 
97
+ if attributes.key?(:'prn')
98
+ self.prn = attributes[:'prn']
99
+ end
100
+
81
101
  if attributes.key?(:'pulp_created')
82
102
  self.pulp_created = attributes[:'pulp_created']
83
103
  end
84
104
 
105
+ if attributes.key?(:'pulp_last_updated')
106
+ self.pulp_last_updated = attributes[:'pulp_last_updated']
107
+ end
108
+
85
109
  if attributes.key?(:'artifact')
86
110
  self.artifact = attributes[:'artifact']
87
111
  end
88
112
 
89
113
  if attributes.key?(:'relative_path')
90
114
  self.relative_path = attributes[:'relative_path']
115
+ else
116
+ self.relative_path = nil
91
117
  end
92
118
 
93
119
  if attributes.key?(:'name')
94
120
  self.name = attributes[:'name']
121
+ else
122
+ self.name = nil
95
123
  end
96
124
 
97
125
  if attributes.key?(:'version')
98
126
  self.version = attributes[:'version']
127
+ else
128
+ self.version = nil
99
129
  end
100
130
  end
101
131
 
102
132
  # Show invalid properties with the reasons. Usually used together with valid?
103
133
  # @return Array for valid properties with the reasons
104
134
  def list_invalid_properties
135
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
105
136
  invalid_properties = Array.new
106
137
  if @relative_path.nil?
107
138
  invalid_properties.push('invalid value for "relative_path", relative_path cannot be nil.')
@@ -121,6 +152,7 @@ module PulpNpmClient
121
152
  # Check to see if the all the properties in the model are valid
122
153
  # @return true if the model is valid
123
154
  def valid?
155
+ warn '[DEPRECATED] the `valid?` method is obsolete'
124
156
  return false if @relative_path.nil?
125
157
  return false if @name.nil?
126
158
  return false if @version.nil?
@@ -133,7 +165,9 @@ module PulpNpmClient
133
165
  return true if self.equal?(o)
134
166
  self.class == o.class &&
135
167
  pulp_href == o.pulp_href &&
168
+ prn == o.prn &&
136
169
  pulp_created == o.pulp_created &&
170
+ pulp_last_updated == o.pulp_last_updated &&
137
171
  artifact == o.artifact &&
138
172
  relative_path == o.relative_path &&
139
173
  name == o.name &&
@@ -149,44 +183,40 @@ module PulpNpmClient
149
183
  # Calculates hash code according to all attributes.
150
184
  # @return [Integer] Hash code
151
185
  def hash
152
- [pulp_href, pulp_created, artifact, relative_path, name, version].hash
186
+ [pulp_href, prn, pulp_created, pulp_last_updated, artifact, relative_path, name, version].hash
153
187
  end
154
188
 
155
189
  # Builds the object from hash
156
190
  # @param [Hash] attributes Model attributes in the form of hash
157
191
  # @return [Object] Returns the model itself
158
192
  def self.build_from_hash(attributes)
159
- new.build_from_hash(attributes)
160
- end
161
-
162
- # Builds the object from hash
163
- # @param [Hash] attributes Model attributes in the form of hash
164
- # @return [Object] Returns the model itself
165
- def build_from_hash(attributes)
166
193
  return nil unless attributes.is_a?(Hash)
167
- self.class.openapi_types.each_pair do |key, type|
168
- if type =~ /\AArray<(.*)>/i
194
+ attributes = attributes.transform_keys(&:to_sym)
195
+ transformed_hash = {}
196
+ openapi_types.each_pair do |key, type|
197
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
198
+ transformed_hash["#{key}"] = nil
199
+ elsif type =~ /\AArray<(.*)>/i
169
200
  # check to ensure the input is an array given that the attribute
170
201
  # is documented as an array but the input is not
171
- if attributes[self.class.attribute_map[key]].is_a?(Array)
172
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
202
+ if attributes[attribute_map[key]].is_a?(Array)
203
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
173
204
  end
174
- elsif !attributes[self.class.attribute_map[key]].nil?
175
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
176
- end # or else data not found in attributes(hash), not an issue as the data can be optional
205
+ elsif !attributes[attribute_map[key]].nil?
206
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
207
+ end
177
208
  end
178
-
179
- self
209
+ new(transformed_hash)
180
210
  end
181
211
 
182
212
  # Deserializes the data based on type
183
213
  # @param string type Data type
184
214
  # @param string value Value to be deserialized
185
215
  # @return [Object] Deserialized data
186
- def _deserialize(type, value)
216
+ def self._deserialize(type, value)
187
217
  case type.to_sym
188
- when :DateTime
189
- DateTime.parse(value)
218
+ when :Time
219
+ Time.parse(value)
190
220
  when :Date
191
221
  Date.parse(value)
192
222
  when :String
@@ -216,7 +246,9 @@ module PulpNpmClient
216
246
  end
217
247
  end
218
248
  else # model
219
- PulpNpmClient.const_get(type).build_from_hash(value)
249
+ # models (e.g. Pet) or oneOf
250
+ klass = PulpNpmClient.const_get(type)
251
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
220
252
  end
221
253
  end
222
254
 
@@ -242,7 +274,7 @@ module PulpNpmClient
242
274
  is_nullable = self.class.openapi_nullable.include?(attr)
243
275
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
244
276
  end
245
-
277
+
246
278
  hash[param] = _to_hash(value)
247
279
  end
248
280
  hash
@@ -265,5 +297,7 @@ module PulpNpmClient
265
297
  value
266
298
  end
267
299
  end
300
+
268
301
  end
302
+
269
303
  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 PaginatedRepositoryVersionResponseList
@@ -32,6 +33,11 @@ module PulpNpmClient
32
33
  }
33
34
  end
34
35
 
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
35
41
  # Attribute type mapping.
36
42
  def self.openapi_types
37
43
  {
@@ -67,6 +73,8 @@ module PulpNpmClient
67
73
 
68
74
  if attributes.key?(:'count')
69
75
  self.count = attributes[:'count']
76
+ else
77
+ self.count = nil
70
78
  end
71
79
 
72
80
  if attributes.key?(:'_next')
@@ -81,19 +89,33 @@ module PulpNpmClient
81
89
  if (value = attributes[:'results']).is_a?(Array)
82
90
  self.results = value
83
91
  end
92
+ else
93
+ self.results = nil
84
94
  end
85
95
  end
86
96
 
87
97
  # Show invalid properties with the reasons. Usually used together with valid?
88
98
  # @return Array for valid properties with the reasons
89
99
  def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
90
101
  invalid_properties = Array.new
102
+ if @count.nil?
103
+ invalid_properties.push('invalid value for "count", count cannot be nil.')
104
+ end
105
+
106
+ if @results.nil?
107
+ invalid_properties.push('invalid value for "results", results cannot be nil.')
108
+ end
109
+
91
110
  invalid_properties
92
111
  end
93
112
 
94
113
  # Check to see if the all the properties in the model are valid
95
114
  # @return true if the model is valid
96
115
  def valid?
116
+ warn '[DEPRECATED] the `valid?` method is obsolete'
117
+ return false if @count.nil?
118
+ return false if @results.nil?
97
119
  true
98
120
  end
99
121
 
@@ -124,37 +146,33 @@ module PulpNpmClient
124
146
  # @param [Hash] attributes Model attributes in the form of hash
125
147
  # @return [Object] Returns the model itself
126
148
  def self.build_from_hash(attributes)
127
- new.build_from_hash(attributes)
128
- end
129
-
130
- # Builds the object from hash
131
- # @param [Hash] attributes Model attributes in the form of hash
132
- # @return [Object] Returns the model itself
133
- def build_from_hash(attributes)
134
149
  return nil unless attributes.is_a?(Hash)
135
- self.class.openapi_types.each_pair do |key, type|
136
- if type =~ /\AArray<(.*)>/i
150
+ attributes = attributes.transform_keys(&:to_sym)
151
+ transformed_hash = {}
152
+ openapi_types.each_pair do |key, type|
153
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
154
+ transformed_hash["#{key}"] = nil
155
+ elsif type =~ /\AArray<(.*)>/i
137
156
  # check to ensure the input is an array given that the attribute
138
157
  # is documented as an array but the input is not
139
- if attributes[self.class.attribute_map[key]].is_a?(Array)
140
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
158
+ if attributes[attribute_map[key]].is_a?(Array)
159
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
141
160
  end
142
- elsif !attributes[self.class.attribute_map[key]].nil?
143
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144
- end # or else data not found in attributes(hash), not an issue as the data can be optional
161
+ elsif !attributes[attribute_map[key]].nil?
162
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
163
+ end
145
164
  end
146
-
147
- self
165
+ new(transformed_hash)
148
166
  end
149
167
 
150
168
  # Deserializes the data based on type
151
169
  # @param string type Data type
152
170
  # @param string value Value to be deserialized
153
171
  # @return [Object] Deserialized data
154
- def _deserialize(type, value)
172
+ def self._deserialize(type, value)
155
173
  case type.to_sym
156
- when :DateTime
157
- DateTime.parse(value)
174
+ when :Time
175
+ Time.parse(value)
158
176
  when :Date
159
177
  Date.parse(value)
160
178
  when :String
@@ -184,7 +202,9 @@ module PulpNpmClient
184
202
  end
185
203
  end
186
204
  else # model
187
- PulpNpmClient.const_get(type).build_from_hash(value)
205
+ # models (e.g. Pet) or oneOf
206
+ klass = PulpNpmClient.const_get(type)
207
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
208
  end
189
209
  end
190
210
 
@@ -210,7 +230,7 @@ module PulpNpmClient
210
230
  is_nullable = self.class.openapi_nullable.include?(attr)
211
231
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
232
  end
213
-
233
+
214
234
  hash[param] = _to_hash(value)
215
235
  end
216
236
  hash
@@ -233,5 +253,7 @@ module PulpNpmClient
233
253
  value
234
254
  end
235
255
  end
256
+
236
257
  end
258
+
237
259
  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 PaginatednpmNpmDistributionResponseList
@@ -32,6 +33,11 @@ module PulpNpmClient
32
33
  }
33
34
  end
34
35
 
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
35
41
  # Attribute type mapping.
36
42
  def self.openapi_types
37
43
  {
@@ -67,6 +73,8 @@ module PulpNpmClient
67
73
 
68
74
  if attributes.key?(:'count')
69
75
  self.count = attributes[:'count']
76
+ else
77
+ self.count = nil
70
78
  end
71
79
 
72
80
  if attributes.key?(:'_next')
@@ -81,19 +89,33 @@ module PulpNpmClient
81
89
  if (value = attributes[:'results']).is_a?(Array)
82
90
  self.results = value
83
91
  end
92
+ else
93
+ self.results = nil
84
94
  end
85
95
  end
86
96
 
87
97
  # Show invalid properties with the reasons. Usually used together with valid?
88
98
  # @return Array for valid properties with the reasons
89
99
  def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
90
101
  invalid_properties = Array.new
102
+ if @count.nil?
103
+ invalid_properties.push('invalid value for "count", count cannot be nil.')
104
+ end
105
+
106
+ if @results.nil?
107
+ invalid_properties.push('invalid value for "results", results cannot be nil.')
108
+ end
109
+
91
110
  invalid_properties
92
111
  end
93
112
 
94
113
  # Check to see if the all the properties in the model are valid
95
114
  # @return true if the model is valid
96
115
  def valid?
116
+ warn '[DEPRECATED] the `valid?` method is obsolete'
117
+ return false if @count.nil?
118
+ return false if @results.nil?
97
119
  true
98
120
  end
99
121
 
@@ -124,37 +146,33 @@ module PulpNpmClient
124
146
  # @param [Hash] attributes Model attributes in the form of hash
125
147
  # @return [Object] Returns the model itself
126
148
  def self.build_from_hash(attributes)
127
- new.build_from_hash(attributes)
128
- end
129
-
130
- # Builds the object from hash
131
- # @param [Hash] attributes Model attributes in the form of hash
132
- # @return [Object] Returns the model itself
133
- def build_from_hash(attributes)
134
149
  return nil unless attributes.is_a?(Hash)
135
- self.class.openapi_types.each_pair do |key, type|
136
- if type =~ /\AArray<(.*)>/i
150
+ attributes = attributes.transform_keys(&:to_sym)
151
+ transformed_hash = {}
152
+ openapi_types.each_pair do |key, type|
153
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
154
+ transformed_hash["#{key}"] = nil
155
+ elsif type =~ /\AArray<(.*)>/i
137
156
  # check to ensure the input is an array given that the attribute
138
157
  # is documented as an array but the input is not
139
- if attributes[self.class.attribute_map[key]].is_a?(Array)
140
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
158
+ if attributes[attribute_map[key]].is_a?(Array)
159
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
141
160
  end
142
- elsif !attributes[self.class.attribute_map[key]].nil?
143
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144
- end # or else data not found in attributes(hash), not an issue as the data can be optional
161
+ elsif !attributes[attribute_map[key]].nil?
162
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
163
+ end
145
164
  end
146
-
147
- self
165
+ new(transformed_hash)
148
166
  end
149
167
 
150
168
  # Deserializes the data based on type
151
169
  # @param string type Data type
152
170
  # @param string value Value to be deserialized
153
171
  # @return [Object] Deserialized data
154
- def _deserialize(type, value)
172
+ def self._deserialize(type, value)
155
173
  case type.to_sym
156
- when :DateTime
157
- DateTime.parse(value)
174
+ when :Time
175
+ Time.parse(value)
158
176
  when :Date
159
177
  Date.parse(value)
160
178
  when :String
@@ -184,7 +202,9 @@ module PulpNpmClient
184
202
  end
185
203
  end
186
204
  else # model
187
- PulpNpmClient.const_get(type).build_from_hash(value)
205
+ # models (e.g. Pet) or oneOf
206
+ klass = PulpNpmClient.const_get(type)
207
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
208
  end
189
209
  end
190
210
 
@@ -210,7 +230,7 @@ module PulpNpmClient
210
230
  is_nullable = self.class.openapi_nullable.include?(attr)
211
231
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
232
  end
213
-
233
+
214
234
  hash[param] = _to_hash(value)
215
235
  end
216
236
  hash
@@ -233,5 +253,7 @@ module PulpNpmClient
233
253
  value
234
254
  end
235
255
  end
256
+
236
257
  end
258
+
237
259
  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 PaginatednpmNpmRemoteResponseList
@@ -32,6 +33,11 @@ module PulpNpmClient
32
33
  }
33
34
  end
34
35
 
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
35
41
  # Attribute type mapping.
36
42
  def self.openapi_types
37
43
  {
@@ -67,6 +73,8 @@ module PulpNpmClient
67
73
 
68
74
  if attributes.key?(:'count')
69
75
  self.count = attributes[:'count']
76
+ else
77
+ self.count = nil
70
78
  end
71
79
 
72
80
  if attributes.key?(:'_next')
@@ -81,19 +89,33 @@ module PulpNpmClient
81
89
  if (value = attributes[:'results']).is_a?(Array)
82
90
  self.results = value
83
91
  end
92
+ else
93
+ self.results = nil
84
94
  end
85
95
  end
86
96
 
87
97
  # Show invalid properties with the reasons. Usually used together with valid?
88
98
  # @return Array for valid properties with the reasons
89
99
  def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
90
101
  invalid_properties = Array.new
102
+ if @count.nil?
103
+ invalid_properties.push('invalid value for "count", count cannot be nil.')
104
+ end
105
+
106
+ if @results.nil?
107
+ invalid_properties.push('invalid value for "results", results cannot be nil.')
108
+ end
109
+
91
110
  invalid_properties
92
111
  end
93
112
 
94
113
  # Check to see if the all the properties in the model are valid
95
114
  # @return true if the model is valid
96
115
  def valid?
116
+ warn '[DEPRECATED] the `valid?` method is obsolete'
117
+ return false if @count.nil?
118
+ return false if @results.nil?
97
119
  true
98
120
  end
99
121
 
@@ -124,37 +146,33 @@ module PulpNpmClient
124
146
  # @param [Hash] attributes Model attributes in the form of hash
125
147
  # @return [Object] Returns the model itself
126
148
  def self.build_from_hash(attributes)
127
- new.build_from_hash(attributes)
128
- end
129
-
130
- # Builds the object from hash
131
- # @param [Hash] attributes Model attributes in the form of hash
132
- # @return [Object] Returns the model itself
133
- def build_from_hash(attributes)
134
149
  return nil unless attributes.is_a?(Hash)
135
- self.class.openapi_types.each_pair do |key, type|
136
- if type =~ /\AArray<(.*)>/i
150
+ attributes = attributes.transform_keys(&:to_sym)
151
+ transformed_hash = {}
152
+ openapi_types.each_pair do |key, type|
153
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
154
+ transformed_hash["#{key}"] = nil
155
+ elsif type =~ /\AArray<(.*)>/i
137
156
  # check to ensure the input is an array given that the attribute
138
157
  # is documented as an array but the input is not
139
- if attributes[self.class.attribute_map[key]].is_a?(Array)
140
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
158
+ if attributes[attribute_map[key]].is_a?(Array)
159
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
141
160
  end
142
- elsif !attributes[self.class.attribute_map[key]].nil?
143
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144
- end # or else data not found in attributes(hash), not an issue as the data can be optional
161
+ elsif !attributes[attribute_map[key]].nil?
162
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
163
+ end
145
164
  end
146
-
147
- self
165
+ new(transformed_hash)
148
166
  end
149
167
 
150
168
  # Deserializes the data based on type
151
169
  # @param string type Data type
152
170
  # @param string value Value to be deserialized
153
171
  # @return [Object] Deserialized data
154
- def _deserialize(type, value)
172
+ def self._deserialize(type, value)
155
173
  case type.to_sym
156
- when :DateTime
157
- DateTime.parse(value)
174
+ when :Time
175
+ Time.parse(value)
158
176
  when :Date
159
177
  Date.parse(value)
160
178
  when :String
@@ -184,7 +202,9 @@ module PulpNpmClient
184
202
  end
185
203
  end
186
204
  else # model
187
- PulpNpmClient.const_get(type).build_from_hash(value)
205
+ # models (e.g. Pet) or oneOf
206
+ klass = PulpNpmClient.const_get(type)
207
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
208
  end
189
209
  end
190
210
 
@@ -210,7 +230,7 @@ module PulpNpmClient
210
230
  is_nullable = self.class.openapi_nullable.include?(attr)
211
231
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
232
  end
213
-
233
+
214
234
  hash[param] = _to_hash(value)
215
235
  end
216
236
  hash
@@ -233,5 +253,7 @@ module PulpNpmClient
233
253
  value
234
254
  end
235
255
  end
256
+
236
257
  end
258
+
237
259
  end