pulp_file_client 0.1.0b1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +79 -0
  4. data/README.md +127 -0
  5. data/Rakefile +10 -0
  6. data/docs/AsyncOperationResponse.md +17 -0
  7. data/docs/ContentFilesApi.md +184 -0
  8. data/docs/DistributionsFileApi.md +352 -0
  9. data/docs/FileContent.md +37 -0
  10. data/docs/FileDistribution.md +29 -0
  11. data/docs/FilePublication.md +31 -0
  12. data/docs/FileRemote.md +45 -0
  13. data/docs/InlineResponse200.md +23 -0
  14. data/docs/InlineResponse2001.md +23 -0
  15. data/docs/InlineResponse2002.md +23 -0
  16. data/docs/InlineResponse2003.md +23 -0
  17. data/docs/PublicationsFileApi.md +229 -0
  18. data/docs/RemotesFileApi.md +411 -0
  19. data/docs/RepositorySyncURL.md +19 -0
  20. data/git_push.sh +55 -0
  21. data/lib/pulp_file_client/api/content_files_api.rb +225 -0
  22. data/lib/pulp_file_client/api/distributions_file_api.rb +430 -0
  23. data/lib/pulp_file_client/api/publications_file_api.rb +273 -0
  24. data/lib/pulp_file_client/api/remotes_file_api.rb +504 -0
  25. data/lib/pulp_file_client/api_client.rb +387 -0
  26. data/lib/pulp_file_client/api_error.rb +57 -0
  27. data/lib/pulp_file_client/configuration.rb +251 -0
  28. data/lib/pulp_file_client/models/async_operation_response.rb +202 -0
  29. data/lib/pulp_file_client/models/file_content.rb +429 -0
  30. data/lib/pulp_file_client/models/file_distribution.rb +337 -0
  31. data/lib/pulp_file_client/models/file_publication.rb +297 -0
  32. data/lib/pulp_file_client/models/file_remote.rb +539 -0
  33. data/lib/pulp_file_client/models/inline_response200.rb +235 -0
  34. data/lib/pulp_file_client/models/inline_response2001.rb +235 -0
  35. data/lib/pulp_file_client/models/inline_response2002.rb +235 -0
  36. data/lib/pulp_file_client/models/inline_response2003.rb +235 -0
  37. data/lib/pulp_file_client/models/repository_sync_url.rb +214 -0
  38. data/lib/pulp_file_client/version.rb +15 -0
  39. data/lib/pulp_file_client.rb +53 -0
  40. data/pulp_file_client.gemspec +45 -0
  41. data/spec/api/content_files_api_spec.rb +77 -0
  42. data/spec/api/distributions_file_api_spec.rb +116 -0
  43. data/spec/api/publications_file_api_spec.rb +85 -0
  44. data/spec/api/remotes_file_api_spec.rb +130 -0
  45. data/spec/api_client_spec.rb +226 -0
  46. data/spec/configuration_spec.rb +42 -0
  47. data/spec/models/async_operation_response_spec.rb +41 -0
  48. data/spec/models/file_content_spec.rb +101 -0
  49. data/spec/models/file_distribution_spec.rb +77 -0
  50. data/spec/models/file_publication_spec.rb +83 -0
  51. data/spec/models/file_remote_spec.rb +129 -0
  52. data/spec/models/inline_response2001_spec.rb +59 -0
  53. data/spec/models/inline_response2002_spec.rb +59 -0
  54. data/spec/models/inline_response2003_spec.rb +59 -0
  55. data/spec/models/inline_response200_spec.rb +59 -0
  56. data/spec/models/repository_sync_url_spec.rb +47 -0
  57. data/spec/spec_helper.rb +111 -0
  58. metadata +297 -0
@@ -0,0 +1,202 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpFileClient
16
+ class AsyncOperationResponse
17
+ # The href of the task.
18
+ attr_accessor :task
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'task' => :'task'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'task' => :'String'
31
+ }
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ if (!attributes.is_a?(Hash))
38
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpFileClient::AsyncOperationResponse` initialize method"
39
+ end
40
+
41
+ # check to see if the attribute exists and convert string to symbol for hash key
42
+ attributes = attributes.each_with_object({}) { |(k, v), h|
43
+ if (!self.class.attribute_map.key?(k.to_sym))
44
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpFileClient::AsyncOperationResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
45
+ end
46
+ h[k.to_sym] = v
47
+ }
48
+
49
+ if attributes.key?(:'task')
50
+ self.task = attributes[:'task']
51
+ end
52
+ end
53
+
54
+ # Show invalid properties with the reasons. Usually used together with valid?
55
+ # @return Array for valid properties with the reasons
56
+ def list_invalid_properties
57
+ invalid_properties = Array.new
58
+ if @task.nil?
59
+ invalid_properties.push('invalid value for "task", task cannot be nil.')
60
+ end
61
+
62
+ invalid_properties
63
+ end
64
+
65
+ # Check to see if the all the properties in the model are valid
66
+ # @return true if the model is valid
67
+ def valid?
68
+ return false if @task.nil?
69
+ true
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ task == o.task
78
+ end
79
+
80
+ # @see the `==` method
81
+ # @param [Object] Object to be compared
82
+ def eql?(o)
83
+ self == o
84
+ end
85
+
86
+ # Calculates hash code according to all attributes.
87
+ # @return [Integer] Hash code
88
+ def hash
89
+ [task].hash
90
+ end
91
+
92
+ # Builds the object from hash
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ # @return [Object] Returns the model itself
95
+ def self.build_from_hash(attributes)
96
+ new.build_from_hash(attributes)
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def build_from_hash(attributes)
103
+ return nil unless attributes.is_a?(Hash)
104
+ self.class.openapi_types.each_pair do |key, type|
105
+ if type =~ /\AArray<(.*)>/i
106
+ # check to ensure the input is an array given that the attribute
107
+ # is documented as an array but the input is not
108
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
109
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
110
+ end
111
+ elsif !attributes[self.class.attribute_map[key]].nil?
112
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
113
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
114
+ end
115
+
116
+ self
117
+ end
118
+
119
+ # Deserializes the data based on type
120
+ # @param string type Data type
121
+ # @param string value Value to be deserialized
122
+ # @return [Object] Deserialized data
123
+ def _deserialize(type, value)
124
+ case type.to_sym
125
+ when :DateTime
126
+ DateTime.parse(value)
127
+ when :Date
128
+ Date.parse(value)
129
+ when :String
130
+ value.to_s
131
+ when :Integer
132
+ value.to_i
133
+ when :Float
134
+ value.to_f
135
+ when :Boolean
136
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
137
+ true
138
+ else
139
+ false
140
+ end
141
+ when :Object
142
+ # generic object (usually a Hash), return directly
143
+ value
144
+ when /\AArray<(?<inner_type>.+)>\z/
145
+ inner_type = Regexp.last_match[:inner_type]
146
+ value.map { |v| _deserialize(inner_type, v) }
147
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
148
+ k_type = Regexp.last_match[:k_type]
149
+ v_type = Regexp.last_match[:v_type]
150
+ {}.tap do |hash|
151
+ value.each do |k, v|
152
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
153
+ end
154
+ end
155
+ else # model
156
+ PulpFileClient.const_get(type).build_from_hash(value)
157
+ end
158
+ end
159
+
160
+ # Returns the string representation of the object
161
+ # @return [String] String presentation of the object
162
+ def to_s
163
+ to_hash.to_s
164
+ end
165
+
166
+ # to_body is an alias to to_hash (backward compatibility)
167
+ # @return [Hash] Returns the object in the form of hash
168
+ def to_body
169
+ to_hash
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = self.send(attr)
178
+ next if value.nil?
179
+ hash[param] = _to_hash(value)
180
+ end
181
+ hash
182
+ end
183
+
184
+ # Outputs non-array value in the form of hash
185
+ # For object, use to_hash. Otherwise, just return the value
186
+ # @param [Object] value Any valid value
187
+ # @return [Hash] Returns the value in the form of hash
188
+ def _to_hash(value)
189
+ if value.is_a?(Array)
190
+ value.compact.map { |v| _to_hash(v) }
191
+ elsif value.is_a?(Hash)
192
+ {}.tap do |hash|
193
+ value.each { |k, v| hash[k] = _to_hash(v) }
194
+ end
195
+ elsif value.respond_to? :to_hash
196
+ value.to_hash
197
+ else
198
+ value
199
+ end
200
+ end
201
+ end
202
+ end
@@ -0,0 +1,429 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpFileClient
16
+ class FileContent
17
+ # Timestamp of creation.
18
+ attr_accessor :_created
19
+
20
+ attr_accessor :_href
21
+
22
+ # Artifact file representing the physical content
23
+ attr_accessor :_artifact
24
+
25
+ attr_accessor :_type
26
+
27
+ # The MD5 checksum if available.
28
+ attr_accessor :md5
29
+
30
+ # The SHA-1 checksum if available.
31
+ attr_accessor :sha1
32
+
33
+ # The SHA-224 checksum if available.
34
+ attr_accessor :sha224
35
+
36
+ # The SHA-256 checksum if available.
37
+ attr_accessor :sha256
38
+
39
+ # The SHA-384 checksum if available.
40
+ attr_accessor :sha384
41
+
42
+ # The SHA-512 checksum if available.
43
+ attr_accessor :sha512
44
+
45
+ # Relative location of the file within the repository. Example: `path/to/file.txt`
46
+ attr_accessor :relative_path
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'_created' => :'_created',
52
+ :'_href' => :'_href',
53
+ :'_artifact' => :'_artifact',
54
+ :'_type' => :'_type',
55
+ :'md5' => :'md5',
56
+ :'sha1' => :'sha1',
57
+ :'sha224' => :'sha224',
58
+ :'sha256' => :'sha256',
59
+ :'sha384' => :'sha384',
60
+ :'sha512' => :'sha512',
61
+ :'relative_path' => :'relative_path'
62
+ }
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'_created' => :'DateTime',
69
+ :'_href' => :'String',
70
+ :'_artifact' => :'String',
71
+ :'_type' => :'String',
72
+ :'md5' => :'String',
73
+ :'sha1' => :'String',
74
+ :'sha224' => :'String',
75
+ :'sha256' => :'String',
76
+ :'sha384' => :'String',
77
+ :'sha512' => :'String',
78
+ :'relative_path' => :'String'
79
+ }
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpFileClient::FileContent` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ attributes = attributes.each_with_object({}) { |(k, v), h|
91
+ if (!self.class.attribute_map.key?(k.to_sym))
92
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpFileClient::FileContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
93
+ end
94
+ h[k.to_sym] = v
95
+ }
96
+
97
+ if attributes.key?(:'_created')
98
+ self._created = attributes[:'_created']
99
+ end
100
+
101
+ if attributes.key?(:'_href')
102
+ self._href = attributes[:'_href']
103
+ end
104
+
105
+ if attributes.key?(:'_artifact')
106
+ self._artifact = attributes[:'_artifact']
107
+ end
108
+
109
+ if attributes.key?(:'_type')
110
+ self._type = attributes[:'_type']
111
+ end
112
+
113
+ if attributes.key?(:'md5')
114
+ self.md5 = attributes[:'md5']
115
+ end
116
+
117
+ if attributes.key?(:'sha1')
118
+ self.sha1 = attributes[:'sha1']
119
+ end
120
+
121
+ if attributes.key?(:'sha224')
122
+ self.sha224 = attributes[:'sha224']
123
+ end
124
+
125
+ if attributes.key?(:'sha256')
126
+ self.sha256 = attributes[:'sha256']
127
+ end
128
+
129
+ if attributes.key?(:'sha384')
130
+ self.sha384 = attributes[:'sha384']
131
+ end
132
+
133
+ if attributes.key?(:'sha512')
134
+ self.sha512 = attributes[:'sha512']
135
+ end
136
+
137
+ if attributes.key?(:'relative_path')
138
+ self.relative_path = attributes[:'relative_path']
139
+ end
140
+ end
141
+
142
+ # Show invalid properties with the reasons. Usually used together with valid?
143
+ # @return Array for valid properties with the reasons
144
+ def list_invalid_properties
145
+ invalid_properties = Array.new
146
+ if @_artifact.nil?
147
+ invalid_properties.push('invalid value for "_artifact", _artifact cannot be nil.')
148
+ end
149
+
150
+ if !@_type.nil? && @_type.to_s.length < 1
151
+ invalid_properties.push('invalid value for "_type", the character length must be great than or equal to 1.')
152
+ end
153
+
154
+ if !@md5.nil? && @md5.to_s.length < 1
155
+ invalid_properties.push('invalid value for "md5", the character length must be great than or equal to 1.')
156
+ end
157
+
158
+ if !@sha1.nil? && @sha1.to_s.length < 1
159
+ invalid_properties.push('invalid value for "sha1", the character length must be great than or equal to 1.')
160
+ end
161
+
162
+ if !@sha224.nil? && @sha224.to_s.length < 1
163
+ invalid_properties.push('invalid value for "sha224", the character length must be great than or equal to 1.')
164
+ end
165
+
166
+ if !@sha256.nil? && @sha256.to_s.length < 1
167
+ invalid_properties.push('invalid value for "sha256", the character length must be great than or equal to 1.')
168
+ end
169
+
170
+ if !@sha384.nil? && @sha384.to_s.length < 1
171
+ invalid_properties.push('invalid value for "sha384", the character length must be great than or equal to 1.')
172
+ end
173
+
174
+ if !@sha512.nil? && @sha512.to_s.length < 1
175
+ invalid_properties.push('invalid value for "sha512", the character length must be great than or equal to 1.')
176
+ end
177
+
178
+ if @relative_path.nil?
179
+ invalid_properties.push('invalid value for "relative_path", relative_path cannot be nil.')
180
+ end
181
+
182
+ if @relative_path.to_s.length < 1
183
+ invalid_properties.push('invalid value for "relative_path", the character length must be great than or equal to 1.')
184
+ end
185
+
186
+ invalid_properties
187
+ end
188
+
189
+ # Check to see if the all the properties in the model are valid
190
+ # @return true if the model is valid
191
+ def valid?
192
+ return false if @_artifact.nil?
193
+ return false if !@_type.nil? && @_type.to_s.length < 1
194
+ return false if !@md5.nil? && @md5.to_s.length < 1
195
+ return false if !@sha1.nil? && @sha1.to_s.length < 1
196
+ return false if !@sha224.nil? && @sha224.to_s.length < 1
197
+ return false if !@sha256.nil? && @sha256.to_s.length < 1
198
+ return false if !@sha384.nil? && @sha384.to_s.length < 1
199
+ return false if !@sha512.nil? && @sha512.to_s.length < 1
200
+ return false if @relative_path.nil?
201
+ return false if @relative_path.to_s.length < 1
202
+ true
203
+ end
204
+
205
+ # Custom attribute writer method with validation
206
+ # @param [Object] _type Value to be assigned
207
+ def _type=(_type)
208
+ if !_type.nil? && _type.to_s.length < 1
209
+ fail ArgumentError, 'invalid value for "_type", the character length must be great than or equal to 1.'
210
+ end
211
+
212
+ @_type = _type
213
+ end
214
+
215
+ # Custom attribute writer method with validation
216
+ # @param [Object] md5 Value to be assigned
217
+ def md5=(md5)
218
+ if !md5.nil? && md5.to_s.length < 1
219
+ fail ArgumentError, 'invalid value for "md5", the character length must be great than or equal to 1.'
220
+ end
221
+
222
+ @md5 = md5
223
+ end
224
+
225
+ # Custom attribute writer method with validation
226
+ # @param [Object] sha1 Value to be assigned
227
+ def sha1=(sha1)
228
+ if !sha1.nil? && sha1.to_s.length < 1
229
+ fail ArgumentError, 'invalid value for "sha1", the character length must be great than or equal to 1.'
230
+ end
231
+
232
+ @sha1 = sha1
233
+ end
234
+
235
+ # Custom attribute writer method with validation
236
+ # @param [Object] sha224 Value to be assigned
237
+ def sha224=(sha224)
238
+ if !sha224.nil? && sha224.to_s.length < 1
239
+ fail ArgumentError, 'invalid value for "sha224", the character length must be great than or equal to 1.'
240
+ end
241
+
242
+ @sha224 = sha224
243
+ end
244
+
245
+ # Custom attribute writer method with validation
246
+ # @param [Object] sha256 Value to be assigned
247
+ def sha256=(sha256)
248
+ if !sha256.nil? && sha256.to_s.length < 1
249
+ fail ArgumentError, 'invalid value for "sha256", the character length must be great than or equal to 1.'
250
+ end
251
+
252
+ @sha256 = sha256
253
+ end
254
+
255
+ # Custom attribute writer method with validation
256
+ # @param [Object] sha384 Value to be assigned
257
+ def sha384=(sha384)
258
+ if !sha384.nil? && sha384.to_s.length < 1
259
+ fail ArgumentError, 'invalid value for "sha384", the character length must be great than or equal to 1.'
260
+ end
261
+
262
+ @sha384 = sha384
263
+ end
264
+
265
+ # Custom attribute writer method with validation
266
+ # @param [Object] sha512 Value to be assigned
267
+ def sha512=(sha512)
268
+ if !sha512.nil? && sha512.to_s.length < 1
269
+ fail ArgumentError, 'invalid value for "sha512", the character length must be great than or equal to 1.'
270
+ end
271
+
272
+ @sha512 = sha512
273
+ end
274
+
275
+ # Custom attribute writer method with validation
276
+ # @param [Object] relative_path Value to be assigned
277
+ def relative_path=(relative_path)
278
+ if relative_path.nil?
279
+ fail ArgumentError, 'relative_path cannot be nil'
280
+ end
281
+
282
+ if relative_path.to_s.length < 1
283
+ fail ArgumentError, 'invalid value for "relative_path", the character length must be great than or equal to 1.'
284
+ end
285
+
286
+ @relative_path = relative_path
287
+ end
288
+
289
+ # Checks equality by comparing each attribute.
290
+ # @param [Object] Object to be compared
291
+ def ==(o)
292
+ return true if self.equal?(o)
293
+ self.class == o.class &&
294
+ _created == o._created &&
295
+ _href == o._href &&
296
+ _artifact == o._artifact &&
297
+ _type == o._type &&
298
+ md5 == o.md5 &&
299
+ sha1 == o.sha1 &&
300
+ sha224 == o.sha224 &&
301
+ sha256 == o.sha256 &&
302
+ sha384 == o.sha384 &&
303
+ sha512 == o.sha512 &&
304
+ relative_path == o.relative_path
305
+ end
306
+
307
+ # @see the `==` method
308
+ # @param [Object] Object to be compared
309
+ def eql?(o)
310
+ self == o
311
+ end
312
+
313
+ # Calculates hash code according to all attributes.
314
+ # @return [Integer] Hash code
315
+ def hash
316
+ [_created, _href, _artifact, _type, md5, sha1, sha224, sha256, sha384, sha512, relative_path].hash
317
+ end
318
+
319
+ # Builds the object from hash
320
+ # @param [Hash] attributes Model attributes in the form of hash
321
+ # @return [Object] Returns the model itself
322
+ def self.build_from_hash(attributes)
323
+ new.build_from_hash(attributes)
324
+ end
325
+
326
+ # Builds the object from hash
327
+ # @param [Hash] attributes Model attributes in the form of hash
328
+ # @return [Object] Returns the model itself
329
+ def build_from_hash(attributes)
330
+ return nil unless attributes.is_a?(Hash)
331
+ self.class.openapi_types.each_pair do |key, type|
332
+ if type =~ /\AArray<(.*)>/i
333
+ # check to ensure the input is an array given that the attribute
334
+ # is documented as an array but the input is not
335
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
336
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
337
+ end
338
+ elsif !attributes[self.class.attribute_map[key]].nil?
339
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
340
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
341
+ end
342
+
343
+ self
344
+ end
345
+
346
+ # Deserializes the data based on type
347
+ # @param string type Data type
348
+ # @param string value Value to be deserialized
349
+ # @return [Object] Deserialized data
350
+ def _deserialize(type, value)
351
+ case type.to_sym
352
+ when :DateTime
353
+ DateTime.parse(value)
354
+ when :Date
355
+ Date.parse(value)
356
+ when :String
357
+ value.to_s
358
+ when :Integer
359
+ value.to_i
360
+ when :Float
361
+ value.to_f
362
+ when :Boolean
363
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
364
+ true
365
+ else
366
+ false
367
+ end
368
+ when :Object
369
+ # generic object (usually a Hash), return directly
370
+ value
371
+ when /\AArray<(?<inner_type>.+)>\z/
372
+ inner_type = Regexp.last_match[:inner_type]
373
+ value.map { |v| _deserialize(inner_type, v) }
374
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
375
+ k_type = Regexp.last_match[:k_type]
376
+ v_type = Regexp.last_match[:v_type]
377
+ {}.tap do |hash|
378
+ value.each do |k, v|
379
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
380
+ end
381
+ end
382
+ else # model
383
+ PulpFileClient.const_get(type).build_from_hash(value)
384
+ end
385
+ end
386
+
387
+ # Returns the string representation of the object
388
+ # @return [String] String presentation of the object
389
+ def to_s
390
+ to_hash.to_s
391
+ end
392
+
393
+ # to_body is an alias to to_hash (backward compatibility)
394
+ # @return [Hash] Returns the object in the form of hash
395
+ def to_body
396
+ to_hash
397
+ end
398
+
399
+ # Returns the object in the form of hash
400
+ # @return [Hash] Returns the object in the form of hash
401
+ def to_hash
402
+ hash = {}
403
+ self.class.attribute_map.each_pair do |attr, param|
404
+ value = self.send(attr)
405
+ next if value.nil?
406
+ hash[param] = _to_hash(value)
407
+ end
408
+ hash
409
+ end
410
+
411
+ # Outputs non-array value in the form of hash
412
+ # For object, use to_hash. Otherwise, just return the value
413
+ # @param [Object] value Any valid value
414
+ # @return [Hash] Returns the value in the form of hash
415
+ def _to_hash(value)
416
+ if value.is_a?(Array)
417
+ value.compact.map { |v| _to_hash(v) }
418
+ elsif value.is_a?(Hash)
419
+ {}.tap do |hash|
420
+ value.each { |k, v| hash[k] = _to_hash(v) }
421
+ end
422
+ elsif value.respond_to? :to_hash
423
+ value.to_hash
424
+ else
425
+ value
426
+ end
427
+ end
428
+ end
429
+ end