pulpcore_client 3.105.16 → 3.106.0
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.
- checksums.yaml +4 -4
- data/README.md +8 -4
- data/docs/ArtifactDistributionResponse.md +19 -15
- data/docs/DataRepair7272.md +18 -0
- data/docs/DataRepair7465.md +18 -0
- data/docs/Datarepair7272Api.md +82 -0
- data/docs/Datarepair7465Api.md +82 -0
- data/docs/DistributionResponse.md +5 -1
- data/docs/DistributionsOpenpgpApi.md +2 -2
- data/docs/OpenPGPDistributionResponse.md +2 -0
- data/docs/OpenPGPKeyring.md +2 -0
- data/docs/OpenPGPKeyringResponse.md +2 -0
- data/docs/PatchedOpenPGPKeyring.md +2 -0
- data/docs/Purge.md +1 -1
- data/docs/RepositoriesApi.md +18 -2
- data/docs/RepositoriesOpenpgpKeyringApi.md +18 -2
- data/docs/RepositoryResponse.md +2 -0
- data/lib/pulpcore_client/api/datarepair7272_api.rb +93 -0
- data/lib/pulpcore_client/api/datarepair7465_api.rb +93 -0
- data/lib/pulpcore_client/api/distributions_openpgp_api.rb +4 -4
- data/lib/pulpcore_client/api/repositories_api.rb +27 -3
- data/lib/pulpcore_client/api/repositories_openpgp_keyring_api.rb +27 -3
- data/lib/pulpcore_client/models/artifact_distribution_response.rb +91 -70
- data/lib/pulpcore_client/models/data_repair7272.rb +217 -0
- data/lib/pulpcore_client/models/data_repair7465.rb +217 -0
- data/lib/pulpcore_client/models/distribution_response.rb +27 -6
- data/lib/pulpcore_client/models/open_pgp_distribution.rb +1 -1
- data/lib/pulpcore_client/models/open_pgp_distribution_response.rb +12 -2
- data/lib/pulpcore_client/models/open_pgp_keyring.rb +27 -1
- data/lib/pulpcore_client/models/open_pgp_keyring_response.rb +27 -1
- data/lib/pulpcore_client/models/patched_open_pgp_distribution.rb +1 -1
- data/lib/pulpcore_client/models/patched_open_pgp_keyring.rb +27 -1
- data/lib/pulpcore_client/models/purge.rb +1 -1
- data/lib/pulpcore_client/models/repository_response.rb +27 -1
- data/lib/pulpcore_client/version.rb +1 -1
- data/lib/pulpcore_client.rb +4 -0
- data/spec/api/datarepair7272_api_spec.rb +48 -0
- data/spec/api/datarepair7465_api_spec.rb +48 -0
- data/spec/api/distributions_openpgp_api_spec.rb +2 -2
- data/spec/api/repositories_api_spec.rb +9 -1
- data/spec/api/repositories_openpgp_keyring_api_spec.rb +9 -1
- data/spec/models/artifact_distribution_response_spec.rb +21 -9
- data/spec/models/data_repair7272_spec.rb +36 -0
- data/spec/models/data_repair7465_spec.rb +36 -0
- data/spec/models/distribution_response_spec.rb +12 -0
- data/spec/models/open_pgp_distribution_response_spec.rb +6 -0
- data/spec/models/open_pgp_keyring_response_spec.rb +6 -0
- data/spec/models/open_pgp_keyring_spec.rb +6 -0
- data/spec/models/patched_open_pgp_keyring_spec.rb +6 -0
- data/spec/models/repository_response_spec.rb +6 -0
- metadata +212 -196
|
@@ -16,51 +16,59 @@ require 'time'
|
|
|
16
16
|
module PulpcoreClient
|
|
17
17
|
# A serializer for ArtifactDistribution.
|
|
18
18
|
class ArtifactDistributionResponse
|
|
19
|
-
#
|
|
20
|
-
attr_accessor :
|
|
19
|
+
# Whether this distribution should be shown in the content app.
|
|
20
|
+
attr_accessor :hidden
|
|
21
21
|
|
|
22
|
-
#
|
|
23
|
-
attr_accessor :
|
|
22
|
+
# The URL for accessing the publication as defined by this distribution.
|
|
23
|
+
attr_accessor :base_url
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
attr_accessor :prn
|
|
25
|
+
attr_accessor :pulp_labels
|
|
27
26
|
|
|
28
|
-
#
|
|
29
|
-
attr_accessor :
|
|
27
|
+
# Timestamp since when the distributed content served by this distribution has not changed. If equals to `null`, no guarantee is provided about content changes.
|
|
28
|
+
attr_accessor :no_content_change_since
|
|
30
29
|
|
|
31
|
-
#
|
|
32
|
-
attr_accessor :
|
|
30
|
+
# RepositoryVersion to be served
|
|
31
|
+
attr_accessor :repository_version
|
|
33
32
|
|
|
34
33
|
# A unique name. Ex, `rawhide` and `stable`.
|
|
35
34
|
attr_accessor :name
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
attr_accessor :pulp_last_updated
|
|
36
|
+
attr_accessor :pulp_href
|
|
39
37
|
|
|
40
|
-
|
|
38
|
+
# The Pulp Resource Name (PRN).
|
|
39
|
+
attr_accessor :prn
|
|
41
40
|
|
|
42
|
-
# The
|
|
43
|
-
attr_accessor :
|
|
41
|
+
# The Pulp Resource Name (PRN) of the associated optional content guard.
|
|
42
|
+
attr_accessor :content_guard_prn
|
|
44
43
|
|
|
45
|
-
|
|
44
|
+
# An optional content-guard.
|
|
45
|
+
attr_accessor :content_guard
|
|
46
46
|
|
|
47
47
|
# Timestamp of creation.
|
|
48
48
|
attr_accessor :pulp_created
|
|
49
49
|
|
|
50
|
+
# The base (relative) path component of the published url. Avoid paths that overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")
|
|
51
|
+
attr_accessor :base_path
|
|
52
|
+
|
|
53
|
+
# Timestamp of the last time this resource was updated. Note: for immutable resources - like content, repository versions, and publication - pulp_created and pulp_last_updated dates will be the same.
|
|
54
|
+
attr_accessor :pulp_last_updated
|
|
55
|
+
|
|
50
56
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
51
57
|
def self.attribute_map
|
|
52
58
|
{
|
|
53
|
-
:'no_content_change_since' => :'no_content_change_since',
|
|
54
|
-
:'content_guard' => :'content_guard',
|
|
55
|
-
:'prn' => :'prn',
|
|
56
59
|
:'hidden' => :'hidden',
|
|
57
|
-
:'base_path' => :'base_path',
|
|
58
|
-
:'name' => :'name',
|
|
59
|
-
:'pulp_last_updated' => :'pulp_last_updated',
|
|
60
|
-
:'pulp_labels' => :'pulp_labels',
|
|
61
60
|
:'base_url' => :'base_url',
|
|
61
|
+
:'pulp_labels' => :'pulp_labels',
|
|
62
|
+
:'no_content_change_since' => :'no_content_change_since',
|
|
63
|
+
:'repository_version' => :'repository_version',
|
|
64
|
+
:'name' => :'name',
|
|
62
65
|
:'pulp_href' => :'pulp_href',
|
|
63
|
-
:'
|
|
66
|
+
:'prn' => :'prn',
|
|
67
|
+
:'content_guard_prn' => :'content_guard_prn',
|
|
68
|
+
:'content_guard' => :'content_guard',
|
|
69
|
+
:'pulp_created' => :'pulp_created',
|
|
70
|
+
:'base_path' => :'base_path',
|
|
71
|
+
:'pulp_last_updated' => :'pulp_last_updated'
|
|
64
72
|
}
|
|
65
73
|
end
|
|
66
74
|
|
|
@@ -72,23 +80,26 @@ module PulpcoreClient
|
|
|
72
80
|
# Attribute type mapping.
|
|
73
81
|
def self.openapi_types
|
|
74
82
|
{
|
|
75
|
-
:'no_content_change_since' => :'String',
|
|
76
|
-
:'content_guard' => :'String',
|
|
77
|
-
:'prn' => :'String',
|
|
78
83
|
:'hidden' => :'Boolean',
|
|
79
|
-
:'base_path' => :'String',
|
|
80
|
-
:'name' => :'String',
|
|
81
|
-
:'pulp_last_updated' => :'Time',
|
|
82
|
-
:'pulp_labels' => :'Hash<String, String>',
|
|
83
84
|
:'base_url' => :'String',
|
|
85
|
+
:'pulp_labels' => :'Hash<String, String>',
|
|
86
|
+
:'no_content_change_since' => :'String',
|
|
87
|
+
:'repository_version' => :'String',
|
|
88
|
+
:'name' => :'String',
|
|
84
89
|
:'pulp_href' => :'String',
|
|
85
|
-
:'
|
|
90
|
+
:'prn' => :'String',
|
|
91
|
+
:'content_guard_prn' => :'String',
|
|
92
|
+
:'content_guard' => :'String',
|
|
93
|
+
:'pulp_created' => :'Time',
|
|
94
|
+
:'base_path' => :'String',
|
|
95
|
+
:'pulp_last_updated' => :'Time'
|
|
86
96
|
}
|
|
87
97
|
end
|
|
88
98
|
|
|
89
99
|
# List of attributes with nullable: true
|
|
90
100
|
def self.openapi_nullable
|
|
91
101
|
Set.new([
|
|
102
|
+
:'repository_version',
|
|
92
103
|
:'content_guard',
|
|
93
104
|
])
|
|
94
105
|
end
|
|
@@ -108,28 +119,28 @@ module PulpcoreClient
|
|
|
108
119
|
h[k.to_sym] = v
|
|
109
120
|
}
|
|
110
121
|
|
|
111
|
-
if attributes.key?(:'
|
|
112
|
-
self.
|
|
122
|
+
if attributes.key?(:'hidden')
|
|
123
|
+
self.hidden = attributes[:'hidden']
|
|
124
|
+
else
|
|
125
|
+
self.hidden = false
|
|
113
126
|
end
|
|
114
127
|
|
|
115
|
-
if attributes.key?(:'
|
|
116
|
-
self.
|
|
128
|
+
if attributes.key?(:'base_url')
|
|
129
|
+
self.base_url = attributes[:'base_url']
|
|
117
130
|
end
|
|
118
131
|
|
|
119
|
-
if attributes.key?(:'
|
|
120
|
-
|
|
132
|
+
if attributes.key?(:'pulp_labels')
|
|
133
|
+
if (value = attributes[:'pulp_labels']).is_a?(Hash)
|
|
134
|
+
self.pulp_labels = value
|
|
135
|
+
end
|
|
121
136
|
end
|
|
122
137
|
|
|
123
|
-
if attributes.key?(:'
|
|
124
|
-
self.
|
|
125
|
-
else
|
|
126
|
-
self.hidden = false
|
|
138
|
+
if attributes.key?(:'no_content_change_since')
|
|
139
|
+
self.no_content_change_since = attributes[:'no_content_change_since']
|
|
127
140
|
end
|
|
128
141
|
|
|
129
|
-
if attributes.key?(:'
|
|
130
|
-
self.
|
|
131
|
-
else
|
|
132
|
-
self.base_path = nil
|
|
142
|
+
if attributes.key?(:'repository_version')
|
|
143
|
+
self.repository_version = attributes[:'repository_version']
|
|
133
144
|
end
|
|
134
145
|
|
|
135
146
|
if attributes.key?(:'name')
|
|
@@ -138,27 +149,35 @@ module PulpcoreClient
|
|
|
138
149
|
self.name = nil
|
|
139
150
|
end
|
|
140
151
|
|
|
141
|
-
if attributes.key?(:'
|
|
142
|
-
self.
|
|
152
|
+
if attributes.key?(:'pulp_href')
|
|
153
|
+
self.pulp_href = attributes[:'pulp_href']
|
|
143
154
|
end
|
|
144
155
|
|
|
145
|
-
if attributes.key?(:'
|
|
146
|
-
|
|
147
|
-
self.pulp_labels = value
|
|
148
|
-
end
|
|
156
|
+
if attributes.key?(:'prn')
|
|
157
|
+
self.prn = attributes[:'prn']
|
|
149
158
|
end
|
|
150
159
|
|
|
151
|
-
if attributes.key?(:'
|
|
152
|
-
self.
|
|
160
|
+
if attributes.key?(:'content_guard_prn')
|
|
161
|
+
self.content_guard_prn = attributes[:'content_guard_prn']
|
|
153
162
|
end
|
|
154
163
|
|
|
155
|
-
if attributes.key?(:'
|
|
156
|
-
self.
|
|
164
|
+
if attributes.key?(:'content_guard')
|
|
165
|
+
self.content_guard = attributes[:'content_guard']
|
|
157
166
|
end
|
|
158
167
|
|
|
159
168
|
if attributes.key?(:'pulp_created')
|
|
160
169
|
self.pulp_created = attributes[:'pulp_created']
|
|
161
170
|
end
|
|
171
|
+
|
|
172
|
+
if attributes.key?(:'base_path')
|
|
173
|
+
self.base_path = attributes[:'base_path']
|
|
174
|
+
else
|
|
175
|
+
self.base_path = nil
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
if attributes.key?(:'pulp_last_updated')
|
|
179
|
+
self.pulp_last_updated = attributes[:'pulp_last_updated']
|
|
180
|
+
end
|
|
162
181
|
end
|
|
163
182
|
|
|
164
183
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -166,14 +185,14 @@ module PulpcoreClient
|
|
|
166
185
|
def list_invalid_properties
|
|
167
186
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
168
187
|
invalid_properties = Array.new
|
|
169
|
-
if @base_path.nil?
|
|
170
|
-
invalid_properties.push('invalid value for "base_path", base_path cannot be nil.')
|
|
171
|
-
end
|
|
172
|
-
|
|
173
188
|
if @name.nil?
|
|
174
189
|
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
|
175
190
|
end
|
|
176
191
|
|
|
192
|
+
if @base_path.nil?
|
|
193
|
+
invalid_properties.push('invalid value for "base_path", base_path cannot be nil.')
|
|
194
|
+
end
|
|
195
|
+
|
|
177
196
|
invalid_properties
|
|
178
197
|
end
|
|
179
198
|
|
|
@@ -181,8 +200,8 @@ module PulpcoreClient
|
|
|
181
200
|
# @return true if the model is valid
|
|
182
201
|
def valid?
|
|
183
202
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
184
|
-
return false if @base_path.nil?
|
|
185
203
|
return false if @name.nil?
|
|
204
|
+
return false if @base_path.nil?
|
|
186
205
|
true
|
|
187
206
|
end
|
|
188
207
|
|
|
@@ -191,17 +210,19 @@ module PulpcoreClient
|
|
|
191
210
|
def ==(o)
|
|
192
211
|
return true if self.equal?(o)
|
|
193
212
|
self.class == o.class &&
|
|
194
|
-
no_content_change_since == o.no_content_change_since &&
|
|
195
|
-
content_guard == o.content_guard &&
|
|
196
|
-
prn == o.prn &&
|
|
197
213
|
hidden == o.hidden &&
|
|
198
|
-
base_path == o.base_path &&
|
|
199
|
-
name == o.name &&
|
|
200
|
-
pulp_last_updated == o.pulp_last_updated &&
|
|
201
|
-
pulp_labels == o.pulp_labels &&
|
|
202
214
|
base_url == o.base_url &&
|
|
215
|
+
pulp_labels == o.pulp_labels &&
|
|
216
|
+
no_content_change_since == o.no_content_change_since &&
|
|
217
|
+
repository_version == o.repository_version &&
|
|
218
|
+
name == o.name &&
|
|
203
219
|
pulp_href == o.pulp_href &&
|
|
204
|
-
|
|
220
|
+
prn == o.prn &&
|
|
221
|
+
content_guard_prn == o.content_guard_prn &&
|
|
222
|
+
content_guard == o.content_guard &&
|
|
223
|
+
pulp_created == o.pulp_created &&
|
|
224
|
+
base_path == o.base_path &&
|
|
225
|
+
pulp_last_updated == o.pulp_last_updated
|
|
205
226
|
end
|
|
206
227
|
|
|
207
228
|
# @see the `==` method
|
|
@@ -213,7 +234,7 @@ module PulpcoreClient
|
|
|
213
234
|
# Calculates hash code according to all attributes.
|
|
214
235
|
# @return [Integer] Hash code
|
|
215
236
|
def hash
|
|
216
|
-
[
|
|
237
|
+
[hidden, base_url, pulp_labels, no_content_change_since, repository_version, name, pulp_href, prn, content_guard_prn, content_guard, pulp_created, base_path, pulp_last_updated].hash
|
|
217
238
|
end
|
|
218
239
|
|
|
219
240
|
# Builds the object from hash
|
|
@@ -0,0 +1,217 @@
|
|
|
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 PulpcoreClient
|
|
17
|
+
class DataRepair7272
|
|
18
|
+
# If true, only report issues without fixing them. If false (default), repair the detected issues.
|
|
19
|
+
attr_accessor :dry_run
|
|
20
|
+
|
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
22
|
+
def self.attribute_map
|
|
23
|
+
{
|
|
24
|
+
:'dry_run' => :'dry_run'
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Returns all the JSON keys this model knows about
|
|
29
|
+
def self.acceptable_attributes
|
|
30
|
+
attribute_map.values
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Attribute type mapping.
|
|
34
|
+
def self.openapi_types
|
|
35
|
+
{
|
|
36
|
+
:'dry_run' => :'Boolean'
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# List of attributes with nullable: true
|
|
41
|
+
def self.openapi_nullable
|
|
42
|
+
Set.new([
|
|
43
|
+
])
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Initializes the object
|
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
48
|
+
def initialize(attributes = {})
|
|
49
|
+
if (!attributes.is_a?(Hash))
|
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::DataRepair7272` initialize method"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::DataRepair7272`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
57
|
+
end
|
|
58
|
+
h[k.to_sym] = v
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if attributes.key?(:'dry_run')
|
|
62
|
+
self.dry_run = attributes[:'dry_run']
|
|
63
|
+
else
|
|
64
|
+
self.dry_run = false
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
69
|
+
# @return Array for valid properties with the reasons
|
|
70
|
+
def list_invalid_properties
|
|
71
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
72
|
+
invalid_properties = Array.new
|
|
73
|
+
invalid_properties
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Check to see if the all the properties in the model are valid
|
|
77
|
+
# @return true if the model is valid
|
|
78
|
+
def valid?
|
|
79
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
80
|
+
true
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Checks equality by comparing each attribute.
|
|
84
|
+
# @param [Object] Object to be compared
|
|
85
|
+
def ==(o)
|
|
86
|
+
return true if self.equal?(o)
|
|
87
|
+
self.class == o.class &&
|
|
88
|
+
dry_run == o.dry_run
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# @see the `==` method
|
|
92
|
+
# @param [Object] Object to be compared
|
|
93
|
+
def eql?(o)
|
|
94
|
+
self == o
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Calculates hash code according to all attributes.
|
|
98
|
+
# @return [Integer] Hash code
|
|
99
|
+
def hash
|
|
100
|
+
[dry_run].hash
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Builds the object from hash
|
|
104
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
105
|
+
# @return [Object] Returns the model itself
|
|
106
|
+
def self.build_from_hash(attributes)
|
|
107
|
+
return nil unless attributes.is_a?(Hash)
|
|
108
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
109
|
+
transformed_hash = {}
|
|
110
|
+
openapi_types.each_pair do |key, type|
|
|
111
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
112
|
+
transformed_hash["#{key}"] = nil
|
|
113
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
114
|
+
# check to ensure the input is an array given that the attribute
|
|
115
|
+
# is documented as an array but the input is not
|
|
116
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
117
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
118
|
+
end
|
|
119
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
120
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
new(transformed_hash)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Deserializes the data based on type
|
|
127
|
+
# @param string type Data type
|
|
128
|
+
# @param string value Value to be deserialized
|
|
129
|
+
# @return [Object] Deserialized data
|
|
130
|
+
def self._deserialize(type, value)
|
|
131
|
+
case type.to_sym
|
|
132
|
+
when :Time
|
|
133
|
+
Time.parse(value)
|
|
134
|
+
when :Date
|
|
135
|
+
Date.parse(value)
|
|
136
|
+
when :String
|
|
137
|
+
value.to_s
|
|
138
|
+
when :Integer
|
|
139
|
+
value.to_i
|
|
140
|
+
when :Float
|
|
141
|
+
value.to_f
|
|
142
|
+
when :Boolean
|
|
143
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
144
|
+
true
|
|
145
|
+
else
|
|
146
|
+
false
|
|
147
|
+
end
|
|
148
|
+
when :Object
|
|
149
|
+
# generic object (usually a Hash), return directly
|
|
150
|
+
value
|
|
151
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
152
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
153
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
154
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
155
|
+
k_type = Regexp.last_match[:k_type]
|
|
156
|
+
v_type = Regexp.last_match[:v_type]
|
|
157
|
+
{}.tap do |hash|
|
|
158
|
+
value.each do |k, v|
|
|
159
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
else # model
|
|
163
|
+
# models (e.g. Pet) or oneOf
|
|
164
|
+
klass = PulpcoreClient.const_get(type)
|
|
165
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Returns the string representation of the object
|
|
170
|
+
# @return [String] String presentation of the object
|
|
171
|
+
def to_s
|
|
172
|
+
to_hash.to_s
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
176
|
+
# @return [Hash] Returns the object in the form of hash
|
|
177
|
+
def to_body
|
|
178
|
+
to_hash
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Returns the object in the form of hash
|
|
182
|
+
# @return [Hash] Returns the object in the form of hash
|
|
183
|
+
def to_hash
|
|
184
|
+
hash = {}
|
|
185
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
186
|
+
value = self.send(attr)
|
|
187
|
+
if value.nil?
|
|
188
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
189
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
hash[param] = _to_hash(value)
|
|
193
|
+
end
|
|
194
|
+
hash
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Outputs non-array value in the form of hash
|
|
198
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
199
|
+
# @param [Object] value Any valid value
|
|
200
|
+
# @return [Hash] Returns the value in the form of hash
|
|
201
|
+
def _to_hash(value)
|
|
202
|
+
if value.is_a?(Array)
|
|
203
|
+
value.compact.map { |v| _to_hash(v) }
|
|
204
|
+
elsif value.is_a?(Hash)
|
|
205
|
+
{}.tap do |hash|
|
|
206
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
207
|
+
end
|
|
208
|
+
elsif value.respond_to? :to_hash
|
|
209
|
+
value.to_hash
|
|
210
|
+
else
|
|
211
|
+
value
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
end
|