pulp_file_client 1.14.3 → 1.14.5
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 +36 -25
- data/docs/AcsFileApi.md +23 -9
- data/docs/ContentFilesApi.md +5 -3
- data/docs/DistributionsFileApi.md +138 -12
- data/docs/FileFileContent.md +3 -3
- data/docs/FileFileDistribution.md +2 -0
- data/docs/FileFileDistributionResponse.md +2 -0
- data/docs/PatchedfileFileDistribution.md +2 -0
- data/docs/PublicationsFileApi.md +15 -9
- data/docs/RemotesFileApi.md +135 -9
- data/docs/RepositoriesFileApi.md +136 -10
- data/docs/RepositoriesFileVersionsApi.md +3 -1
- data/docs/SetLabel.md +19 -0
- data/docs/SetLabelResponse.md +19 -0
- data/docs/UnsetLabel.md +17 -0
- data/docs/UnsetLabelResponse.md +19 -0
- data/lib/pulp_file_client/api/acs_file_api.rb +23 -0
- data/lib/pulp_file_client/api/content_files_api.rb +6 -3
- data/lib/pulp_file_client/api/distributions_file_api.rb +166 -3
- data/lib/pulp_file_client/api/publications_file_api.rb +11 -0
- data/lib/pulp_file_client/api/remotes_file_api.rb +163 -0
- data/lib/pulp_file_client/api/repositories_file_api.rb +163 -0
- data/lib/pulp_file_client/api/repositories_file_versions_api.rb +3 -0
- data/lib/pulp_file_client/configuration.rb +2 -2
- data/lib/pulp_file_client/models/file_file_content.rb +11 -11
- data/lib/pulp_file_client/models/file_file_distribution.rb +13 -1
- data/lib/pulp_file_client/models/file_file_distribution_response.rb +13 -1
- data/lib/pulp_file_client/models/patchedfile_file_distribution.rb +13 -1
- data/lib/pulp_file_client/models/set_label.rb +252 -0
- data/lib/pulp_file_client/models/set_label_response.rb +243 -0
- data/lib/pulp_file_client/models/unset_label.rb +242 -0
- data/lib/pulp_file_client/models/unset_label_response.rb +242 -0
- data/lib/pulp_file_client/version.rb +1 -1
- data/lib/pulp_file_client.rb +4 -0
- data/spec/api/acs_file_api_spec.rb +9 -0
- data/spec/api/content_files_api_spec.rb +2 -1
- data/spec/api/distributions_file_api_spec.rb +36 -1
- data/spec/api/publications_file_api_spec.rb +5 -0
- data/spec/api/remotes_file_api_spec.rb +35 -0
- data/spec/api/repositories_file_api_spec.rb +35 -0
- data/spec/api/repositories_file_versions_api_spec.rb +1 -0
- data/spec/configuration_spec.rb +3 -3
- data/spec/models/file_file_content_spec.rb +4 -4
- data/spec/models/file_file_distribution_response_spec.rb +6 -0
- data/spec/models/file_file_distribution_spec.rb +6 -0
- data/spec/models/patchedfile_file_distribution_spec.rb +6 -0
- data/spec/models/set_label_response_spec.rb +47 -0
- data/spec/models/set_label_spec.rb +47 -0
- data/spec/models/unset_label_response_spec.rb +47 -0
- data/spec/models/unset_label_spec.rb +41 -0
- metadata +50 -34
@@ -15,6 +15,9 @@ require 'date'
|
|
15
15
|
module PulpFileClient
|
16
16
|
# Serializer for File Content.
|
17
17
|
class FileFileContent
|
18
|
+
# A URI of a repository the new content unit should be associated with.
|
19
|
+
attr_accessor :repository
|
20
|
+
|
18
21
|
# Artifact file representing the physical content
|
19
22
|
attr_accessor :artifact
|
20
23
|
|
@@ -24,19 +27,16 @@ module PulpFileClient
|
|
24
27
|
# An uploaded file that may be turned into the artifact of the content unit.
|
25
28
|
attr_accessor :file
|
26
29
|
|
27
|
-
# A URI of a repository the new content unit should be associated with.
|
28
|
-
attr_accessor :repository
|
29
|
-
|
30
30
|
# An uncommitted upload that may be turned into the artifact of the content unit.
|
31
31
|
attr_accessor :upload
|
32
32
|
|
33
33
|
# Attribute mapping from ruby-style variable name to JSON key.
|
34
34
|
def self.attribute_map
|
35
35
|
{
|
36
|
+
:'repository' => :'repository',
|
36
37
|
:'artifact' => :'artifact',
|
37
38
|
:'relative_path' => :'relative_path',
|
38
39
|
:'file' => :'file',
|
39
|
-
:'repository' => :'repository',
|
40
40
|
:'upload' => :'upload'
|
41
41
|
}
|
42
42
|
end
|
@@ -44,10 +44,10 @@ module PulpFileClient
|
|
44
44
|
# Attribute type mapping.
|
45
45
|
def self.openapi_types
|
46
46
|
{
|
47
|
+
:'repository' => :'String',
|
47
48
|
:'artifact' => :'String',
|
48
49
|
:'relative_path' => :'String',
|
49
50
|
:'file' => :'File',
|
50
|
-
:'repository' => :'String',
|
51
51
|
:'upload' => :'String'
|
52
52
|
}
|
53
53
|
end
|
@@ -73,6 +73,10 @@ module PulpFileClient
|
|
73
73
|
h[k.to_sym] = v
|
74
74
|
}
|
75
75
|
|
76
|
+
if attributes.key?(:'repository')
|
77
|
+
self.repository = attributes[:'repository']
|
78
|
+
end
|
79
|
+
|
76
80
|
if attributes.key?(:'artifact')
|
77
81
|
self.artifact = attributes[:'artifact']
|
78
82
|
end
|
@@ -85,10 +89,6 @@ module PulpFileClient
|
|
85
89
|
self.file = attributes[:'file']
|
86
90
|
end
|
87
91
|
|
88
|
-
if attributes.key?(:'repository')
|
89
|
-
self.repository = attributes[:'repository']
|
90
|
-
end
|
91
|
-
|
92
92
|
if attributes.key?(:'upload')
|
93
93
|
self.upload = attributes[:'upload']
|
94
94
|
end
|
@@ -136,10 +136,10 @@ module PulpFileClient
|
|
136
136
|
def ==(o)
|
137
137
|
return true if self.equal?(o)
|
138
138
|
self.class == o.class &&
|
139
|
+
repository == o.repository &&
|
139
140
|
artifact == o.artifact &&
|
140
141
|
relative_path == o.relative_path &&
|
141
142
|
file == o.file &&
|
142
|
-
repository == o.repository &&
|
143
143
|
upload == o.upload
|
144
144
|
end
|
145
145
|
|
@@ -152,7 +152,7 @@ module PulpFileClient
|
|
152
152
|
# Calculates hash code according to all attributes.
|
153
153
|
# @return [Integer] Hash code
|
154
154
|
def hash
|
155
|
-
[artifact, relative_path, file,
|
155
|
+
[repository, artifact, relative_path, file, upload].hash
|
156
156
|
end
|
157
157
|
|
158
158
|
# Builds the object from hash
|
@@ -21,6 +21,9 @@ module PulpFileClient
|
|
21
21
|
# An optional content-guard.
|
22
22
|
attr_accessor :content_guard
|
23
23
|
|
24
|
+
# Whether this distribution should be shown in the content app.
|
25
|
+
attr_accessor :hidden
|
26
|
+
|
24
27
|
attr_accessor :pulp_labels
|
25
28
|
|
26
29
|
# A unique name. Ex, `rawhide` and `stable`.
|
@@ -37,6 +40,7 @@ module PulpFileClient
|
|
37
40
|
{
|
38
41
|
:'base_path' => :'base_path',
|
39
42
|
:'content_guard' => :'content_guard',
|
43
|
+
:'hidden' => :'hidden',
|
40
44
|
:'pulp_labels' => :'pulp_labels',
|
41
45
|
:'name' => :'name',
|
42
46
|
:'repository' => :'repository',
|
@@ -49,6 +53,7 @@ module PulpFileClient
|
|
49
53
|
{
|
50
54
|
:'base_path' => :'String',
|
51
55
|
:'content_guard' => :'String',
|
56
|
+
:'hidden' => :'Boolean',
|
52
57
|
:'pulp_labels' => :'Hash<String, String>',
|
53
58
|
:'name' => :'String',
|
54
59
|
:'repository' => :'String',
|
@@ -88,6 +93,12 @@ module PulpFileClient
|
|
88
93
|
self.content_guard = attributes[:'content_guard']
|
89
94
|
end
|
90
95
|
|
96
|
+
if attributes.key?(:'hidden')
|
97
|
+
self.hidden = attributes[:'hidden']
|
98
|
+
else
|
99
|
+
self.hidden = false
|
100
|
+
end
|
101
|
+
|
91
102
|
if attributes.key?(:'pulp_labels')
|
92
103
|
if (value = attributes[:'pulp_labels']).is_a?(Hash)
|
93
104
|
self.pulp_labels = value
|
@@ -175,6 +186,7 @@ module PulpFileClient
|
|
175
186
|
self.class == o.class &&
|
176
187
|
base_path == o.base_path &&
|
177
188
|
content_guard == o.content_guard &&
|
189
|
+
hidden == o.hidden &&
|
178
190
|
pulp_labels == o.pulp_labels &&
|
179
191
|
name == o.name &&
|
180
192
|
repository == o.repository &&
|
@@ -190,7 +202,7 @@ module PulpFileClient
|
|
190
202
|
# Calculates hash code according to all attributes.
|
191
203
|
# @return [Integer] Hash code
|
192
204
|
def hash
|
193
|
-
[base_path, content_guard, pulp_labels, name, repository, publication].hash
|
205
|
+
[base_path, content_guard, hidden, pulp_labels, name, repository, publication].hash
|
194
206
|
end
|
195
207
|
|
196
208
|
# Builds the object from hash
|
@@ -29,6 +29,9 @@ module PulpFileClient
|
|
29
29
|
# An optional content-guard.
|
30
30
|
attr_accessor :content_guard
|
31
31
|
|
32
|
+
# Whether this distribution should be shown in the content app.
|
33
|
+
attr_accessor :hidden
|
34
|
+
|
32
35
|
attr_accessor :pulp_labels
|
33
36
|
|
34
37
|
# A unique name. Ex, `rawhide` and `stable`.
|
@@ -48,6 +51,7 @@ module PulpFileClient
|
|
48
51
|
:'base_path' => :'base_path',
|
49
52
|
:'base_url' => :'base_url',
|
50
53
|
:'content_guard' => :'content_guard',
|
54
|
+
:'hidden' => :'hidden',
|
51
55
|
:'pulp_labels' => :'pulp_labels',
|
52
56
|
:'name' => :'name',
|
53
57
|
:'repository' => :'repository',
|
@@ -63,6 +67,7 @@ module PulpFileClient
|
|
63
67
|
:'base_path' => :'String',
|
64
68
|
:'base_url' => :'String',
|
65
69
|
:'content_guard' => :'String',
|
70
|
+
:'hidden' => :'Boolean',
|
66
71
|
:'pulp_labels' => :'Hash<String, String>',
|
67
72
|
:'name' => :'String',
|
68
73
|
:'repository' => :'String',
|
@@ -114,6 +119,12 @@ module PulpFileClient
|
|
114
119
|
self.content_guard = attributes[:'content_guard']
|
115
120
|
end
|
116
121
|
|
122
|
+
if attributes.key?(:'hidden')
|
123
|
+
self.hidden = attributes[:'hidden']
|
124
|
+
else
|
125
|
+
self.hidden = false
|
126
|
+
end
|
127
|
+
|
117
128
|
if attributes.key?(:'pulp_labels')
|
118
129
|
if (value = attributes[:'pulp_labels']).is_a?(Hash)
|
119
130
|
self.pulp_labels = value
|
@@ -166,6 +177,7 @@ module PulpFileClient
|
|
166
177
|
base_path == o.base_path &&
|
167
178
|
base_url == o.base_url &&
|
168
179
|
content_guard == o.content_guard &&
|
180
|
+
hidden == o.hidden &&
|
169
181
|
pulp_labels == o.pulp_labels &&
|
170
182
|
name == o.name &&
|
171
183
|
repository == o.repository &&
|
@@ -181,7 +193,7 @@ module PulpFileClient
|
|
181
193
|
# Calculates hash code according to all attributes.
|
182
194
|
# @return [Integer] Hash code
|
183
195
|
def hash
|
184
|
-
[pulp_href, pulp_created, base_path, base_url, content_guard, pulp_labels, name, repository, publication].hash
|
196
|
+
[pulp_href, pulp_created, base_path, base_url, content_guard, hidden, pulp_labels, name, repository, publication].hash
|
185
197
|
end
|
186
198
|
|
187
199
|
# Builds the object from hash
|
@@ -21,6 +21,9 @@ module PulpFileClient
|
|
21
21
|
# An optional content-guard.
|
22
22
|
attr_accessor :content_guard
|
23
23
|
|
24
|
+
# Whether this distribution should be shown in the content app.
|
25
|
+
attr_accessor :hidden
|
26
|
+
|
24
27
|
attr_accessor :pulp_labels
|
25
28
|
|
26
29
|
# A unique name. Ex, `rawhide` and `stable`.
|
@@ -37,6 +40,7 @@ module PulpFileClient
|
|
37
40
|
{
|
38
41
|
:'base_path' => :'base_path',
|
39
42
|
:'content_guard' => :'content_guard',
|
43
|
+
:'hidden' => :'hidden',
|
40
44
|
:'pulp_labels' => :'pulp_labels',
|
41
45
|
:'name' => :'name',
|
42
46
|
:'repository' => :'repository',
|
@@ -49,6 +53,7 @@ module PulpFileClient
|
|
49
53
|
{
|
50
54
|
:'base_path' => :'String',
|
51
55
|
:'content_guard' => :'String',
|
56
|
+
:'hidden' => :'Boolean',
|
52
57
|
:'pulp_labels' => :'Hash<String, String>',
|
53
58
|
:'name' => :'String',
|
54
59
|
:'repository' => :'String',
|
@@ -88,6 +93,12 @@ module PulpFileClient
|
|
88
93
|
self.content_guard = attributes[:'content_guard']
|
89
94
|
end
|
90
95
|
|
96
|
+
if attributes.key?(:'hidden')
|
97
|
+
self.hidden = attributes[:'hidden']
|
98
|
+
else
|
99
|
+
self.hidden = false
|
100
|
+
end
|
101
|
+
|
91
102
|
if attributes.key?(:'pulp_labels')
|
92
103
|
if (value = attributes[:'pulp_labels']).is_a?(Hash)
|
93
104
|
self.pulp_labels = value
|
@@ -157,6 +168,7 @@ module PulpFileClient
|
|
157
168
|
self.class == o.class &&
|
158
169
|
base_path == o.base_path &&
|
159
170
|
content_guard == o.content_guard &&
|
171
|
+
hidden == o.hidden &&
|
160
172
|
pulp_labels == o.pulp_labels &&
|
161
173
|
name == o.name &&
|
162
174
|
repository == o.repository &&
|
@@ -172,7 +184,7 @@ module PulpFileClient
|
|
172
184
|
# Calculates hash code according to all attributes.
|
173
185
|
# @return [Integer] Hash code
|
174
186
|
def hash
|
175
|
-
[base_path, content_guard, pulp_labels, name, repository, publication].hash
|
187
|
+
[base_path, content_guard, hidden, pulp_labels, name, repository, publication].hash
|
176
188
|
end
|
177
189
|
|
178
190
|
# Builds the object from hash
|
@@ -0,0 +1,252 @@
|
|
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 PulpFileClient
|
16
|
+
# Serializer for synchronously setting a label.
|
17
|
+
class SetLabel
|
18
|
+
attr_accessor :key
|
19
|
+
|
20
|
+
attr_accessor :value
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'key' => :'key',
|
26
|
+
:'value' => :'value'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Attribute type mapping.
|
31
|
+
def self.openapi_types
|
32
|
+
{
|
33
|
+
:'key' => :'String',
|
34
|
+
:'value' => :'String'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# List of attributes with nullable: true
|
39
|
+
def self.openapi_nullable
|
40
|
+
Set.new([
|
41
|
+
:'value'
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpFileClient::SetLabel` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpFileClient::SetLabel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'key')
|
61
|
+
self.key = attributes[:'key']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.key?(:'value')
|
65
|
+
self.value = attributes[:'value']
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
70
|
+
# @return Array for valid properties with the reasons
|
71
|
+
def list_invalid_properties
|
72
|
+
invalid_properties = Array.new
|
73
|
+
if @key.nil?
|
74
|
+
invalid_properties.push('invalid value for "key", key cannot be nil.')
|
75
|
+
end
|
76
|
+
|
77
|
+
if @key.to_s.length < 1
|
78
|
+
invalid_properties.push('invalid value for "key", the character length must be great than or equal to 1.')
|
79
|
+
end
|
80
|
+
|
81
|
+
pattern = Regexp.new(/^[-a-zA-Z0-9_]+$/)
|
82
|
+
if @key !~ pattern
|
83
|
+
invalid_properties.push("invalid value for \"key\", must conform to the pattern #{pattern}.")
|
84
|
+
end
|
85
|
+
|
86
|
+
invalid_properties
|
87
|
+
end
|
88
|
+
|
89
|
+
# Check to see if the all the properties in the model are valid
|
90
|
+
# @return true if the model is valid
|
91
|
+
def valid?
|
92
|
+
return false if @key.nil?
|
93
|
+
return false if @key.to_s.length < 1
|
94
|
+
return false if @key !~ Regexp.new(/^[-a-zA-Z0-9_]+$/)
|
95
|
+
true
|
96
|
+
end
|
97
|
+
|
98
|
+
# Custom attribute writer method with validation
|
99
|
+
# @param [Object] key Value to be assigned
|
100
|
+
def key=(key)
|
101
|
+
if key.nil?
|
102
|
+
fail ArgumentError, 'key cannot be nil'
|
103
|
+
end
|
104
|
+
|
105
|
+
if key.to_s.length < 1
|
106
|
+
fail ArgumentError, 'invalid value for "key", the character length must be great than or equal to 1.'
|
107
|
+
end
|
108
|
+
|
109
|
+
pattern = Regexp.new(/^[-a-zA-Z0-9_]+$/)
|
110
|
+
if key !~ pattern
|
111
|
+
fail ArgumentError, "invalid value for \"key\", must conform to the pattern #{pattern}."
|
112
|
+
end
|
113
|
+
|
114
|
+
@key = key
|
115
|
+
end
|
116
|
+
|
117
|
+
# Checks equality by comparing each attribute.
|
118
|
+
# @param [Object] Object to be compared
|
119
|
+
def ==(o)
|
120
|
+
return true if self.equal?(o)
|
121
|
+
self.class == o.class &&
|
122
|
+
key == o.key &&
|
123
|
+
value == o.value
|
124
|
+
end
|
125
|
+
|
126
|
+
# @see the `==` method
|
127
|
+
# @param [Object] Object to be compared
|
128
|
+
def eql?(o)
|
129
|
+
self == o
|
130
|
+
end
|
131
|
+
|
132
|
+
# Calculates hash code according to all attributes.
|
133
|
+
# @return [Integer] Hash code
|
134
|
+
def hash
|
135
|
+
[key, value].hash
|
136
|
+
end
|
137
|
+
|
138
|
+
# Builds the object from hash
|
139
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
140
|
+
# @return [Object] Returns the model itself
|
141
|
+
def self.build_from_hash(attributes)
|
142
|
+
new.build_from_hash(attributes)
|
143
|
+
end
|
144
|
+
|
145
|
+
# Builds the object from hash
|
146
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
147
|
+
# @return [Object] Returns the model itself
|
148
|
+
def build_from_hash(attributes)
|
149
|
+
return nil unless attributes.is_a?(Hash)
|
150
|
+
self.class.openapi_types.each_pair do |key, type|
|
151
|
+
if type =~ /\AArray<(.*)>/i
|
152
|
+
# check to ensure the input is an array given that the attribute
|
153
|
+
# is documented as an array but the input is not
|
154
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
155
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
156
|
+
end
|
157
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
158
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
159
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
160
|
+
end
|
161
|
+
|
162
|
+
self
|
163
|
+
end
|
164
|
+
|
165
|
+
# Deserializes the data based on type
|
166
|
+
# @param string type Data type
|
167
|
+
# @param string value Value to be deserialized
|
168
|
+
# @return [Object] Deserialized data
|
169
|
+
def _deserialize(type, value)
|
170
|
+
case type.to_sym
|
171
|
+
when :DateTime
|
172
|
+
DateTime.parse(value)
|
173
|
+
when :Date
|
174
|
+
Date.parse(value)
|
175
|
+
when :String
|
176
|
+
value.to_s
|
177
|
+
when :Integer
|
178
|
+
value.to_i
|
179
|
+
when :Float
|
180
|
+
value.to_f
|
181
|
+
when :Boolean
|
182
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
183
|
+
true
|
184
|
+
else
|
185
|
+
false
|
186
|
+
end
|
187
|
+
when :Object
|
188
|
+
# generic object (usually a Hash), return directly
|
189
|
+
value
|
190
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
191
|
+
inner_type = Regexp.last_match[:inner_type]
|
192
|
+
value.map { |v| _deserialize(inner_type, v) }
|
193
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
194
|
+
k_type = Regexp.last_match[:k_type]
|
195
|
+
v_type = Regexp.last_match[:v_type]
|
196
|
+
{}.tap do |hash|
|
197
|
+
value.each do |k, v|
|
198
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
else # model
|
202
|
+
PulpFileClient.const_get(type).build_from_hash(value)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
# Returns the string representation of the object
|
207
|
+
# @return [String] String presentation of the object
|
208
|
+
def to_s
|
209
|
+
to_hash.to_s
|
210
|
+
end
|
211
|
+
|
212
|
+
# to_body is an alias to to_hash (backward compatibility)
|
213
|
+
# @return [Hash] Returns the object in the form of hash
|
214
|
+
def to_body
|
215
|
+
to_hash
|
216
|
+
end
|
217
|
+
|
218
|
+
# Returns the object in the form of hash
|
219
|
+
# @return [Hash] Returns the object in the form of hash
|
220
|
+
def to_hash
|
221
|
+
hash = {}
|
222
|
+
self.class.attribute_map.each_pair do |attr, param|
|
223
|
+
value = self.send(attr)
|
224
|
+
if value.nil?
|
225
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
226
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
227
|
+
end
|
228
|
+
|
229
|
+
hash[param] = _to_hash(value)
|
230
|
+
end
|
231
|
+
hash
|
232
|
+
end
|
233
|
+
|
234
|
+
# Outputs non-array value in the form of hash
|
235
|
+
# For object, use to_hash. Otherwise, just return the value
|
236
|
+
# @param [Object] value Any valid value
|
237
|
+
# @return [Hash] Returns the value in the form of hash
|
238
|
+
def _to_hash(value)
|
239
|
+
if value.is_a?(Array)
|
240
|
+
value.compact.map { |v| _to_hash(v) }
|
241
|
+
elsif value.is_a?(Hash)
|
242
|
+
{}.tap do |hash|
|
243
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
244
|
+
end
|
245
|
+
elsif value.respond_to? :to_hash
|
246
|
+
value.to_hash
|
247
|
+
else
|
248
|
+
value
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|