pulpcore_client 3.4.0.dev01590440775 → 3.5.0.dev01591046084
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pulpcore_client might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +15 -9
- data/docs/{Artifact.md → ArtifactRead.md} +2 -2
- data/docs/ArtifactsApi.md +4 -4
- data/docs/ExportersCoreExportsApi.md +2 -2
- data/docs/ExportersPulpApi.md +8 -8
- data/docs/{Import.md → ImportRead.md} +2 -2
- data/docs/ImportersCoreImportsApi.md +2 -2
- data/docs/ImportersPulpApi.md +8 -8
- data/docs/InlineResponse200.md +1 -1
- data/docs/InlineResponse2001.md +1 -1
- data/docs/InlineResponse2002.md +1 -1
- data/docs/InlineResponse2003.md +1 -1
- data/docs/InlineResponse2004.md +1 -1
- data/docs/InlineResponse2005.md +1 -1
- data/docs/InlineResponse2006.md +1 -1
- data/docs/InlineResponse2007.md +1 -1
- data/docs/InlineResponse2008.md +1 -1
- data/docs/InlineResponse2009.md +1 -1
- data/docs/PulpExport.md +10 -4
- data/docs/PulpExportRead.md +27 -0
- data/docs/PulpExporterRead.md +27 -0
- data/docs/PulpImporterRead.md +23 -0
- data/docs/{SigningService.md → SigningServiceRead.md} +2 -2
- data/docs/SigningServicesApi.md +2 -2
- data/docs/{TaskGroup.md → TaskGroupRead.md} +2 -2
- data/docs/TaskGroupsApi.md +2 -2
- data/docs/TaskRead.md +43 -0
- data/docs/TasksApi.md +2 -2
- data/docs/{UploadDetail.md → UploadDetailRead.md} +2 -2
- data/docs/UploadRead.md +23 -0
- data/docs/UploadsApi.md +4 -4
- data/docs/WorkerRead.md +23 -0
- data/docs/WorkersApi.md +2 -2
- data/lib/pulpcore_client.rb +11 -5
- data/lib/pulpcore_client/api/artifacts_api.rb +6 -6
- data/lib/pulpcore_client/api/exporters_core_exports_api.rb +3 -3
- data/lib/pulpcore_client/api/exporters_pulp_api.rb +12 -12
- data/lib/pulpcore_client/api/importers_core_imports_api.rb +3 -3
- data/lib/pulpcore_client/api/importers_pulp_api.rb +12 -12
- data/lib/pulpcore_client/api/signing_services_api.rb +3 -3
- data/lib/pulpcore_client/api/task_groups_api.rb +3 -3
- data/lib/pulpcore_client/api/tasks_api.rb +3 -3
- data/lib/pulpcore_client/api/uploads_api.rb +6 -6
- data/lib/pulpcore_client/api/workers_api.rb +3 -3
- data/lib/pulpcore_client/models/{artifact.rb → artifact_read.rb} +3 -3
- data/lib/pulpcore_client/models/{import.rb → import_read.rb} +3 -3
- data/lib/pulpcore_client/models/inline_response200.rb +1 -1
- data/lib/pulpcore_client/models/inline_response2001.rb +1 -1
- data/lib/pulpcore_client/models/inline_response2002.rb +1 -1
- data/lib/pulpcore_client/models/inline_response2003.rb +1 -1
- data/lib/pulpcore_client/models/inline_response2004.rb +1 -1
- data/lib/pulpcore_client/models/inline_response2005.rb +1 -1
- data/lib/pulpcore_client/models/inline_response2006.rb +1 -1
- data/lib/pulpcore_client/models/inline_response2007.rb +1 -1
- data/lib/pulpcore_client/models/inline_response2008.rb +1 -1
- data/lib/pulpcore_client/models/inline_response2009.rb +1 -1
- data/lib/pulpcore_client/models/pulp_export.rb +59 -38
- data/lib/pulpcore_client/models/pulp_export_read.rb +259 -0
- data/lib/pulpcore_client/models/pulp_exporter_read.rb +311 -0
- data/lib/pulpcore_client/models/pulp_importer_read.rb +262 -0
- data/lib/pulpcore_client/models/{signing_service.rb → signing_service_read.rb} +3 -3
- data/lib/pulpcore_client/models/{task_group.rb → task_group_read.rb} +3 -3
- data/lib/pulpcore_client/models/task_read.rb +383 -0
- data/lib/pulpcore_client/models/{upload_detail.rb → upload_detail_read.rb} +3 -3
- data/lib/pulpcore_client/models/upload_read.rb +241 -0
- data/lib/pulpcore_client/models/worker_read.rb +251 -0
- data/lib/pulpcore_client/version.rb +1 -1
- data/spec/api/artifacts_api_spec.rb +2 -2
- data/spec/api/exporters_core_exports_api_spec.rb +1 -1
- data/spec/api/exporters_pulp_api_spec.rb +4 -4
- data/spec/api/importers_core_imports_api_spec.rb +1 -1
- data/spec/api/importers_pulp_api_spec.rb +4 -4
- data/spec/api/signing_services_api_spec.rb +1 -1
- data/spec/api/task_groups_api_spec.rb +1 -1
- data/spec/api/tasks_api_spec.rb +1 -1
- data/spec/api/uploads_api_spec.rb +2 -2
- data/spec/api/workers_api_spec.rb +1 -1
- data/spec/models/{artifact_spec.rb → artifact_read_spec.rb} +6 -6
- data/spec/models/{import_spec.rb → import_read_spec.rb} +6 -6
- data/spec/models/pulp_export_read_spec.rb +71 -0
- data/spec/models/pulp_export_spec.rb +20 -2
- data/spec/models/pulp_exporter_read_spec.rb +71 -0
- data/spec/models/pulp_importer_read_spec.rb +59 -0
- data/spec/models/{signing_service_spec.rb → signing_service_read_spec.rb} +6 -6
- data/spec/models/{task_group_spec.rb → task_group_read_spec.rb} +6 -6
- data/spec/models/task_read_spec.rb +119 -0
- data/spec/models/{upload_detail_spec.rb → upload_detail_read_spec.rb} +6 -6
- data/spec/models/upload_read_spec.rb +59 -0
- data/spec/models/worker_read_spec.rb +59 -0
- metadata +46 -22
@@ -0,0 +1,241 @@
|
|
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.2.3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpcoreClient
|
16
|
+
class UploadRead
|
17
|
+
attr_accessor :pulp_href
|
18
|
+
|
19
|
+
# Timestamp of creation.
|
20
|
+
attr_accessor :pulp_created
|
21
|
+
|
22
|
+
# The size of the upload in bytes.
|
23
|
+
attr_accessor :size
|
24
|
+
|
25
|
+
# Timestamp when upload is committed.
|
26
|
+
attr_accessor :completed
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'pulp_href' => :'pulp_href',
|
32
|
+
:'pulp_created' => :'pulp_created',
|
33
|
+
:'size' => :'size',
|
34
|
+
:'completed' => :'completed'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.openapi_types
|
40
|
+
{
|
41
|
+
:'pulp_href' => :'String',
|
42
|
+
:'pulp_created' => :'DateTime',
|
43
|
+
:'size' => :'Integer',
|
44
|
+
:'completed' => :'DateTime'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# List of attributes with nullable: true
|
49
|
+
def self.openapi_nullable
|
50
|
+
Set.new([
|
51
|
+
])
|
52
|
+
end
|
53
|
+
|
54
|
+
# Initializes the object
|
55
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
56
|
+
def initialize(attributes = {})
|
57
|
+
if (!attributes.is_a?(Hash))
|
58
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::UploadRead` initialize method"
|
59
|
+
end
|
60
|
+
|
61
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
62
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
63
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
64
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::UploadRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
65
|
+
end
|
66
|
+
h[k.to_sym] = v
|
67
|
+
}
|
68
|
+
|
69
|
+
if attributes.key?(:'pulp_href')
|
70
|
+
self.pulp_href = attributes[:'pulp_href']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.key?(:'pulp_created')
|
74
|
+
self.pulp_created = attributes[:'pulp_created']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.key?(:'size')
|
78
|
+
self.size = attributes[:'size']
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes.key?(:'completed')
|
82
|
+
self.completed = attributes[:'completed']
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
87
|
+
# @return Array for valid properties with the reasons
|
88
|
+
def list_invalid_properties
|
89
|
+
invalid_properties = Array.new
|
90
|
+
if @size.nil?
|
91
|
+
invalid_properties.push('invalid value for "size", size cannot be nil.')
|
92
|
+
end
|
93
|
+
|
94
|
+
invalid_properties
|
95
|
+
end
|
96
|
+
|
97
|
+
# Check to see if the all the properties in the model are valid
|
98
|
+
# @return true if the model is valid
|
99
|
+
def valid?
|
100
|
+
return false if @size.nil?
|
101
|
+
true
|
102
|
+
end
|
103
|
+
|
104
|
+
# Checks equality by comparing each attribute.
|
105
|
+
# @param [Object] Object to be compared
|
106
|
+
def ==(o)
|
107
|
+
return true if self.equal?(o)
|
108
|
+
self.class == o.class &&
|
109
|
+
pulp_href == o.pulp_href &&
|
110
|
+
pulp_created == o.pulp_created &&
|
111
|
+
size == o.size &&
|
112
|
+
completed == o.completed
|
113
|
+
end
|
114
|
+
|
115
|
+
# @see the `==` method
|
116
|
+
# @param [Object] Object to be compared
|
117
|
+
def eql?(o)
|
118
|
+
self == o
|
119
|
+
end
|
120
|
+
|
121
|
+
# Calculates hash code according to all attributes.
|
122
|
+
# @return [Integer] Hash code
|
123
|
+
def hash
|
124
|
+
[pulp_href, pulp_created, size, completed].hash
|
125
|
+
end
|
126
|
+
|
127
|
+
# Builds the object from hash
|
128
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
129
|
+
# @return [Object] Returns the model itself
|
130
|
+
def self.build_from_hash(attributes)
|
131
|
+
new.build_from_hash(attributes)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Builds the object from hash
|
135
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
136
|
+
# @return [Object] Returns the model itself
|
137
|
+
def build_from_hash(attributes)
|
138
|
+
return nil unless attributes.is_a?(Hash)
|
139
|
+
self.class.openapi_types.each_pair do |key, type|
|
140
|
+
if type =~ /\AArray<(.*)>/i
|
141
|
+
# check to ensure the input is an array given that the attribute
|
142
|
+
# is documented as an array but the input is not
|
143
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
144
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
145
|
+
end
|
146
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
147
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
148
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
149
|
+
end
|
150
|
+
|
151
|
+
self
|
152
|
+
end
|
153
|
+
|
154
|
+
# Deserializes the data based on type
|
155
|
+
# @param string type Data type
|
156
|
+
# @param string value Value to be deserialized
|
157
|
+
# @return [Object] Deserialized data
|
158
|
+
def _deserialize(type, value)
|
159
|
+
case type.to_sym
|
160
|
+
when :DateTime
|
161
|
+
DateTime.parse(value)
|
162
|
+
when :Date
|
163
|
+
Date.parse(value)
|
164
|
+
when :String
|
165
|
+
value.to_s
|
166
|
+
when :Integer
|
167
|
+
value.to_i
|
168
|
+
when :Float
|
169
|
+
value.to_f
|
170
|
+
when :Boolean
|
171
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
172
|
+
true
|
173
|
+
else
|
174
|
+
false
|
175
|
+
end
|
176
|
+
when :Object
|
177
|
+
# generic object (usually a Hash), return directly
|
178
|
+
value
|
179
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
180
|
+
inner_type = Regexp.last_match[:inner_type]
|
181
|
+
value.map { |v| _deserialize(inner_type, v) }
|
182
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
183
|
+
k_type = Regexp.last_match[:k_type]
|
184
|
+
v_type = Regexp.last_match[:v_type]
|
185
|
+
{}.tap do |hash|
|
186
|
+
value.each do |k, v|
|
187
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
else # model
|
191
|
+
PulpcoreClient.const_get(type).build_from_hash(value)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
# Returns the string representation of the object
|
196
|
+
# @return [String] String presentation of the object
|
197
|
+
def to_s
|
198
|
+
to_hash.to_s
|
199
|
+
end
|
200
|
+
|
201
|
+
# to_body is an alias to to_hash (backward compatibility)
|
202
|
+
# @return [Hash] Returns the object in the form of hash
|
203
|
+
def to_body
|
204
|
+
to_hash
|
205
|
+
end
|
206
|
+
|
207
|
+
# Returns the object in the form of hash
|
208
|
+
# @return [Hash] Returns the object in the form of hash
|
209
|
+
def to_hash
|
210
|
+
hash = {}
|
211
|
+
self.class.attribute_map.each_pair do |attr, param|
|
212
|
+
value = self.send(attr)
|
213
|
+
if value.nil?
|
214
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
215
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
216
|
+
end
|
217
|
+
|
218
|
+
hash[param] = _to_hash(value)
|
219
|
+
end
|
220
|
+
hash
|
221
|
+
end
|
222
|
+
|
223
|
+
# Outputs non-array value in the form of hash
|
224
|
+
# For object, use to_hash. Otherwise, just return the value
|
225
|
+
# @param [Object] value Any valid value
|
226
|
+
# @return [Hash] Returns the value in the form of hash
|
227
|
+
def _to_hash(value)
|
228
|
+
if value.is_a?(Array)
|
229
|
+
value.compact.map { |v| _to_hash(v) }
|
230
|
+
elsif value.is_a?(Hash)
|
231
|
+
{}.tap do |hash|
|
232
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
233
|
+
end
|
234
|
+
elsif value.respond_to? :to_hash
|
235
|
+
value.to_hash
|
236
|
+
else
|
237
|
+
value
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
@@ -0,0 +1,251 @@
|
|
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.2.3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpcoreClient
|
16
|
+
class WorkerRead
|
17
|
+
attr_accessor :pulp_href
|
18
|
+
|
19
|
+
# Timestamp of creation.
|
20
|
+
attr_accessor :pulp_created
|
21
|
+
|
22
|
+
# The name of the worker.
|
23
|
+
attr_accessor :name
|
24
|
+
|
25
|
+
# Timestamp of the last time the worker talked to the service.
|
26
|
+
attr_accessor :last_heartbeat
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'pulp_href' => :'pulp_href',
|
32
|
+
:'pulp_created' => :'pulp_created',
|
33
|
+
:'name' => :'name',
|
34
|
+
:'last_heartbeat' => :'last_heartbeat'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.openapi_types
|
40
|
+
{
|
41
|
+
:'pulp_href' => :'String',
|
42
|
+
:'pulp_created' => :'DateTime',
|
43
|
+
:'name' => :'String',
|
44
|
+
:'last_heartbeat' => :'DateTime'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# List of attributes with nullable: true
|
49
|
+
def self.openapi_nullable
|
50
|
+
Set.new([
|
51
|
+
])
|
52
|
+
end
|
53
|
+
|
54
|
+
# Initializes the object
|
55
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
56
|
+
def initialize(attributes = {})
|
57
|
+
if (!attributes.is_a?(Hash))
|
58
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::WorkerRead` initialize method"
|
59
|
+
end
|
60
|
+
|
61
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
62
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
63
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
64
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::WorkerRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
65
|
+
end
|
66
|
+
h[k.to_sym] = v
|
67
|
+
}
|
68
|
+
|
69
|
+
if attributes.key?(:'pulp_href')
|
70
|
+
self.pulp_href = attributes[:'pulp_href']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.key?(:'pulp_created')
|
74
|
+
self.pulp_created = attributes[:'pulp_created']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.key?(:'name')
|
78
|
+
self.name = attributes[:'name']
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes.key?(:'last_heartbeat')
|
82
|
+
self.last_heartbeat = attributes[:'last_heartbeat']
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
87
|
+
# @return Array for valid properties with the reasons
|
88
|
+
def list_invalid_properties
|
89
|
+
invalid_properties = Array.new
|
90
|
+
if !@name.nil? && @name.to_s.length < 1
|
91
|
+
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
|
92
|
+
end
|
93
|
+
|
94
|
+
invalid_properties
|
95
|
+
end
|
96
|
+
|
97
|
+
# Check to see if the all the properties in the model are valid
|
98
|
+
# @return true if the model is valid
|
99
|
+
def valid?
|
100
|
+
return false if !@name.nil? && @name.to_s.length < 1
|
101
|
+
true
|
102
|
+
end
|
103
|
+
|
104
|
+
# Custom attribute writer method with validation
|
105
|
+
# @param [Object] name Value to be assigned
|
106
|
+
def name=(name)
|
107
|
+
if !name.nil? && name.to_s.length < 1
|
108
|
+
fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
|
109
|
+
end
|
110
|
+
|
111
|
+
@name = name
|
112
|
+
end
|
113
|
+
|
114
|
+
# Checks equality by comparing each attribute.
|
115
|
+
# @param [Object] Object to be compared
|
116
|
+
def ==(o)
|
117
|
+
return true if self.equal?(o)
|
118
|
+
self.class == o.class &&
|
119
|
+
pulp_href == o.pulp_href &&
|
120
|
+
pulp_created == o.pulp_created &&
|
121
|
+
name == o.name &&
|
122
|
+
last_heartbeat == o.last_heartbeat
|
123
|
+
end
|
124
|
+
|
125
|
+
# @see the `==` method
|
126
|
+
# @param [Object] Object to be compared
|
127
|
+
def eql?(o)
|
128
|
+
self == o
|
129
|
+
end
|
130
|
+
|
131
|
+
# Calculates hash code according to all attributes.
|
132
|
+
# @return [Integer] Hash code
|
133
|
+
def hash
|
134
|
+
[pulp_href, pulp_created, name, last_heartbeat].hash
|
135
|
+
end
|
136
|
+
|
137
|
+
# Builds the object from hash
|
138
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
139
|
+
# @return [Object] Returns the model itself
|
140
|
+
def self.build_from_hash(attributes)
|
141
|
+
new.build_from_hash(attributes)
|
142
|
+
end
|
143
|
+
|
144
|
+
# Builds the object from hash
|
145
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
146
|
+
# @return [Object] Returns the model itself
|
147
|
+
def build_from_hash(attributes)
|
148
|
+
return nil unless attributes.is_a?(Hash)
|
149
|
+
self.class.openapi_types.each_pair do |key, type|
|
150
|
+
if type =~ /\AArray<(.*)>/i
|
151
|
+
# check to ensure the input is an array given that the attribute
|
152
|
+
# is documented as an array but the input is not
|
153
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
154
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
155
|
+
end
|
156
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
157
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
158
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
159
|
+
end
|
160
|
+
|
161
|
+
self
|
162
|
+
end
|
163
|
+
|
164
|
+
# Deserializes the data based on type
|
165
|
+
# @param string type Data type
|
166
|
+
# @param string value Value to be deserialized
|
167
|
+
# @return [Object] Deserialized data
|
168
|
+
def _deserialize(type, value)
|
169
|
+
case type.to_sym
|
170
|
+
when :DateTime
|
171
|
+
DateTime.parse(value)
|
172
|
+
when :Date
|
173
|
+
Date.parse(value)
|
174
|
+
when :String
|
175
|
+
value.to_s
|
176
|
+
when :Integer
|
177
|
+
value.to_i
|
178
|
+
when :Float
|
179
|
+
value.to_f
|
180
|
+
when :Boolean
|
181
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
182
|
+
true
|
183
|
+
else
|
184
|
+
false
|
185
|
+
end
|
186
|
+
when :Object
|
187
|
+
# generic object (usually a Hash), return directly
|
188
|
+
value
|
189
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
190
|
+
inner_type = Regexp.last_match[:inner_type]
|
191
|
+
value.map { |v| _deserialize(inner_type, v) }
|
192
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
193
|
+
k_type = Regexp.last_match[:k_type]
|
194
|
+
v_type = Regexp.last_match[:v_type]
|
195
|
+
{}.tap do |hash|
|
196
|
+
value.each do |k, v|
|
197
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
else # model
|
201
|
+
PulpcoreClient.const_get(type).build_from_hash(value)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# Returns the string representation of the object
|
206
|
+
# @return [String] String presentation of the object
|
207
|
+
def to_s
|
208
|
+
to_hash.to_s
|
209
|
+
end
|
210
|
+
|
211
|
+
# to_body is an alias to to_hash (backward compatibility)
|
212
|
+
# @return [Hash] Returns the object in the form of hash
|
213
|
+
def to_body
|
214
|
+
to_hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Returns the object in the form of hash
|
218
|
+
# @return [Hash] Returns the object in the form of hash
|
219
|
+
def to_hash
|
220
|
+
hash = {}
|
221
|
+
self.class.attribute_map.each_pair do |attr, param|
|
222
|
+
value = self.send(attr)
|
223
|
+
if value.nil?
|
224
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
225
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
226
|
+
end
|
227
|
+
|
228
|
+
hash[param] = _to_hash(value)
|
229
|
+
end
|
230
|
+
hash
|
231
|
+
end
|
232
|
+
|
233
|
+
# Outputs non-array value in the form of hash
|
234
|
+
# For object, use to_hash. Otherwise, just return the value
|
235
|
+
# @param [Object] value Any valid value
|
236
|
+
# @return [Hash] Returns the value in the form of hash
|
237
|
+
def _to_hash(value)
|
238
|
+
if value.is_a?(Array)
|
239
|
+
value.compact.map { |v| _to_hash(v) }
|
240
|
+
elsif value.is_a?(Hash)
|
241
|
+
{}.tap do |hash|
|
242
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
243
|
+
end
|
244
|
+
elsif value.respond_to? :to_hash
|
245
|
+
value.to_hash
|
246
|
+
else
|
247
|
+
value
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|