pulp_npm_client 0.1.0a4 → 0.1.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 +18 -15
  8. data/docs/NpmNpmDistributionResponse.md +30 -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 +18 -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 +51 -25
  46. data/lib/pulp_npm_client/models/npm_npm_distribution_response.rb +83 -27
  47. data/lib/pulp_npm_client/models/npm_npm_remote.rb +61 -25
  48. data/lib/pulp_npm_client/models/npm_npm_remote_response.rb +99 -41
  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 +37 -25
  51. data/lib/pulp_npm_client/models/npm_npm_repository_response.rb +59 -27
  52. data/lib/pulp_npm_client/models/npm_package_response.rb +58 -24
  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 +57 -27
  59. data/lib/pulp_npm_client/models/patchednpm_npm_remote.rb +67 -27
  60. data/lib/pulp_npm_client/models/patchednpm_npm_repository.rb +40 -26
  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 +38 -19
  81. data/spec/models/npm_npm_distribution_spec.rb +17 -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 +17 -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,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 PaginatednpmPackageResponseList
@@ -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
  # Serializer for NPM Distributions.
@@ -21,6 +22,9 @@ module PulpNpmClient
21
22
  # An optional content-guard.
22
23
  attr_accessor :content_guard
23
24
 
25
+ # Whether this distribution should be shown in the content app.
26
+ attr_accessor :hidden
27
+
24
28
  attr_accessor :pulp_labels
25
29
 
26
30
  # A unique name. Ex, `rawhide` and `stable`.
@@ -34,18 +38,25 @@ module PulpNpmClient
34
38
  {
35
39
  :'base_path' => :'base_path',
36
40
  :'content_guard' => :'content_guard',
41
+ :'hidden' => :'hidden',
37
42
  :'pulp_labels' => :'pulp_labels',
38
43
  :'name' => :'name',
39
44
  :'repository' => :'repository'
40
45
  }
41
46
  end
42
47
 
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
43
53
  # Attribute type mapping.
44
54
  def self.openapi_types
45
55
  {
46
56
  :'base_path' => :'String',
47
57
  :'content_guard' => :'String',
48
- :'pulp_labels' => :'Object',
58
+ :'hidden' => :'Boolean',
59
+ :'pulp_labels' => :'Hash<String, String>',
49
60
  :'name' => :'String',
50
61
  :'repository' => :'String'
51
62
  }
@@ -82,8 +93,16 @@ module PulpNpmClient
82
93
  self.content_guard = attributes[:'content_guard']
83
94
  end
84
95
 
96
+ if attributes.key?(:'hidden')
97
+ self.hidden = attributes[:'hidden']
98
+ else
99
+ self.hidden = false
100
+ end
101
+
85
102
  if attributes.key?(:'pulp_labels')
86
- self.pulp_labels = attributes[:'pulp_labels']
103
+ if (value = attributes[:'pulp_labels']).is_a?(Hash)
104
+ self.pulp_labels = value
105
+ end
87
106
  end
88
107
 
89
108
  if attributes.key?(:'name')
@@ -98,6 +117,7 @@ module PulpNpmClient
98
117
  # Show invalid properties with the reasons. Usually used together with valid?
99
118
  # @return Array for valid properties with the reasons
100
119
  def list_invalid_properties
120
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
101
121
  invalid_properties = Array.new
102
122
  if !@base_path.nil? && @base_path.to_s.length < 1
103
123
  invalid_properties.push('invalid value for "base_path", the character length must be great than or equal to 1.')
@@ -113,6 +133,7 @@ module PulpNpmClient
113
133
  # Check to see if the all the properties in the model are valid
114
134
  # @return true if the model is valid
115
135
  def valid?
136
+ warn '[DEPRECATED] the `valid?` method is obsolete'
116
137
  return false if !@base_path.nil? && @base_path.to_s.length < 1
117
138
  return false if !@name.nil? && @name.to_s.length < 1
118
139
  true
@@ -121,7 +142,11 @@ module PulpNpmClient
121
142
  # Custom attribute writer method with validation
122
143
  # @param [Object] base_path Value to be assigned
123
144
  def base_path=(base_path)
124
- if !base_path.nil? && base_path.to_s.length < 1
145
+ if base_path.nil?
146
+ fail ArgumentError, 'base_path cannot be nil'
147
+ end
148
+
149
+ if base_path.to_s.length < 1
125
150
  fail ArgumentError, 'invalid value for "base_path", the character length must be great than or equal to 1.'
126
151
  end
127
152
 
@@ -131,7 +156,11 @@ module PulpNpmClient
131
156
  # Custom attribute writer method with validation
132
157
  # @param [Object] name Value to be assigned
133
158
  def name=(name)
134
- if !name.nil? && name.to_s.length < 1
159
+ if name.nil?
160
+ fail ArgumentError, 'name cannot be nil'
161
+ end
162
+
163
+ if name.to_s.length < 1
135
164
  fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
136
165
  end
137
166
 
@@ -145,6 +174,7 @@ module PulpNpmClient
145
174
  self.class == o.class &&
146
175
  base_path == o.base_path &&
147
176
  content_guard == o.content_guard &&
177
+ hidden == o.hidden &&
148
178
  pulp_labels == o.pulp_labels &&
149
179
  name == o.name &&
150
180
  repository == o.repository
@@ -159,44 +189,40 @@ module PulpNpmClient
159
189
  # Calculates hash code according to all attributes.
160
190
  # @return [Integer] Hash code
161
191
  def hash
162
- [base_path, content_guard, pulp_labels, name, repository].hash
192
+ [base_path, content_guard, hidden, pulp_labels, name, repository].hash
163
193
  end
164
194
 
165
195
  # Builds the object from hash
166
196
  # @param [Hash] attributes Model attributes in the form of hash
167
197
  # @return [Object] Returns the model itself
168
198
  def self.build_from_hash(attributes)
169
- new.build_from_hash(attributes)
170
- end
171
-
172
- # Builds the object from hash
173
- # @param [Hash] attributes Model attributes in the form of hash
174
- # @return [Object] Returns the model itself
175
- def build_from_hash(attributes)
176
199
  return nil unless attributes.is_a?(Hash)
177
- self.class.openapi_types.each_pair do |key, type|
178
- 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
179
206
  # check to ensure the input is an array given that the attribute
180
207
  # is documented as an array but the input is not
181
- if attributes[self.class.attribute_map[key]].is_a?(Array)
182
- 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) }
183
210
  end
184
- elsif !attributes[self.class.attribute_map[key]].nil?
185
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
186
- 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
187
214
  end
188
-
189
- self
215
+ new(transformed_hash)
190
216
  end
191
217
 
192
218
  # Deserializes the data based on type
193
219
  # @param string type Data type
194
220
  # @param string value Value to be deserialized
195
221
  # @return [Object] Deserialized data
196
- def _deserialize(type, value)
222
+ def self._deserialize(type, value)
197
223
  case type.to_sym
198
- when :DateTime
199
- DateTime.parse(value)
224
+ when :Time
225
+ Time.parse(value)
200
226
  when :Date
201
227
  Date.parse(value)
202
228
  when :String
@@ -226,7 +252,9 @@ module PulpNpmClient
226
252
  end
227
253
  end
228
254
  else # model
229
- 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)
230
258
  end
231
259
  end
232
260
 
@@ -252,7 +280,7 @@ module PulpNpmClient
252
280
  is_nullable = self.class.openapi_nullable.include?(attr)
253
281
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
254
282
  end
255
-
283
+
256
284
  hash[param] = _to_hash(value)
257
285
  end
258
286
  hash
@@ -275,5 +303,7 @@ module PulpNpmClient
275
303
  value
276
304
  end
277
305
  end
306
+
278
307
  end
308
+
279
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
  # 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::
@@ -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