pulpcore_client 3.22.20 → 3.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -4
- data/docs/ArtifactDistributionResponse.md +9 -9
- data/docs/DistributionsApi.md +4 -0
- data/docs/DistributionsArtifactsApi.md +4 -0
- data/docs/Domain.md +27 -0
- data/docs/DomainResponse.md +31 -0
- data/docs/DomainsApi.md +362 -0
- data/docs/ExportersFilesystemApi.md +3 -3
- data/docs/ExportersFilesystemExportsApi.md +3 -3
- data/docs/GroupRole.md +3 -1
- data/docs/GroupRoleResponse.md +3 -1
- data/docs/GroupsApi.md +6 -6
- data/docs/GroupsRolesApi.md +6 -4
- data/docs/PaginatedDomainResponseList.md +23 -0
- data/docs/PaginatedUpstreamPulpResponseList.md +23 -0
- data/docs/PatchedDomain.md +27 -0
- data/docs/PatchedUpstreamPulp.md +37 -0
- data/docs/RepositoriesApi.md +16 -0
- data/docs/RepositoryResponse.md +1 -1
- data/docs/RolesApi.md +6 -6
- data/docs/StatusResponse.md +3 -1
- data/docs/StorageClassEnum.md +16 -0
- data/docs/TaskSchedulesApi.md +2 -2
- data/docs/TasksApi.md +1 -1
- data/docs/UpstreamPulp.md +37 -0
- data/docs/UpstreamPulpResponse.md +39 -0
- data/docs/UpstreamPulpsApi.md +405 -0
- data/docs/UserRole.md +4 -2
- data/docs/UserRoleResponse.md +4 -2
- data/docs/UsersApi.md +6 -6
- data/docs/UsersRolesApi.md +6 -4
- data/docs/VersionResponse.md +3 -1
- data/lib/pulpcore_client/api/distributions_api.rb +6 -0
- data/lib/pulpcore_client/api/distributions_artifacts_api.rb +6 -0
- data/lib/pulpcore_client/api/domains_api.rb +446 -0
- data/lib/pulpcore_client/api/exporters_filesystem_api.rb +6 -6
- data/lib/pulpcore_client/api/exporters_filesystem_exports_api.rb +6 -6
- data/lib/pulpcore_client/api/groups_api.rb +12 -12
- data/lib/pulpcore_client/api/groups_roles_api.rb +11 -8
- data/lib/pulpcore_client/api/repositories_api.rb +24 -0
- data/lib/pulpcore_client/api/roles_api.rb +12 -12
- data/lib/pulpcore_client/api/task_schedules_api.rb +4 -4
- data/lib/pulpcore_client/api/tasks_api.rb +2 -2
- data/lib/pulpcore_client/api/upstream_pulps_api.rb +492 -0
- data/lib/pulpcore_client/api/users_api.rb +12 -12
- data/lib/pulpcore_client/api/users_roles_api.rb +11 -8
- data/lib/pulpcore_client/api/workers_api.rb +1 -1
- data/lib/pulpcore_client/models/artifact_distribution_response.rb +43 -43
- data/lib/pulpcore_client/models/domain.rb +323 -0
- data/lib/pulpcore_client/models/domain_response.rb +318 -0
- data/lib/pulpcore_client/models/group_role.rb +16 -5
- data/lib/pulpcore_client/models/group_role_response.rb +15 -4
- data/lib/pulpcore_client/models/nested_role.rb +19 -0
- data/lib/pulpcore_client/models/paginated_domain_response_list.rb +237 -0
- data/lib/pulpcore_client/models/paginated_upstream_pulp_response_list.rb +237 -0
- data/lib/pulpcore_client/models/patched_domain.rb +304 -0
- data/lib/pulpcore_client/models/patched_upstream_pulp.rb +450 -0
- data/lib/pulpcore_client/models/repository_response.rb +1 -1
- data/lib/pulpcore_client/models/status_response.rb +19 -4
- data/lib/pulpcore_client/models/storage_class_enum.rb +37 -0
- data/lib/pulpcore_client/models/upstream_pulp.rb +477 -0
- data/lib/pulpcore_client/models/upstream_pulp_response.rb +338 -0
- data/lib/pulpcore_client/models/user_role.rb +17 -6
- data/lib/pulpcore_client/models/user_role_response.rb +16 -5
- data/lib/pulpcore_client/models/version_response.rb +19 -4
- data/lib/pulpcore_client/version.rb +1 -1
- data/lib/pulpcore_client.rb +11 -0
- data/spec/api/distributions_api_spec.rb +2 -0
- data/spec/api/distributions_artifacts_api_spec.rb +2 -0
- data/spec/api/domains_api_spec.rb +120 -0
- data/spec/api/exporters_filesystem_api_spec.rb +3 -3
- data/spec/api/exporters_filesystem_exports_api_spec.rb +3 -3
- data/spec/api/groups_api_spec.rb +6 -6
- data/spec/api/groups_roles_api_spec.rb +5 -4
- data/spec/api/repositories_api_spec.rb +8 -0
- data/spec/api/roles_api_spec.rb +6 -6
- data/spec/api/task_schedules_api_spec.rb +2 -2
- data/spec/api/tasks_api_spec.rb +1 -1
- data/spec/api/upstream_pulps_api_spec.rb +127 -0
- data/spec/api/users_api_spec.rb +6 -6
- data/spec/api/users_roles_api_spec.rb +5 -4
- data/spec/models/artifact_distribution_response_spec.rb +7 -7
- data/spec/models/domain_response_spec.rb +83 -0
- data/spec/models/domain_spec.rb +71 -0
- data/spec/models/group_role_response_spec.rb +6 -0
- data/spec/models/group_role_spec.rb +6 -0
- data/spec/models/paginated_domain_response_list_spec.rb +59 -0
- data/spec/models/paginated_upstream_pulp_response_list_spec.rb +59 -0
- data/spec/models/patched_domain_spec.rb +71 -0
- data/spec/models/patched_upstream_pulp_spec.rb +101 -0
- data/spec/models/status_response_spec.rb +6 -0
- data/spec/models/storage_class_enum_spec.rb +35 -0
- data/spec/models/upstream_pulp_response_spec.rb +107 -0
- data/spec/models/upstream_pulp_spec.rb +101 -0
- data/spec/models/user_role_response_spec.rb +6 -0
- data/spec/models/user_role_spec.rb +6 -0
- data/spec/models/version_response_spec.rb +6 -0
- metadata +178 -134
@@ -0,0 +1,477 @@
|
|
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
|
+
OpenAPI Generator version: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpcoreClient
|
16
|
+
# Serializer for a Server.
|
17
|
+
class UpstreamPulp
|
18
|
+
# A unique name for this Pulp server.
|
19
|
+
attr_accessor :name
|
20
|
+
|
21
|
+
# The transport, hostname, and an optional port of the Pulp server. e.g. https://example.com
|
22
|
+
attr_accessor :base_url
|
23
|
+
|
24
|
+
# The API root. Defaults to '/pulp/'.
|
25
|
+
attr_accessor :api_root
|
26
|
+
|
27
|
+
# The domain of the Pulp server if enabled.
|
28
|
+
attr_accessor :domain
|
29
|
+
|
30
|
+
# A PEM encoded CA certificate used to validate the server certificate presented by the remote server.
|
31
|
+
attr_accessor :ca_cert
|
32
|
+
|
33
|
+
# A PEM encoded client certificate used for authentication.
|
34
|
+
attr_accessor :client_cert
|
35
|
+
|
36
|
+
# A PEM encoded private key used for authentication.
|
37
|
+
attr_accessor :client_key
|
38
|
+
|
39
|
+
# If True, TLS peer validation must be performed.
|
40
|
+
attr_accessor :tls_validation
|
41
|
+
|
42
|
+
# The username to be used for authentication when syncing.
|
43
|
+
attr_accessor :username
|
44
|
+
|
45
|
+
# The password to be used for authentication when syncing. Extra leading and trailing whitespace characters are not trimmed.
|
46
|
+
attr_accessor :password
|
47
|
+
|
48
|
+
# One or more comma separated labels that will be used to filter distributions on the upstream Pulp. E.g. \"foo=bar,key=val\" or \"foo,key\"
|
49
|
+
attr_accessor :pulp_label_select
|
50
|
+
|
51
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
52
|
+
def self.attribute_map
|
53
|
+
{
|
54
|
+
:'name' => :'name',
|
55
|
+
:'base_url' => :'base_url',
|
56
|
+
:'api_root' => :'api_root',
|
57
|
+
:'domain' => :'domain',
|
58
|
+
:'ca_cert' => :'ca_cert',
|
59
|
+
:'client_cert' => :'client_cert',
|
60
|
+
:'client_key' => :'client_key',
|
61
|
+
:'tls_validation' => :'tls_validation',
|
62
|
+
:'username' => :'username',
|
63
|
+
:'password' => :'password',
|
64
|
+
:'pulp_label_select' => :'pulp_label_select'
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
# Attribute type mapping.
|
69
|
+
def self.openapi_types
|
70
|
+
{
|
71
|
+
:'name' => :'String',
|
72
|
+
:'base_url' => :'String',
|
73
|
+
:'api_root' => :'String',
|
74
|
+
:'domain' => :'String',
|
75
|
+
:'ca_cert' => :'String',
|
76
|
+
:'client_cert' => :'String',
|
77
|
+
:'client_key' => :'String',
|
78
|
+
:'tls_validation' => :'Boolean',
|
79
|
+
:'username' => :'String',
|
80
|
+
:'password' => :'String',
|
81
|
+
:'pulp_label_select' => :'String'
|
82
|
+
}
|
83
|
+
end
|
84
|
+
|
85
|
+
# List of attributes with nullable: true
|
86
|
+
def self.openapi_nullable
|
87
|
+
Set.new([
|
88
|
+
:'domain',
|
89
|
+
:'ca_cert',
|
90
|
+
:'client_cert',
|
91
|
+
:'client_key',
|
92
|
+
:'username',
|
93
|
+
:'password',
|
94
|
+
:'pulp_label_select'
|
95
|
+
])
|
96
|
+
end
|
97
|
+
|
98
|
+
# Initializes the object
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
100
|
+
def initialize(attributes = {})
|
101
|
+
if (!attributes.is_a?(Hash))
|
102
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::UpstreamPulp` initialize method"
|
103
|
+
end
|
104
|
+
|
105
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
106
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
107
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
108
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::UpstreamPulp`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
109
|
+
end
|
110
|
+
h[k.to_sym] = v
|
111
|
+
}
|
112
|
+
|
113
|
+
if attributes.key?(:'name')
|
114
|
+
self.name = attributes[:'name']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'base_url')
|
118
|
+
self.base_url = attributes[:'base_url']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.key?(:'api_root')
|
122
|
+
self.api_root = attributes[:'api_root']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.key?(:'domain')
|
126
|
+
self.domain = attributes[:'domain']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.key?(:'ca_cert')
|
130
|
+
self.ca_cert = attributes[:'ca_cert']
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.key?(:'client_cert')
|
134
|
+
self.client_cert = attributes[:'client_cert']
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.key?(:'client_key')
|
138
|
+
self.client_key = attributes[:'client_key']
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.key?(:'tls_validation')
|
142
|
+
self.tls_validation = attributes[:'tls_validation']
|
143
|
+
end
|
144
|
+
|
145
|
+
if attributes.key?(:'username')
|
146
|
+
self.username = attributes[:'username']
|
147
|
+
end
|
148
|
+
|
149
|
+
if attributes.key?(:'password')
|
150
|
+
self.password = attributes[:'password']
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.key?(:'pulp_label_select')
|
154
|
+
self.pulp_label_select = attributes[:'pulp_label_select']
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
159
|
+
# @return Array for valid properties with the reasons
|
160
|
+
def list_invalid_properties
|
161
|
+
invalid_properties = Array.new
|
162
|
+
if @name.nil?
|
163
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
164
|
+
end
|
165
|
+
|
166
|
+
if @name.to_s.length < 1
|
167
|
+
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
|
168
|
+
end
|
169
|
+
|
170
|
+
if @base_url.nil?
|
171
|
+
invalid_properties.push('invalid value for "base_url", base_url cannot be nil.')
|
172
|
+
end
|
173
|
+
|
174
|
+
if @base_url.to_s.length < 1
|
175
|
+
invalid_properties.push('invalid value for "base_url", the character length must be great than or equal to 1.')
|
176
|
+
end
|
177
|
+
|
178
|
+
if @api_root.nil?
|
179
|
+
invalid_properties.push('invalid value for "api_root", api_root cannot be nil.')
|
180
|
+
end
|
181
|
+
|
182
|
+
if @api_root.to_s.length < 1
|
183
|
+
invalid_properties.push('invalid value for "api_root", the character length must be great than or equal to 1.')
|
184
|
+
end
|
185
|
+
|
186
|
+
if !@domain.nil? && @domain.to_s.length < 1
|
187
|
+
invalid_properties.push('invalid value for "domain", the character length must be great than or equal to 1.')
|
188
|
+
end
|
189
|
+
|
190
|
+
if !@ca_cert.nil? && @ca_cert.to_s.length < 1
|
191
|
+
invalid_properties.push('invalid value for "ca_cert", the character length must be great than or equal to 1.')
|
192
|
+
end
|
193
|
+
|
194
|
+
if !@client_cert.nil? && @client_cert.to_s.length < 1
|
195
|
+
invalid_properties.push('invalid value for "client_cert", the character length must be great than or equal to 1.')
|
196
|
+
end
|
197
|
+
|
198
|
+
if !@client_key.nil? && @client_key.to_s.length < 1
|
199
|
+
invalid_properties.push('invalid value for "client_key", the character length must be great than or equal to 1.')
|
200
|
+
end
|
201
|
+
|
202
|
+
if !@username.nil? && @username.to_s.length < 1
|
203
|
+
invalid_properties.push('invalid value for "username", the character length must be great than or equal to 1.')
|
204
|
+
end
|
205
|
+
|
206
|
+
if !@password.nil? && @password.to_s.length < 1
|
207
|
+
invalid_properties.push('invalid value for "password", the character length must be great than or equal to 1.')
|
208
|
+
end
|
209
|
+
|
210
|
+
invalid_properties
|
211
|
+
end
|
212
|
+
|
213
|
+
# Check to see if the all the properties in the model are valid
|
214
|
+
# @return true if the model is valid
|
215
|
+
def valid?
|
216
|
+
return false if @name.nil?
|
217
|
+
return false if @name.to_s.length < 1
|
218
|
+
return false if @base_url.nil?
|
219
|
+
return false if @base_url.to_s.length < 1
|
220
|
+
return false if @api_root.nil?
|
221
|
+
return false if @api_root.to_s.length < 1
|
222
|
+
return false if !@domain.nil? && @domain.to_s.length < 1
|
223
|
+
return false if !@ca_cert.nil? && @ca_cert.to_s.length < 1
|
224
|
+
return false if !@client_cert.nil? && @client_cert.to_s.length < 1
|
225
|
+
return false if !@client_key.nil? && @client_key.to_s.length < 1
|
226
|
+
return false if !@username.nil? && @username.to_s.length < 1
|
227
|
+
return false if !@password.nil? && @password.to_s.length < 1
|
228
|
+
true
|
229
|
+
end
|
230
|
+
|
231
|
+
# Custom attribute writer method with validation
|
232
|
+
# @param [Object] name Value to be assigned
|
233
|
+
def name=(name)
|
234
|
+
if name.nil?
|
235
|
+
fail ArgumentError, 'name cannot be nil'
|
236
|
+
end
|
237
|
+
|
238
|
+
if name.to_s.length < 1
|
239
|
+
fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
|
240
|
+
end
|
241
|
+
|
242
|
+
@name = name
|
243
|
+
end
|
244
|
+
|
245
|
+
# Custom attribute writer method with validation
|
246
|
+
# @param [Object] base_url Value to be assigned
|
247
|
+
def base_url=(base_url)
|
248
|
+
if base_url.nil?
|
249
|
+
fail ArgumentError, 'base_url cannot be nil'
|
250
|
+
end
|
251
|
+
|
252
|
+
if base_url.to_s.length < 1
|
253
|
+
fail ArgumentError, 'invalid value for "base_url", the character length must be great than or equal to 1.'
|
254
|
+
end
|
255
|
+
|
256
|
+
@base_url = base_url
|
257
|
+
end
|
258
|
+
|
259
|
+
# Custom attribute writer method with validation
|
260
|
+
# @param [Object] api_root Value to be assigned
|
261
|
+
def api_root=(api_root)
|
262
|
+
if api_root.nil?
|
263
|
+
fail ArgumentError, 'api_root cannot be nil'
|
264
|
+
end
|
265
|
+
|
266
|
+
if api_root.to_s.length < 1
|
267
|
+
fail ArgumentError, 'invalid value for "api_root", the character length must be great than or equal to 1.'
|
268
|
+
end
|
269
|
+
|
270
|
+
@api_root = api_root
|
271
|
+
end
|
272
|
+
|
273
|
+
# Custom attribute writer method with validation
|
274
|
+
# @param [Object] domain Value to be assigned
|
275
|
+
def domain=(domain)
|
276
|
+
if !domain.nil? && domain.to_s.length < 1
|
277
|
+
fail ArgumentError, 'invalid value for "domain", the character length must be great than or equal to 1.'
|
278
|
+
end
|
279
|
+
|
280
|
+
@domain = domain
|
281
|
+
end
|
282
|
+
|
283
|
+
# Custom attribute writer method with validation
|
284
|
+
# @param [Object] ca_cert Value to be assigned
|
285
|
+
def ca_cert=(ca_cert)
|
286
|
+
if !ca_cert.nil? && ca_cert.to_s.length < 1
|
287
|
+
fail ArgumentError, 'invalid value for "ca_cert", the character length must be great than or equal to 1.'
|
288
|
+
end
|
289
|
+
|
290
|
+
@ca_cert = ca_cert
|
291
|
+
end
|
292
|
+
|
293
|
+
# Custom attribute writer method with validation
|
294
|
+
# @param [Object] client_cert Value to be assigned
|
295
|
+
def client_cert=(client_cert)
|
296
|
+
if !client_cert.nil? && client_cert.to_s.length < 1
|
297
|
+
fail ArgumentError, 'invalid value for "client_cert", the character length must be great than or equal to 1.'
|
298
|
+
end
|
299
|
+
|
300
|
+
@client_cert = client_cert
|
301
|
+
end
|
302
|
+
|
303
|
+
# Custom attribute writer method with validation
|
304
|
+
# @param [Object] client_key Value to be assigned
|
305
|
+
def client_key=(client_key)
|
306
|
+
if !client_key.nil? && client_key.to_s.length < 1
|
307
|
+
fail ArgumentError, 'invalid value for "client_key", the character length must be great than or equal to 1.'
|
308
|
+
end
|
309
|
+
|
310
|
+
@client_key = client_key
|
311
|
+
end
|
312
|
+
|
313
|
+
# Custom attribute writer method with validation
|
314
|
+
# @param [Object] username Value to be assigned
|
315
|
+
def username=(username)
|
316
|
+
if !username.nil? && username.to_s.length < 1
|
317
|
+
fail ArgumentError, 'invalid value for "username", the character length must be great than or equal to 1.'
|
318
|
+
end
|
319
|
+
|
320
|
+
@username = username
|
321
|
+
end
|
322
|
+
|
323
|
+
# Custom attribute writer method with validation
|
324
|
+
# @param [Object] password Value to be assigned
|
325
|
+
def password=(password)
|
326
|
+
if !password.nil? && password.to_s.length < 1
|
327
|
+
fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 1.'
|
328
|
+
end
|
329
|
+
|
330
|
+
@password = password
|
331
|
+
end
|
332
|
+
|
333
|
+
# Checks equality by comparing each attribute.
|
334
|
+
# @param [Object] Object to be compared
|
335
|
+
def ==(o)
|
336
|
+
return true if self.equal?(o)
|
337
|
+
self.class == o.class &&
|
338
|
+
name == o.name &&
|
339
|
+
base_url == o.base_url &&
|
340
|
+
api_root == o.api_root &&
|
341
|
+
domain == o.domain &&
|
342
|
+
ca_cert == o.ca_cert &&
|
343
|
+
client_cert == o.client_cert &&
|
344
|
+
client_key == o.client_key &&
|
345
|
+
tls_validation == o.tls_validation &&
|
346
|
+
username == o.username &&
|
347
|
+
password == o.password &&
|
348
|
+
pulp_label_select == o.pulp_label_select
|
349
|
+
end
|
350
|
+
|
351
|
+
# @see the `==` method
|
352
|
+
# @param [Object] Object to be compared
|
353
|
+
def eql?(o)
|
354
|
+
self == o
|
355
|
+
end
|
356
|
+
|
357
|
+
# Calculates hash code according to all attributes.
|
358
|
+
# @return [Integer] Hash code
|
359
|
+
def hash
|
360
|
+
[name, base_url, api_root, domain, ca_cert, client_cert, client_key, tls_validation, username, password, pulp_label_select].hash
|
361
|
+
end
|
362
|
+
|
363
|
+
# Builds the object from hash
|
364
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
365
|
+
# @return [Object] Returns the model itself
|
366
|
+
def self.build_from_hash(attributes)
|
367
|
+
new.build_from_hash(attributes)
|
368
|
+
end
|
369
|
+
|
370
|
+
# Builds the object from hash
|
371
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
372
|
+
# @return [Object] Returns the model itself
|
373
|
+
def build_from_hash(attributes)
|
374
|
+
return nil unless attributes.is_a?(Hash)
|
375
|
+
self.class.openapi_types.each_pair do |key, type|
|
376
|
+
if type =~ /\AArray<(.*)>/i
|
377
|
+
# check to ensure the input is an array given that the attribute
|
378
|
+
# is documented as an array but the input is not
|
379
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
380
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
381
|
+
end
|
382
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
383
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
384
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
385
|
+
end
|
386
|
+
|
387
|
+
self
|
388
|
+
end
|
389
|
+
|
390
|
+
# Deserializes the data based on type
|
391
|
+
# @param string type Data type
|
392
|
+
# @param string value Value to be deserialized
|
393
|
+
# @return [Object] Deserialized data
|
394
|
+
def _deserialize(type, value)
|
395
|
+
case type.to_sym
|
396
|
+
when :DateTime
|
397
|
+
DateTime.parse(value)
|
398
|
+
when :Date
|
399
|
+
Date.parse(value)
|
400
|
+
when :String
|
401
|
+
value.to_s
|
402
|
+
when :Integer
|
403
|
+
value.to_i
|
404
|
+
when :Float
|
405
|
+
value.to_f
|
406
|
+
when :Boolean
|
407
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
408
|
+
true
|
409
|
+
else
|
410
|
+
false
|
411
|
+
end
|
412
|
+
when :Object
|
413
|
+
# generic object (usually a Hash), return directly
|
414
|
+
value
|
415
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
416
|
+
inner_type = Regexp.last_match[:inner_type]
|
417
|
+
value.map { |v| _deserialize(inner_type, v) }
|
418
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
419
|
+
k_type = Regexp.last_match[:k_type]
|
420
|
+
v_type = Regexp.last_match[:v_type]
|
421
|
+
{}.tap do |hash|
|
422
|
+
value.each do |k, v|
|
423
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
424
|
+
end
|
425
|
+
end
|
426
|
+
else # model
|
427
|
+
PulpcoreClient.const_get(type).build_from_hash(value)
|
428
|
+
end
|
429
|
+
end
|
430
|
+
|
431
|
+
# Returns the string representation of the object
|
432
|
+
# @return [String] String presentation of the object
|
433
|
+
def to_s
|
434
|
+
to_hash.to_s
|
435
|
+
end
|
436
|
+
|
437
|
+
# to_body is an alias to to_hash (backward compatibility)
|
438
|
+
# @return [Hash] Returns the object in the form of hash
|
439
|
+
def to_body
|
440
|
+
to_hash
|
441
|
+
end
|
442
|
+
|
443
|
+
# Returns the object in the form of hash
|
444
|
+
# @return [Hash] Returns the object in the form of hash
|
445
|
+
def to_hash
|
446
|
+
hash = {}
|
447
|
+
self.class.attribute_map.each_pair do |attr, param|
|
448
|
+
value = self.send(attr)
|
449
|
+
if value.nil?
|
450
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
451
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
452
|
+
end
|
453
|
+
|
454
|
+
hash[param] = _to_hash(value)
|
455
|
+
end
|
456
|
+
hash
|
457
|
+
end
|
458
|
+
|
459
|
+
# Outputs non-array value in the form of hash
|
460
|
+
# For object, use to_hash. Otherwise, just return the value
|
461
|
+
# @param [Object] value Any valid value
|
462
|
+
# @return [Hash] Returns the value in the form of hash
|
463
|
+
def _to_hash(value)
|
464
|
+
if value.is_a?(Array)
|
465
|
+
value.compact.map { |v| _to_hash(v) }
|
466
|
+
elsif value.is_a?(Hash)
|
467
|
+
{}.tap do |hash|
|
468
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
469
|
+
end
|
470
|
+
elsif value.respond_to? :to_hash
|
471
|
+
value.to_hash
|
472
|
+
else
|
473
|
+
value
|
474
|
+
end
|
475
|
+
end
|
476
|
+
end
|
477
|
+
end
|