pulpcore_client 3.0.0rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +79 -0
- data/README.md +151 -0
- data/Rakefile +10 -0
- data/docs/Artifact.md +37 -0
- data/docs/ArtifactsApi.md +253 -0
- data/docs/AsyncOperationResponse.md +17 -0
- data/docs/InlineResponse200.md +23 -0
- data/docs/InlineResponse2001.md +23 -0
- data/docs/InlineResponse2002.md +23 -0
- data/docs/InlineResponse2003.md +23 -0
- data/docs/InlineResponse2004.md +23 -0
- data/docs/InlineResponse2005.md +23 -0
- data/docs/OrphansApi.md +58 -0
- data/docs/ProgressReport.md +27 -0
- data/docs/RepositoriesApi.md +584 -0
- data/docs/Repository.md +27 -0
- data/docs/RepositoryVersion.md +25 -0
- data/docs/RepositoryVersionCreate.md +21 -0
- data/docs/StatusApi.md +57 -0
- data/docs/Task.md +41 -0
- data/docs/TasksApi.md +263 -0
- data/docs/Upload.md +25 -0
- data/docs/UploadsApi.md +395 -0
- data/docs/Worker.md +27 -0
- data/docs/WorkersApi.md +136 -0
- data/git_push.sh +55 -0
- data/lib/pulpcore_client/api/artifacts_api.rb +306 -0
- data/lib/pulpcore_client/api/orphans_api.rb +78 -0
- data/lib/pulpcore_client/api/repositories_api.rb +710 -0
- data/lib/pulpcore_client/api/status_api.rb +76 -0
- data/lib/pulpcore_client/api/tasks_api.rb +330 -0
- data/lib/pulpcore_client/api/uploads_api.rb +493 -0
- data/lib/pulpcore_client/api/workers_api.rb +172 -0
- data/lib/pulpcore_client/api_client.rb +387 -0
- data/lib/pulpcore_client/api_error.rb +57 -0
- data/lib/pulpcore_client/configuration.rb +251 -0
- data/lib/pulpcore_client/models/artifact.rb +296 -0
- data/lib/pulpcore_client/models/async_operation_response.rb +202 -0
- data/lib/pulpcore_client/models/inline_response200.rb +235 -0
- data/lib/pulpcore_client/models/inline_response2001.rb +235 -0
- data/lib/pulpcore_client/models/inline_response2002.rb +235 -0
- data/lib/pulpcore_client/models/inline_response2003.rb +235 -0
- data/lib/pulpcore_client/models/inline_response2004.rb +235 -0
- data/lib/pulpcore_client/models/inline_response2005.rb +235 -0
- data/lib/pulpcore_client/models/progress_report.rb +277 -0
- data/lib/pulpcore_client/models/repository.rb +268 -0
- data/lib/pulpcore_client/models/repository_version.rb +235 -0
- data/lib/pulpcore_client/models/repository_version_create.rb +231 -0
- data/lib/pulpcore_client/models/task.rb +360 -0
- data/lib/pulpcore_client/models/upload.rb +257 -0
- data/lib/pulpcore_client/models/worker.rb +261 -0
- data/lib/pulpcore_client/version.rb +15 -0
- data/lib/pulpcore_client.rb +61 -0
- data/pulpcore_client.gemspec +45 -0
- data/spec/api/artifacts_api_spec.rb +96 -0
- data/spec/api/orphans_api_spec.rb +46 -0
- data/spec/api/repositories_api_spec.rb +171 -0
- data/spec/api/status_api_spec.rb +46 -0
- data/spec/api/tasks_api_spec.rb +102 -0
- data/spec/api/uploads_api_spec.rb +123 -0
- data/spec/api/workers_api_spec.rb +68 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/artifact_spec.rb +101 -0
- data/spec/models/async_operation_response_spec.rb +41 -0
- data/spec/models/inline_response2001_spec.rb +59 -0
- data/spec/models/inline_response2002_spec.rb +59 -0
- data/spec/models/inline_response2003_spec.rb +59 -0
- data/spec/models/inline_response2004_spec.rb +59 -0
- data/spec/models/inline_response2005_spec.rb +59 -0
- data/spec/models/inline_response200_spec.rb +59 -0
- data/spec/models/progress_report_spec.rb +71 -0
- data/spec/models/repository_spec.rb +71 -0
- data/spec/models/repository_version_create_spec.rb +53 -0
- data/spec/models/repository_version_spec.rb +65 -0
- data/spec/models/task_spec.rb +113 -0
- data/spec/models/upload_spec.rb +65 -0
- data/spec/models/worker_spec.rb +71 -0
- data/spec/spec_helper.rb +111 -0
- metadata +329 -0
@@ -0,0 +1,296 @@
|
|
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.1-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpcoreClient
|
16
|
+
class Artifact
|
17
|
+
attr_accessor :_href
|
18
|
+
|
19
|
+
# Timestamp of creation.
|
20
|
+
attr_accessor :_created
|
21
|
+
|
22
|
+
# The stored file.
|
23
|
+
attr_accessor :file
|
24
|
+
|
25
|
+
# The size of the file in bytes.
|
26
|
+
attr_accessor :size
|
27
|
+
|
28
|
+
# The MD5 checksum of the file if available.
|
29
|
+
attr_accessor :md5
|
30
|
+
|
31
|
+
# The SHA-1 checksum of the file if available.
|
32
|
+
attr_accessor :sha1
|
33
|
+
|
34
|
+
# The SHA-224 checksum of the file if available.
|
35
|
+
attr_accessor :sha224
|
36
|
+
|
37
|
+
# The SHA-256 checksum of the file if available.
|
38
|
+
attr_accessor :sha256
|
39
|
+
|
40
|
+
# The SHA-384 checksum of the file if available.
|
41
|
+
attr_accessor :sha384
|
42
|
+
|
43
|
+
# The SHA-512 checksum of the file if available.
|
44
|
+
attr_accessor :sha512
|
45
|
+
|
46
|
+
# An href for an Upload.
|
47
|
+
attr_accessor :upload
|
48
|
+
|
49
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
50
|
+
def self.attribute_map
|
51
|
+
{
|
52
|
+
:'_href' => :'_href',
|
53
|
+
:'_created' => :'_created',
|
54
|
+
:'file' => :'file',
|
55
|
+
:'size' => :'size',
|
56
|
+
:'md5' => :'md5',
|
57
|
+
:'sha1' => :'sha1',
|
58
|
+
:'sha224' => :'sha224',
|
59
|
+
:'sha256' => :'sha256',
|
60
|
+
:'sha384' => :'sha384',
|
61
|
+
:'sha512' => :'sha512',
|
62
|
+
:'upload' => :'upload'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# Attribute type mapping.
|
67
|
+
def self.openapi_types
|
68
|
+
{
|
69
|
+
:'_href' => :'String',
|
70
|
+
:'_created' => :'DateTime',
|
71
|
+
:'file' => :'String',
|
72
|
+
:'size' => :'Integer',
|
73
|
+
:'md5' => :'String',
|
74
|
+
:'sha1' => :'String',
|
75
|
+
:'sha224' => :'String',
|
76
|
+
:'sha256' => :'String',
|
77
|
+
:'sha384' => :'String',
|
78
|
+
:'sha512' => :'String',
|
79
|
+
:'upload' => :'String'
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
# Initializes the object
|
84
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
85
|
+
def initialize(attributes = {})
|
86
|
+
if (!attributes.is_a?(Hash))
|
87
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::Artifact` initialize method"
|
88
|
+
end
|
89
|
+
|
90
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
91
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
92
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
93
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::Artifact`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
94
|
+
end
|
95
|
+
h[k.to_sym] = v
|
96
|
+
}
|
97
|
+
|
98
|
+
if attributes.key?(:'_href')
|
99
|
+
self._href = attributes[:'_href']
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.key?(:'_created')
|
103
|
+
self._created = attributes[:'_created']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.key?(:'file')
|
107
|
+
self.file = attributes[:'file']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.key?(:'size')
|
111
|
+
self.size = attributes[:'size']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.key?(:'md5')
|
115
|
+
self.md5 = attributes[:'md5']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.key?(:'sha1')
|
119
|
+
self.sha1 = attributes[:'sha1']
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.key?(:'sha224')
|
123
|
+
self.sha224 = attributes[:'sha224']
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.key?(:'sha256')
|
127
|
+
self.sha256 = attributes[:'sha256']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.key?(:'sha384')
|
131
|
+
self.sha384 = attributes[:'sha384']
|
132
|
+
end
|
133
|
+
|
134
|
+
if attributes.key?(:'sha512')
|
135
|
+
self.sha512 = attributes[:'sha512']
|
136
|
+
end
|
137
|
+
|
138
|
+
if attributes.key?(:'upload')
|
139
|
+
self.upload = attributes[:'upload']
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
144
|
+
# @return Array for valid properties with the reasons
|
145
|
+
def list_invalid_properties
|
146
|
+
invalid_properties = Array.new
|
147
|
+
invalid_properties
|
148
|
+
end
|
149
|
+
|
150
|
+
# Check to see if the all the properties in the model are valid
|
151
|
+
# @return true if the model is valid
|
152
|
+
def valid?
|
153
|
+
true
|
154
|
+
end
|
155
|
+
|
156
|
+
# Checks equality by comparing each attribute.
|
157
|
+
# @param [Object] Object to be compared
|
158
|
+
def ==(o)
|
159
|
+
return true if self.equal?(o)
|
160
|
+
self.class == o.class &&
|
161
|
+
_href == o._href &&
|
162
|
+
_created == o._created &&
|
163
|
+
file == o.file &&
|
164
|
+
size == o.size &&
|
165
|
+
md5 == o.md5 &&
|
166
|
+
sha1 == o.sha1 &&
|
167
|
+
sha224 == o.sha224 &&
|
168
|
+
sha256 == o.sha256 &&
|
169
|
+
sha384 == o.sha384 &&
|
170
|
+
sha512 == o.sha512 &&
|
171
|
+
upload == o.upload
|
172
|
+
end
|
173
|
+
|
174
|
+
# @see the `==` method
|
175
|
+
# @param [Object] Object to be compared
|
176
|
+
def eql?(o)
|
177
|
+
self == o
|
178
|
+
end
|
179
|
+
|
180
|
+
# Calculates hash code according to all attributes.
|
181
|
+
# @return [Integer] Hash code
|
182
|
+
def hash
|
183
|
+
[_href, _created, file, size, md5, sha1, sha224, sha256, sha384, sha512, upload].hash
|
184
|
+
end
|
185
|
+
|
186
|
+
# Builds the object from hash
|
187
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
188
|
+
# @return [Object] Returns the model itself
|
189
|
+
def self.build_from_hash(attributes)
|
190
|
+
new.build_from_hash(attributes)
|
191
|
+
end
|
192
|
+
|
193
|
+
# Builds the object from hash
|
194
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
195
|
+
# @return [Object] Returns the model itself
|
196
|
+
def build_from_hash(attributes)
|
197
|
+
return nil unless attributes.is_a?(Hash)
|
198
|
+
self.class.openapi_types.each_pair do |key, type|
|
199
|
+
if type =~ /\AArray<(.*)>/i
|
200
|
+
# check to ensure the input is an array given that the attribute
|
201
|
+
# is documented as an array but the input is not
|
202
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
203
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
204
|
+
end
|
205
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
206
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
207
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
208
|
+
end
|
209
|
+
|
210
|
+
self
|
211
|
+
end
|
212
|
+
|
213
|
+
# Deserializes the data based on type
|
214
|
+
# @param string type Data type
|
215
|
+
# @param string value Value to be deserialized
|
216
|
+
# @return [Object] Deserialized data
|
217
|
+
def _deserialize(type, value)
|
218
|
+
case type.to_sym
|
219
|
+
when :DateTime
|
220
|
+
DateTime.parse(value)
|
221
|
+
when :Date
|
222
|
+
Date.parse(value)
|
223
|
+
when :String
|
224
|
+
value.to_s
|
225
|
+
when :Integer
|
226
|
+
value.to_i
|
227
|
+
when :Float
|
228
|
+
value.to_f
|
229
|
+
when :Boolean
|
230
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
231
|
+
true
|
232
|
+
else
|
233
|
+
false
|
234
|
+
end
|
235
|
+
when :Object
|
236
|
+
# generic object (usually a Hash), return directly
|
237
|
+
value
|
238
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
239
|
+
inner_type = Regexp.last_match[:inner_type]
|
240
|
+
value.map { |v| _deserialize(inner_type, v) }
|
241
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
242
|
+
k_type = Regexp.last_match[:k_type]
|
243
|
+
v_type = Regexp.last_match[:v_type]
|
244
|
+
{}.tap do |hash|
|
245
|
+
value.each do |k, v|
|
246
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
247
|
+
end
|
248
|
+
end
|
249
|
+
else # model
|
250
|
+
PulpcoreClient.const_get(type).build_from_hash(value)
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
# Returns the string representation of the object
|
255
|
+
# @return [String] String presentation of the object
|
256
|
+
def to_s
|
257
|
+
to_hash.to_s
|
258
|
+
end
|
259
|
+
|
260
|
+
# to_body is an alias to to_hash (backward compatibility)
|
261
|
+
# @return [Hash] Returns the object in the form of hash
|
262
|
+
def to_body
|
263
|
+
to_hash
|
264
|
+
end
|
265
|
+
|
266
|
+
# Returns the object in the form of hash
|
267
|
+
# @return [Hash] Returns the object in the form of hash
|
268
|
+
def to_hash
|
269
|
+
hash = {}
|
270
|
+
self.class.attribute_map.each_pair do |attr, param|
|
271
|
+
value = self.send(attr)
|
272
|
+
next if value.nil?
|
273
|
+
hash[param] = _to_hash(value)
|
274
|
+
end
|
275
|
+
hash
|
276
|
+
end
|
277
|
+
|
278
|
+
# Outputs non-array value in the form of hash
|
279
|
+
# For object, use to_hash. Otherwise, just return the value
|
280
|
+
# @param [Object] value Any valid value
|
281
|
+
# @return [Hash] Returns the value in the form of hash
|
282
|
+
def _to_hash(value)
|
283
|
+
if value.is_a?(Array)
|
284
|
+
value.compact.map { |v| _to_hash(v) }
|
285
|
+
elsif value.is_a?(Hash)
|
286
|
+
{}.tap do |hash|
|
287
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
288
|
+
end
|
289
|
+
elsif value.respond_to? :to_hash
|
290
|
+
value.to_hash
|
291
|
+
else
|
292
|
+
value
|
293
|
+
end
|
294
|
+
end
|
295
|
+
end
|
296
|
+
end
|
@@ -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.1-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpcoreClient
|
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 `PulpcoreClient::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 `PulpcoreClient::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
|
+
PulpcoreClient.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
|