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,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
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::
17
18
  class NpmNpmRemoteResponse
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 most recent update of the remote.
28
+ attr_accessor :pulp_last_updated
29
+
23
30
  # A unique name for this remote.
24
31
  attr_accessor :name
25
32
 
@@ -40,16 +47,13 @@ module PulpNpmClient
40
47
 
41
48
  attr_accessor :pulp_labels
42
49
 
43
- # Timestamp of the most recent update of the remote.
44
- attr_accessor :pulp_last_updated
45
-
46
50
  # Total number of simultaneous connections. If not set then the default value will be used.
47
51
  attr_accessor :download_concurrency
48
52
 
49
53
  # Maximum number of retry attempts after a download failure. If not set then the default value (3) will be used.
50
54
  attr_accessor :max_retries
51
55
 
52
- # The policy to use when downloading content. The possible values include: 'immediate', 'on_demand', and 'streamed'. 'immediate' is the default.
56
+ # 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.
53
57
  attr_accessor :policy
54
58
 
55
59
  # aiohttp.ClientTimeout.total (q.v.) for download-connections. The default is null, which will cause the default from the aiohttp library to be used.
@@ -70,11 +74,38 @@ module PulpNpmClient
70
74
  # Limits requests per second for each concurrent downloader
71
75
  attr_accessor :rate_limit
72
76
 
77
+ # List of hidden (write only) fields
78
+ attr_accessor :hidden_fields
79
+
80
+ class EnumAttributeValidator
81
+ attr_reader :datatype
82
+ attr_reader :allowable_values
83
+
84
+ def initialize(datatype, allowable_values)
85
+ @allowable_values = allowable_values.map do |value|
86
+ case datatype.to_s
87
+ when /Integer/i
88
+ value.to_i
89
+ when /Float/i
90
+ value.to_f
91
+ else
92
+ value
93
+ end
94
+ end
95
+ end
96
+
97
+ def valid?(value)
98
+ !value || allowable_values.include?(value)
99
+ end
100
+ end
101
+
73
102
  # Attribute mapping from ruby-style variable name to JSON key.
74
103
  def self.attribute_map
75
104
  {
76
105
  :'pulp_href' => :'pulp_href',
106
+ :'prn' => :'prn',
77
107
  :'pulp_created' => :'pulp_created',
108
+ :'pulp_last_updated' => :'pulp_last_updated',
78
109
  :'name' => :'name',
79
110
  :'url' => :'url',
80
111
  :'ca_cert' => :'ca_cert',
@@ -82,7 +113,6 @@ module PulpNpmClient
82
113
  :'tls_validation' => :'tls_validation',
83
114
  :'proxy_url' => :'proxy_url',
84
115
  :'pulp_labels' => :'pulp_labels',
85
- :'pulp_last_updated' => :'pulp_last_updated',
86
116
  :'download_concurrency' => :'download_concurrency',
87
117
  :'max_retries' => :'max_retries',
88
118
  :'policy' => :'policy',
@@ -91,23 +121,30 @@ module PulpNpmClient
91
121
  :'sock_connect_timeout' => :'sock_connect_timeout',
92
122
  :'sock_read_timeout' => :'sock_read_timeout',
93
123
  :'headers' => :'headers',
94
- :'rate_limit' => :'rate_limit'
124
+ :'rate_limit' => :'rate_limit',
125
+ :'hidden_fields' => :'hidden_fields'
95
126
  }
96
127
  end
97
128
 
129
+ # Returns all the JSON keys this model knows about
130
+ def self.acceptable_attributes
131
+ attribute_map.values
132
+ end
133
+
98
134
  # Attribute type mapping.
99
135
  def self.openapi_types
100
136
  {
101
137
  :'pulp_href' => :'String',
102
- :'pulp_created' => :'DateTime',
138
+ :'prn' => :'String',
139
+ :'pulp_created' => :'Time',
140
+ :'pulp_last_updated' => :'Time',
103
141
  :'name' => :'String',
104
142
  :'url' => :'String',
105
143
  :'ca_cert' => :'String',
106
144
  :'client_cert' => :'String',
107
145
  :'tls_validation' => :'Boolean',
108
146
  :'proxy_url' => :'String',
109
- :'pulp_labels' => :'Object',
110
- :'pulp_last_updated' => :'DateTime',
147
+ :'pulp_labels' => :'Hash<String, String>',
111
148
  :'download_concurrency' => :'Integer',
112
149
  :'max_retries' => :'Integer',
113
150
  :'policy' => :'PolicyEnum',
@@ -116,7 +153,8 @@ module PulpNpmClient
116
153
  :'sock_connect_timeout' => :'Float',
117
154
  :'sock_read_timeout' => :'Float',
118
155
  :'headers' => :'Array<Object>',
119
- :'rate_limit' => :'Integer'
156
+ :'rate_limit' => :'Integer',
157
+ :'hidden_fields' => :'Array<NpmNpmRemoteResponseHiddenFieldsInner>'
120
158
  }
121
159
  end
122
160
 
@@ -132,7 +170,7 @@ module PulpNpmClient
132
170
  :'connect_timeout',
133
171
  :'sock_connect_timeout',
134
172
  :'sock_read_timeout',
135
- :'rate_limit'
173
+ :'rate_limit',
136
174
  ])
137
175
  end
138
176
 
@@ -155,16 +193,28 @@ module PulpNpmClient
155
193
  self.pulp_href = attributes[:'pulp_href']
156
194
  end
157
195
 
196
+ if attributes.key?(:'prn')
197
+ self.prn = attributes[:'prn']
198
+ end
199
+
158
200
  if attributes.key?(:'pulp_created')
159
201
  self.pulp_created = attributes[:'pulp_created']
160
202
  end
161
203
 
204
+ if attributes.key?(:'pulp_last_updated')
205
+ self.pulp_last_updated = attributes[:'pulp_last_updated']
206
+ end
207
+
162
208
  if attributes.key?(:'name')
163
209
  self.name = attributes[:'name']
210
+ else
211
+ self.name = nil
164
212
  end
165
213
 
166
214
  if attributes.key?(:'url')
167
215
  self.url = attributes[:'url']
216
+ else
217
+ self.url = nil
168
218
  end
169
219
 
170
220
  if attributes.key?(:'ca_cert')
@@ -184,11 +234,9 @@ module PulpNpmClient
184
234
  end
185
235
 
186
236
  if attributes.key?(:'pulp_labels')
187
- self.pulp_labels = attributes[:'pulp_labels']
188
- end
189
-
190
- if attributes.key?(:'pulp_last_updated')
191
- self.pulp_last_updated = attributes[:'pulp_last_updated']
237
+ if (value = attributes[:'pulp_labels']).is_a?(Hash)
238
+ self.pulp_labels = value
239
+ end
192
240
  end
193
241
 
194
242
  if attributes.key?(:'download_concurrency')
@@ -228,11 +276,18 @@ module PulpNpmClient
228
276
  if attributes.key?(:'rate_limit')
229
277
  self.rate_limit = attributes[:'rate_limit']
230
278
  end
279
+
280
+ if attributes.key?(:'hidden_fields')
281
+ if (value = attributes[:'hidden_fields']).is_a?(Array)
282
+ self.hidden_fields = value
283
+ end
284
+ end
231
285
  end
232
286
 
233
287
  # Show invalid properties with the reasons. Usually used together with valid?
234
288
  # @return Array for valid properties with the reasons
235
289
  def list_invalid_properties
290
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
236
291
  invalid_properties = Array.new
237
292
  if @name.nil?
238
293
  invalid_properties.push('invalid value for "name", name cannot be nil.')
@@ -268,6 +323,7 @@ module PulpNpmClient
268
323
  # Check to see if the all the properties in the model are valid
269
324
  # @return true if the model is valid
270
325
  def valid?
326
+ warn '[DEPRECATED] the `valid?` method is obsolete'
271
327
  return false if @name.nil?
272
328
  return false if @url.nil?
273
329
  return false if !@download_concurrency.nil? && @download_concurrency < 1
@@ -334,7 +390,9 @@ module PulpNpmClient
334
390
  return true if self.equal?(o)
335
391
  self.class == o.class &&
336
392
  pulp_href == o.pulp_href &&
393
+ prn == o.prn &&
337
394
  pulp_created == o.pulp_created &&
395
+ pulp_last_updated == o.pulp_last_updated &&
338
396
  name == o.name &&
339
397
  url == o.url &&
340
398
  ca_cert == o.ca_cert &&
@@ -342,7 +400,6 @@ module PulpNpmClient
342
400
  tls_validation == o.tls_validation &&
343
401
  proxy_url == o.proxy_url &&
344
402
  pulp_labels == o.pulp_labels &&
345
- pulp_last_updated == o.pulp_last_updated &&
346
403
  download_concurrency == o.download_concurrency &&
347
404
  max_retries == o.max_retries &&
348
405
  policy == o.policy &&
@@ -351,7 +408,8 @@ module PulpNpmClient
351
408
  sock_connect_timeout == o.sock_connect_timeout &&
352
409
  sock_read_timeout == o.sock_read_timeout &&
353
410
  headers == o.headers &&
354
- rate_limit == o.rate_limit
411
+ rate_limit == o.rate_limit &&
412
+ hidden_fields == o.hidden_fields
355
413
  end
356
414
 
357
415
  # @see the `==` method
@@ -363,44 +421,40 @@ module PulpNpmClient
363
421
  # Calculates hash code according to all attributes.
364
422
  # @return [Integer] Hash code
365
423
  def hash
366
- [pulp_href, pulp_created, name, url, ca_cert, client_cert, tls_validation, proxy_url, pulp_labels, pulp_last_updated, download_concurrency, max_retries, policy, total_timeout, connect_timeout, sock_connect_timeout, sock_read_timeout, headers, rate_limit].hash
424
+ [pulp_href, prn, pulp_created, pulp_last_updated, name, url, ca_cert, client_cert, tls_validation, proxy_url, pulp_labels, download_concurrency, max_retries, policy, total_timeout, connect_timeout, sock_connect_timeout, sock_read_timeout, headers, rate_limit, hidden_fields].hash
367
425
  end
368
426
 
369
427
  # Builds the object from hash
370
428
  # @param [Hash] attributes Model attributes in the form of hash
371
429
  # @return [Object] Returns the model itself
372
430
  def self.build_from_hash(attributes)
373
- new.build_from_hash(attributes)
374
- end
375
-
376
- # Builds the object from hash
377
- # @param [Hash] attributes Model attributes in the form of hash
378
- # @return [Object] Returns the model itself
379
- def build_from_hash(attributes)
380
431
  return nil unless attributes.is_a?(Hash)
381
- self.class.openapi_types.each_pair do |key, type|
382
- if type =~ /\AArray<(.*)>/i
432
+ attributes = attributes.transform_keys(&:to_sym)
433
+ transformed_hash = {}
434
+ openapi_types.each_pair do |key, type|
435
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
436
+ transformed_hash["#{key}"] = nil
437
+ elsif type =~ /\AArray<(.*)>/i
383
438
  # check to ensure the input is an array given that the attribute
384
439
  # is documented as an array but the input is not
385
- if attributes[self.class.attribute_map[key]].is_a?(Array)
386
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
440
+ if attributes[attribute_map[key]].is_a?(Array)
441
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
387
442
  end
388
- elsif !attributes[self.class.attribute_map[key]].nil?
389
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
390
- end # or else data not found in attributes(hash), not an issue as the data can be optional
443
+ elsif !attributes[attribute_map[key]].nil?
444
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
445
+ end
391
446
  end
392
-
393
- self
447
+ new(transformed_hash)
394
448
  end
395
449
 
396
450
  # Deserializes the data based on type
397
451
  # @param string type Data type
398
452
  # @param string value Value to be deserialized
399
453
  # @return [Object] Deserialized data
400
- def _deserialize(type, value)
454
+ def self._deserialize(type, value)
401
455
  case type.to_sym
402
- when :DateTime
403
- DateTime.parse(value)
456
+ when :Time
457
+ Time.parse(value)
404
458
  when :Date
405
459
  Date.parse(value)
406
460
  when :String
@@ -430,7 +484,9 @@ module PulpNpmClient
430
484
  end
431
485
  end
432
486
  else # model
433
- PulpNpmClient.const_get(type).build_from_hash(value)
487
+ # models (e.g. Pet) or oneOf
488
+ klass = PulpNpmClient.const_get(type)
489
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
434
490
  end
435
491
  end
436
492
 
@@ -456,7 +512,7 @@ module PulpNpmClient
456
512
  is_nullable = self.class.openapi_nullable.include?(attr)
457
513
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
458
514
  end
459
-
515
+
460
516
  hash[param] = _to_hash(value)
461
517
  end
462
518
  hash
@@ -479,5 +535,7 @@ module PulpNpmClient
479
535
  value
480
536
  end
481
537
  end
538
+
482
539
  end
540
+
483
541
  end
@@ -0,0 +1,237 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #Fetch, Upload, Organize, and Distribute Software Packages
5
+
6
+ The version of the OpenAPI document: v3
7
+ Contact: pulp-list@redhat.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PulpNpmClient
17
+ class NpmNpmRemoteResponseHiddenFieldsInner
18
+ attr_accessor :name
19
+
20
+ attr_accessor :is_set
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'name' => :'name',
26
+ :'is_set' => :'is_set'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'name' => :'String',
39
+ :'is_set' => :'Boolean'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpNpmClient::NpmNpmRemoteResponseHiddenFieldsInner` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpNpmClient::NpmNpmRemoteResponseHiddenFieldsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'name')
65
+ self.name = attributes[:'name']
66
+ else
67
+ self.name = nil
68
+ end
69
+
70
+ if attributes.key?(:'is_set')
71
+ self.is_set = attributes[:'is_set']
72
+ else
73
+ self.is_set = nil
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
81
+ invalid_properties = Array.new
82
+ if @name.nil?
83
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
84
+ end
85
+
86
+ if @is_set.nil?
87
+ invalid_properties.push('invalid value for "is_set", is_set cannot be nil.')
88
+ end
89
+
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ warn '[DEPRECATED] the `valid?` method is obsolete'
97
+ return false if @name.nil?
98
+ return false if @is_set.nil?
99
+ true
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(o)
105
+ return true if self.equal?(o)
106
+ self.class == o.class &&
107
+ name == o.name &&
108
+ is_set == o.is_set
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [name, is_set].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ attributes = attributes.transform_keys(&:to_sym)
129
+ transformed_hash = {}
130
+ openapi_types.each_pair do |key, type|
131
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
132
+ transformed_hash["#{key}"] = nil
133
+ elsif type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[attribute_map[key]].is_a?(Array)
137
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
138
+ end
139
+ elsif !attributes[attribute_map[key]].nil?
140
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
141
+ end
142
+ end
143
+ new(transformed_hash)
144
+ end
145
+
146
+ # Deserializes the data based on type
147
+ # @param string type Data type
148
+ # @param string value Value to be deserialized
149
+ # @return [Object] Deserialized data
150
+ def self._deserialize(type, value)
151
+ case type.to_sym
152
+ when :Time
153
+ Time.parse(value)
154
+ when :Date
155
+ Date.parse(value)
156
+ when :String
157
+ value.to_s
158
+ when :Integer
159
+ value.to_i
160
+ when :Float
161
+ value.to_f
162
+ when :Boolean
163
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
164
+ true
165
+ else
166
+ false
167
+ end
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ else # model
183
+ # models (e.g. Pet) or oneOf
184
+ klass = PulpNpmClient.const_get(type)
185
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
186
+ end
187
+ end
188
+
189
+ # Returns the string representation of the object
190
+ # @return [String] String presentation of the object
191
+ def to_s
192
+ to_hash.to_s
193
+ end
194
+
195
+ # to_body is an alias to to_hash (backward compatibility)
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_body
198
+ to_hash
199
+ end
200
+
201
+ # Returns the object in the form of hash
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_hash
204
+ hash = {}
205
+ self.class.attribute_map.each_pair do |attr, param|
206
+ value = self.send(attr)
207
+ if value.nil?
208
+ is_nullable = self.class.openapi_nullable.include?(attr)
209
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
210
+ end
211
+
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+
237
+ end