pulpcore_client 3.38.1 → 3.39.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 +18 -4
- data/docs/ArtifactDistributionResponse.md +10 -10
- data/docs/ContentguardsApi.md +4 -4
- data/docs/ContentguardsHeaderApi.md +607 -0
- data/docs/HeaderContentGuard.md +25 -0
- data/docs/HeaderContentGuardResponse.md +29 -0
- data/docs/PaginatedHeaderContentGuardResponseList.md +23 -0
- data/docs/PatchedHeaderContentGuard.md +25 -0
- data/lib/pulpcore_client/api/contentguards_api.rb +6 -6
- data/lib/pulpcore_client/api/contentguards_header_api.rb +741 -0
- data/lib/pulpcore_client/models/artifact_distribution_response.rb +46 -46
- data/lib/pulpcore_client/models/header_content_guard.rb +352 -0
- data/lib/pulpcore_client/models/header_content_guard_response.rb +284 -0
- data/lib/pulpcore_client/models/paginated_header_content_guard_response_list.rb +237 -0
- data/lib/pulpcore_client/models/patched_header_content_guard.rb +325 -0
- data/lib/pulpcore_client/version.rb +1 -1
- data/lib/pulpcore_client.rb +5 -0
- data/spec/api/contentguards_api_spec.rb +2 -2
- data/spec/api/contentguards_header_api_spec.rb +181 -0
- data/spec/models/artifact_distribution_response_spec.rb +7 -7
- data/spec/models/header_content_guard_response_spec.rb +77 -0
- data/spec/models/header_content_guard_spec.rb +65 -0
- data/spec/models/paginated_header_content_guard_response_list_spec.rb +59 -0
- data/spec/models/patched_header_content_guard_spec.rb +65 -0
- metadata +160 -140
|
@@ -15,60 +15,60 @@ require 'date'
|
|
|
15
15
|
module PulpcoreClient
|
|
16
16
|
# A serializer for ArtifactDistribution.
|
|
17
17
|
class ArtifactDistributionResponse
|
|
18
|
+
# The base (relative) path component of the published url. Avoid paths that overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")
|
|
19
|
+
attr_accessor :base_path
|
|
20
|
+
|
|
21
|
+
# Whether this distribution should be shown in the content app.
|
|
22
|
+
attr_accessor :hidden
|
|
23
|
+
|
|
24
|
+
# The URL for accessing the publication as defined by this distribution.
|
|
25
|
+
attr_accessor :base_url
|
|
26
|
+
|
|
18
27
|
attr_accessor :pulp_labels
|
|
19
28
|
|
|
29
|
+
attr_accessor :pulp_href
|
|
30
|
+
|
|
20
31
|
# Timestamp of creation.
|
|
21
32
|
attr_accessor :pulp_created
|
|
22
33
|
|
|
23
|
-
# The base (relative) path component of the published url. Avoid paths that overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")
|
|
24
|
-
attr_accessor :base_path
|
|
25
|
-
|
|
26
34
|
# A unique name. Ex, `rawhide` and `stable`.
|
|
27
35
|
attr_accessor :name
|
|
28
36
|
|
|
29
|
-
attr_accessor :pulp_href
|
|
30
|
-
|
|
31
37
|
# An optional content-guard.
|
|
32
38
|
attr_accessor :content_guard
|
|
33
39
|
|
|
34
|
-
# Whether this distribution should be shown in the content app.
|
|
35
|
-
attr_accessor :hidden
|
|
36
|
-
|
|
37
|
-
# The URL for accessing the publication as defined by this distribution.
|
|
38
|
-
attr_accessor :base_url
|
|
39
|
-
|
|
40
40
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
41
41
|
def self.attribute_map
|
|
42
42
|
{
|
|
43
|
+
:'base_path' => :'base_path',
|
|
44
|
+
:'hidden' => :'hidden',
|
|
45
|
+
:'base_url' => :'base_url',
|
|
43
46
|
:'pulp_labels' => :'pulp_labels',
|
|
47
|
+
:'pulp_href' => :'pulp_href',
|
|
44
48
|
:'pulp_created' => :'pulp_created',
|
|
45
|
-
:'base_path' => :'base_path',
|
|
46
49
|
:'name' => :'name',
|
|
47
|
-
:'
|
|
48
|
-
:'content_guard' => :'content_guard',
|
|
49
|
-
:'hidden' => :'hidden',
|
|
50
|
-
:'base_url' => :'base_url'
|
|
50
|
+
:'content_guard' => :'content_guard'
|
|
51
51
|
}
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
# Attribute type mapping.
|
|
55
55
|
def self.openapi_types
|
|
56
56
|
{
|
|
57
|
+
:'base_path' => :'String',
|
|
58
|
+
:'hidden' => :'Boolean',
|
|
59
|
+
:'base_url' => :'String',
|
|
57
60
|
:'pulp_labels' => :'Hash<String, String>',
|
|
61
|
+
:'pulp_href' => :'String',
|
|
58
62
|
:'pulp_created' => :'DateTime',
|
|
59
|
-
:'base_path' => :'String',
|
|
60
63
|
:'name' => :'String',
|
|
61
|
-
:'
|
|
62
|
-
:'content_guard' => :'String',
|
|
63
|
-
:'hidden' => :'Boolean',
|
|
64
|
-
:'base_url' => :'String'
|
|
64
|
+
:'content_guard' => :'String'
|
|
65
65
|
}
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
# List of attributes with nullable: true
|
|
69
69
|
def self.openapi_nullable
|
|
70
70
|
Set.new([
|
|
71
|
-
:'content_guard'
|
|
71
|
+
:'content_guard'
|
|
72
72
|
])
|
|
73
73
|
end
|
|
74
74
|
|
|
@@ -87,40 +87,40 @@ module PulpcoreClient
|
|
|
87
87
|
h[k.to_sym] = v
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
if attributes.key?(:'
|
|
91
|
-
|
|
92
|
-
self.pulp_labels = value
|
|
93
|
-
end
|
|
90
|
+
if attributes.key?(:'base_path')
|
|
91
|
+
self.base_path = attributes[:'base_path']
|
|
94
92
|
end
|
|
95
93
|
|
|
96
|
-
if attributes.key?(:'
|
|
97
|
-
self.
|
|
94
|
+
if attributes.key?(:'hidden')
|
|
95
|
+
self.hidden = attributes[:'hidden']
|
|
96
|
+
else
|
|
97
|
+
self.hidden = false
|
|
98
98
|
end
|
|
99
99
|
|
|
100
|
-
if attributes.key?(:'
|
|
101
|
-
self.
|
|
100
|
+
if attributes.key?(:'base_url')
|
|
101
|
+
self.base_url = attributes[:'base_url']
|
|
102
102
|
end
|
|
103
103
|
|
|
104
|
-
if attributes.key?(:'
|
|
105
|
-
|
|
104
|
+
if attributes.key?(:'pulp_labels')
|
|
105
|
+
if (value = attributes[:'pulp_labels']).is_a?(Hash)
|
|
106
|
+
self.pulp_labels = value
|
|
107
|
+
end
|
|
106
108
|
end
|
|
107
109
|
|
|
108
110
|
if attributes.key?(:'pulp_href')
|
|
109
111
|
self.pulp_href = attributes[:'pulp_href']
|
|
110
112
|
end
|
|
111
113
|
|
|
112
|
-
if attributes.key?(:'
|
|
113
|
-
self.
|
|
114
|
+
if attributes.key?(:'pulp_created')
|
|
115
|
+
self.pulp_created = attributes[:'pulp_created']
|
|
114
116
|
end
|
|
115
117
|
|
|
116
|
-
if attributes.key?(:'
|
|
117
|
-
self.
|
|
118
|
-
else
|
|
119
|
-
self.hidden = false
|
|
118
|
+
if attributes.key?(:'name')
|
|
119
|
+
self.name = attributes[:'name']
|
|
120
120
|
end
|
|
121
121
|
|
|
122
|
-
if attributes.key?(:'
|
|
123
|
-
self.
|
|
122
|
+
if attributes.key?(:'content_guard')
|
|
123
|
+
self.content_guard = attributes[:'content_guard']
|
|
124
124
|
end
|
|
125
125
|
end
|
|
126
126
|
|
|
@@ -152,14 +152,14 @@ module PulpcoreClient
|
|
|
152
152
|
def ==(o)
|
|
153
153
|
return true if self.equal?(o)
|
|
154
154
|
self.class == o.class &&
|
|
155
|
+
base_path == o.base_path &&
|
|
156
|
+
hidden == o.hidden &&
|
|
157
|
+
base_url == o.base_url &&
|
|
155
158
|
pulp_labels == o.pulp_labels &&
|
|
159
|
+
pulp_href == o.pulp_href &&
|
|
156
160
|
pulp_created == o.pulp_created &&
|
|
157
|
-
base_path == o.base_path &&
|
|
158
161
|
name == o.name &&
|
|
159
|
-
|
|
160
|
-
content_guard == o.content_guard &&
|
|
161
|
-
hidden == o.hidden &&
|
|
162
|
-
base_url == o.base_url
|
|
162
|
+
content_guard == o.content_guard
|
|
163
163
|
end
|
|
164
164
|
|
|
165
165
|
# @see the `==` method
|
|
@@ -171,7 +171,7 @@ module PulpcoreClient
|
|
|
171
171
|
# Calculates hash code according to all attributes.
|
|
172
172
|
# @return [Integer] Hash code
|
|
173
173
|
def hash
|
|
174
|
-
[
|
|
174
|
+
[base_path, hidden, base_url, pulp_labels, pulp_href, pulp_created, name, content_guard].hash
|
|
175
175
|
end
|
|
176
176
|
|
|
177
177
|
# Builds the object from hash
|
|
@@ -0,0 +1,352 @@
|
|
|
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
|
+
# A serializer for HeaderContentGuard.
|
|
17
|
+
class HeaderContentGuard
|
|
18
|
+
# The unique name.
|
|
19
|
+
attr_accessor :name
|
|
20
|
+
|
|
21
|
+
# An optional description.
|
|
22
|
+
attr_accessor :description
|
|
23
|
+
|
|
24
|
+
# The header name the guard will check on.
|
|
25
|
+
attr_accessor :header_name
|
|
26
|
+
|
|
27
|
+
# The value that will authorize the request.
|
|
28
|
+
attr_accessor :header_value
|
|
29
|
+
|
|
30
|
+
# A JQ syntax compatible filter. If jq_filter is not set, then the value willonly be Base64 decoded and checked as an explicit string match.
|
|
31
|
+
attr_accessor :jq_filter
|
|
32
|
+
|
|
33
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
34
|
+
def self.attribute_map
|
|
35
|
+
{
|
|
36
|
+
:'name' => :'name',
|
|
37
|
+
:'description' => :'description',
|
|
38
|
+
:'header_name' => :'header_name',
|
|
39
|
+
:'header_value' => :'header_value',
|
|
40
|
+
:'jq_filter' => :'jq_filter'
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Attribute type mapping.
|
|
45
|
+
def self.openapi_types
|
|
46
|
+
{
|
|
47
|
+
:'name' => :'String',
|
|
48
|
+
:'description' => :'String',
|
|
49
|
+
:'header_name' => :'String',
|
|
50
|
+
:'header_value' => :'String',
|
|
51
|
+
:'jq_filter' => :'String'
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# List of attributes with nullable: true
|
|
56
|
+
def self.openapi_nullable
|
|
57
|
+
Set.new([
|
|
58
|
+
:'description',
|
|
59
|
+
:'jq_filter'
|
|
60
|
+
])
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Initializes the object
|
|
64
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
65
|
+
def initialize(attributes = {})
|
|
66
|
+
if (!attributes.is_a?(Hash))
|
|
67
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::HeaderContentGuard` initialize method"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
71
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
72
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
73
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::HeaderContentGuard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
74
|
+
end
|
|
75
|
+
h[k.to_sym] = v
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if attributes.key?(:'name')
|
|
79
|
+
self.name = attributes[:'name']
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
if attributes.key?(:'description')
|
|
83
|
+
self.description = attributes[:'description']
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
if attributes.key?(:'header_name')
|
|
87
|
+
self.header_name = attributes[:'header_name']
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
if attributes.key?(:'header_value')
|
|
91
|
+
self.header_value = attributes[:'header_value']
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if attributes.key?(:'jq_filter')
|
|
95
|
+
self.jq_filter = attributes[:'jq_filter']
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
100
|
+
# @return Array for valid properties with the reasons
|
|
101
|
+
def list_invalid_properties
|
|
102
|
+
invalid_properties = Array.new
|
|
103
|
+
if @name.nil?
|
|
104
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
if @name.to_s.length < 1
|
|
108
|
+
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
if !@description.nil? && @description.to_s.length < 1
|
|
112
|
+
invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.')
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
if @header_name.nil?
|
|
116
|
+
invalid_properties.push('invalid value for "header_name", header_name cannot be nil.')
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
if @header_name.to_s.length < 1
|
|
120
|
+
invalid_properties.push('invalid value for "header_name", the character length must be great than or equal to 1.')
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
if @header_value.nil?
|
|
124
|
+
invalid_properties.push('invalid value for "header_value", header_value cannot be nil.')
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
if @header_value.to_s.length < 1
|
|
128
|
+
invalid_properties.push('invalid value for "header_value", the character length must be great than or equal to 1.')
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if !@jq_filter.nil? && @jq_filter.to_s.length < 1
|
|
132
|
+
invalid_properties.push('invalid value for "jq_filter", the character length must be great than or equal to 1.')
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
invalid_properties
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Check to see if the all the properties in the model are valid
|
|
139
|
+
# @return true if the model is valid
|
|
140
|
+
def valid?
|
|
141
|
+
return false if @name.nil?
|
|
142
|
+
return false if @name.to_s.length < 1
|
|
143
|
+
return false if !@description.nil? && @description.to_s.length < 1
|
|
144
|
+
return false if @header_name.nil?
|
|
145
|
+
return false if @header_name.to_s.length < 1
|
|
146
|
+
return false if @header_value.nil?
|
|
147
|
+
return false if @header_value.to_s.length < 1
|
|
148
|
+
return false if !@jq_filter.nil? && @jq_filter.to_s.length < 1
|
|
149
|
+
true
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Custom attribute writer method with validation
|
|
153
|
+
# @param [Object] name Value to be assigned
|
|
154
|
+
def name=(name)
|
|
155
|
+
if name.nil?
|
|
156
|
+
fail ArgumentError, 'name cannot be nil'
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
if name.to_s.length < 1
|
|
160
|
+
fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
@name = name
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Custom attribute writer method with validation
|
|
167
|
+
# @param [Object] description Value to be assigned
|
|
168
|
+
def description=(description)
|
|
169
|
+
if !description.nil? && description.to_s.length < 1
|
|
170
|
+
fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.'
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
@description = description
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Custom attribute writer method with validation
|
|
177
|
+
# @param [Object] header_name Value to be assigned
|
|
178
|
+
def header_name=(header_name)
|
|
179
|
+
if header_name.nil?
|
|
180
|
+
fail ArgumentError, 'header_name cannot be nil'
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
if header_name.to_s.length < 1
|
|
184
|
+
fail ArgumentError, 'invalid value for "header_name", the character length must be great than or equal to 1.'
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
@header_name = header_name
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Custom attribute writer method with validation
|
|
191
|
+
# @param [Object] header_value Value to be assigned
|
|
192
|
+
def header_value=(header_value)
|
|
193
|
+
if header_value.nil?
|
|
194
|
+
fail ArgumentError, 'header_value cannot be nil'
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
if header_value.to_s.length < 1
|
|
198
|
+
fail ArgumentError, 'invalid value for "header_value", the character length must be great than or equal to 1.'
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
@header_value = header_value
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# Custom attribute writer method with validation
|
|
205
|
+
# @param [Object] jq_filter Value to be assigned
|
|
206
|
+
def jq_filter=(jq_filter)
|
|
207
|
+
if !jq_filter.nil? && jq_filter.to_s.length < 1
|
|
208
|
+
fail ArgumentError, 'invalid value for "jq_filter", the character length must be great than or equal to 1.'
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
@jq_filter = jq_filter
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Checks equality by comparing each attribute.
|
|
215
|
+
# @param [Object] Object to be compared
|
|
216
|
+
def ==(o)
|
|
217
|
+
return true if self.equal?(o)
|
|
218
|
+
self.class == o.class &&
|
|
219
|
+
name == o.name &&
|
|
220
|
+
description == o.description &&
|
|
221
|
+
header_name == o.header_name &&
|
|
222
|
+
header_value == o.header_value &&
|
|
223
|
+
jq_filter == o.jq_filter
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# @see the `==` method
|
|
227
|
+
# @param [Object] Object to be compared
|
|
228
|
+
def eql?(o)
|
|
229
|
+
self == o
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
# Calculates hash code according to all attributes.
|
|
233
|
+
# @return [Integer] Hash code
|
|
234
|
+
def hash
|
|
235
|
+
[name, description, header_name, header_value, jq_filter].hash
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# Builds the object from hash
|
|
239
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
240
|
+
# @return [Object] Returns the model itself
|
|
241
|
+
def self.build_from_hash(attributes)
|
|
242
|
+
new.build_from_hash(attributes)
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# Builds the object from hash
|
|
246
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
247
|
+
# @return [Object] Returns the model itself
|
|
248
|
+
def build_from_hash(attributes)
|
|
249
|
+
return nil unless attributes.is_a?(Hash)
|
|
250
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
251
|
+
if type =~ /\AArray<(.*)>/i
|
|
252
|
+
# check to ensure the input is an array given that the attribute
|
|
253
|
+
# is documented as an array but the input is not
|
|
254
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
255
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
256
|
+
end
|
|
257
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
258
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
259
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
self
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
# Deserializes the data based on type
|
|
266
|
+
# @param string type Data type
|
|
267
|
+
# @param string value Value to be deserialized
|
|
268
|
+
# @return [Object] Deserialized data
|
|
269
|
+
def _deserialize(type, value)
|
|
270
|
+
case type.to_sym
|
|
271
|
+
when :DateTime
|
|
272
|
+
DateTime.parse(value)
|
|
273
|
+
when :Date
|
|
274
|
+
Date.parse(value)
|
|
275
|
+
when :String
|
|
276
|
+
value.to_s
|
|
277
|
+
when :Integer
|
|
278
|
+
value.to_i
|
|
279
|
+
when :Float
|
|
280
|
+
value.to_f
|
|
281
|
+
when :Boolean
|
|
282
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
283
|
+
true
|
|
284
|
+
else
|
|
285
|
+
false
|
|
286
|
+
end
|
|
287
|
+
when :Object
|
|
288
|
+
# generic object (usually a Hash), return directly
|
|
289
|
+
value
|
|
290
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
291
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
292
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
293
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
294
|
+
k_type = Regexp.last_match[:k_type]
|
|
295
|
+
v_type = Regexp.last_match[:v_type]
|
|
296
|
+
{}.tap do |hash|
|
|
297
|
+
value.each do |k, v|
|
|
298
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
else # model
|
|
302
|
+
PulpcoreClient.const_get(type).build_from_hash(value)
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
# Returns the string representation of the object
|
|
307
|
+
# @return [String] String presentation of the object
|
|
308
|
+
def to_s
|
|
309
|
+
to_hash.to_s
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
313
|
+
# @return [Hash] Returns the object in the form of hash
|
|
314
|
+
def to_body
|
|
315
|
+
to_hash
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
# Returns the object in the form of hash
|
|
319
|
+
# @return [Hash] Returns the object in the form of hash
|
|
320
|
+
def to_hash
|
|
321
|
+
hash = {}
|
|
322
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
323
|
+
value = self.send(attr)
|
|
324
|
+
if value.nil?
|
|
325
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
326
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
hash[param] = _to_hash(value)
|
|
330
|
+
end
|
|
331
|
+
hash
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
# Outputs non-array value in the form of hash
|
|
335
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
336
|
+
# @param [Object] value Any valid value
|
|
337
|
+
# @return [Hash] Returns the value in the form of hash
|
|
338
|
+
def _to_hash(value)
|
|
339
|
+
if value.is_a?(Array)
|
|
340
|
+
value.compact.map { |v| _to_hash(v) }
|
|
341
|
+
elsif value.is_a?(Hash)
|
|
342
|
+
{}.tap do |hash|
|
|
343
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
344
|
+
end
|
|
345
|
+
elsif value.respond_to? :to_hash
|
|
346
|
+
value.to_hash
|
|
347
|
+
else
|
|
348
|
+
value
|
|
349
|
+
end
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
end
|