pulpcore_client 3.20.0 → 3.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -84
  3. data/docs/ContentApi.md +1 -115
  4. data/docs/ContentguardsApi.md +1 -280
  5. data/docs/DistributionsApi.md +3 -281
  6. data/docs/PublicationsApi.md +0 -113
  7. data/docs/PulpImport.md +3 -1
  8. data/docs/RemotesApi.md +0 -280
  9. data/docs/RepositoriesApi.md +3 -281
  10. data/docs/UploadsApi.md +228 -0
  11. data/lib/pulpcore_client/api/content_api.rb +2 -134
  12. data/lib/pulpcore_client/api/contentguards_api.rb +2 -334
  13. data/lib/pulpcore_client/api/distributions_api.rb +5 -336
  14. data/lib/pulpcore_client/api/publications_api.rb +0 -128
  15. data/lib/pulpcore_client/api/remotes_api.rb +0 -334
  16. data/lib/pulpcore_client/api/repositories_api.rb +5 -336
  17. data/lib/pulpcore_client/api/repository_versions_api.rb +1 -1
  18. data/lib/pulpcore_client/api/uploads_api.rb +268 -0
  19. data/lib/pulpcore_client/api_client.rb +1 -1
  20. data/lib/pulpcore_client/models/pulp_import.rb +16 -4
  21. data/lib/pulpcore_client/version.rb +1 -1
  22. data/lib/pulpcore_client.rb +0 -31
  23. data/pulpcore_client.gemspec +3 -3
  24. data/spec/api/content_api_spec.rb +1 -27
  25. data/spec/api/contentguards_api_spec.rb +1 -65
  26. data/spec/api/distributions_api_spec.rb +2 -65
  27. data/spec/api/publications_api_spec.rb +0 -26
  28. data/spec/api/remotes_api_spec.rb +0 -64
  29. data/spec/api/repositories_api_spec.rb +2 -65
  30. data/spec/api/uploads_api_spec.rb +50 -0
  31. data/spec/models/pulp_import_spec.rb +6 -0
  32. metadata +136 -261
  33. data/docs/AcsApi.md +0 -417
  34. data/docs/AlternateContentSource.md +0 -23
  35. data/docs/AlternateContentSourceResponse.md +0 -27
  36. data/docs/ContentGuard.md +0 -19
  37. data/docs/Distribution.md +0 -25
  38. data/docs/Export.md +0 -17
  39. data/docs/ExportResponse.md +0 -25
  40. data/docs/Exporter.md +0 -17
  41. data/docs/ExporterResponse.md +0 -21
  42. data/docs/ExportersApi.md +0 -362
  43. data/docs/ExportersExportsApi.md +0 -241
  44. data/docs/Import.md +0 -19
  45. data/docs/Importer.md +0 -17
  46. data/docs/ImporterResponse.md +0 -21
  47. data/docs/ImportersApi.md +0 -361
  48. data/docs/ImportersImportsApi.md +0 -241
  49. data/docs/MultipleArtifactContent.md +0 -17
  50. data/docs/PaginatedAlternateContentSourceResponseList.md +0 -23
  51. data/docs/PaginatedExportResponseList.md +0 -23
  52. data/docs/PaginatedExporterResponseList.md +0 -23
  53. data/docs/PaginatedImporterResponseList.md +0 -23
  54. data/docs/PatchedAlternateContentSource.md +0 -23
  55. data/docs/PatchedContentGuard.md +0 -19
  56. data/docs/PatchedDistribution.md +0 -25
  57. data/docs/PatchedExporter.md +0 -17
  58. data/docs/PatchedImporter.md +0 -17
  59. data/docs/PatchedRemote.md +0 -57
  60. data/docs/PatchedRepository.md +0 -25
  61. data/docs/Remote.md +0 -57
  62. data/docs/RepositoriesVersionsApi.md +0 -271
  63. data/docs/Repository.md +0 -25
  64. data/git_push.sh +0 -58
  65. data/lib/pulpcore_client/api/acs_api.rb +0 -514
  66. data/lib/pulpcore_client/api/exporters_api.rb +0 -446
  67. data/lib/pulpcore_client/api/exporters_exports_api.rb +0 -294
  68. data/lib/pulpcore_client/api/importers_api.rb +0 -444
  69. data/lib/pulpcore_client/api/importers_imports_api.rb +0 -294
  70. data/lib/pulpcore_client/api/repositories_versions_api.rb +0 -343
  71. data/lib/pulpcore_client/models/alternate_content_source.rb +0 -270
  72. data/lib/pulpcore_client/models/alternate_content_source_response.rb +0 -270
  73. data/lib/pulpcore_client/models/content_guard.rb +0 -258
  74. data/lib/pulpcore_client/models/distribution.rb +0 -297
  75. data/lib/pulpcore_client/models/export.rb +0 -209
  76. data/lib/pulpcore_client/models/export_response.rb +0 -250
  77. data/lib/pulpcore_client/models/exporter.rb +0 -232
  78. data/lib/pulpcore_client/models/exporter_response.rb +0 -232
  79. data/lib/pulpcore_client/models/import.rb +0 -228
  80. data/lib/pulpcore_client/models/importer.rb +0 -232
  81. data/lib/pulpcore_client/models/importer_response.rb +0 -232
  82. data/lib/pulpcore_client/models/multiple_artifact_content.rb +0 -213
  83. data/lib/pulpcore_client/models/paginated_alternate_content_source_response_list.rb +0 -237
  84. data/lib/pulpcore_client/models/paginated_export_response_list.rb +0 -237
  85. data/lib/pulpcore_client/models/paginated_exporter_response_list.rb +0 -237
  86. data/lib/pulpcore_client/models/paginated_importer_response_list.rb +0 -237
  87. data/lib/pulpcore_client/models/patched_alternate_content_source.rb +0 -256
  88. data/lib/pulpcore_client/models/patched_content_guard.rb +0 -249
  89. data/lib/pulpcore_client/models/patched_distribution.rb +0 -279
  90. data/lib/pulpcore_client/models/patched_exporter.rb +0 -223
  91. data/lib/pulpcore_client/models/patched_importer.rb +0 -223
  92. data/lib/pulpcore_client/models/patched_remote.rb +0 -649
  93. data/lib/pulpcore_client/models/patched_repository.rb +0 -295
  94. data/lib/pulpcore_client/models/remote.rb +0 -667
  95. data/lib/pulpcore_client/models/repository.rb +0 -304
  96. data/spec/api/acs_api_spec.rb +0 -132
  97. data/spec/api/exporters_api_spec.rb +0 -120
  98. data/spec/api/exporters_exports_api_spec.rb +0 -90
  99. data/spec/api/importers_api_spec.rb +0 -120
  100. data/spec/api/importers_imports_api_spec.rb +0 -90
  101. data/spec/api/repositories_versions_api_spec.rb +0 -104
  102. data/spec/models/alternate_content_source_response_spec.rb +0 -71
  103. data/spec/models/alternate_content_source_spec.rb +0 -59
  104. data/spec/models/content_guard_spec.rb +0 -47
  105. data/spec/models/distribution_spec.rb +0 -65
  106. data/spec/models/export_response_spec.rb +0 -65
  107. data/spec/models/export_spec.rb +0 -41
  108. data/spec/models/exporter_response_spec.rb +0 -53
  109. data/spec/models/exporter_spec.rb +0 -41
  110. data/spec/models/import_spec.rb +0 -47
  111. data/spec/models/importer_response_spec.rb +0 -53
  112. data/spec/models/importer_spec.rb +0 -41
  113. data/spec/models/multiple_artifact_content_spec.rb +0 -41
  114. data/spec/models/paginated_alternate_content_source_response_list_spec.rb +0 -59
  115. data/spec/models/paginated_export_response_list_spec.rb +0 -59
  116. data/spec/models/paginated_exporter_response_list_spec.rb +0 -59
  117. data/spec/models/paginated_importer_response_list_spec.rb +0 -59
  118. data/spec/models/patched_alternate_content_source_spec.rb +0 -59
  119. data/spec/models/patched_content_guard_spec.rb +0 -47
  120. data/spec/models/patched_distribution_spec.rb +0 -65
  121. data/spec/models/patched_exporter_spec.rb +0 -41
  122. data/spec/models/patched_importer_spec.rb +0 -41
  123. data/spec/models/patched_remote_spec.rb +0 -161
  124. data/spec/models/patched_repository_spec.rb +0 -65
  125. data/spec/models/remote_spec.rb +0 -161
  126. data/spec/models/repository_spec.rb +0 -65
@@ -1,279 +0,0 @@
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
- # The Serializer for the Distribution model. The serializer deliberately omits the `publication` and `repository_version` field due to plugins typically requiring one or the other but not both. To include the ``publication`` field, it is recommended plugins define the field:: publication = DetailRelatedField( required=False, help_text=_(\"Publication to be served\"), view_name_pattern=r\"publications(-.*/.*)?-detail\", queryset=models.Publication.objects.exclude(complete=False), allow_null=True, ) To include the ``repository_version`` field, it is recommended plugins define the field:: repository_version = RepositoryVersionRelatedField( required=False, help_text=_(\"RepositoryVersion to be served\"), allow_null=True ) Additionally, the serializer omits the ``remote`` field, which is used for pull-through caching feature and only by plugins which use publications. Plugins implementing a pull-through caching should define the field in their derived serializer class like this:: remote = DetailRelatedField( required=False, help_text=_('Remote that can be used to fetch content when using pull-through caching.'), queryset=models.Remote.objects.all(), allow_null=True )
17
- class PatchedDistribution
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
- # An optional content-guard.
22
- attr_accessor :content_guard
23
-
24
- attr_accessor :pulp_labels
25
-
26
- # A unique name. Ex, `rawhide` and `stable`.
27
- attr_accessor :name
28
-
29
- # The latest RepositoryVersion for this Repository will be served.
30
- attr_accessor :repository
31
-
32
- # Attribute mapping from ruby-style variable name to JSON key.
33
- def self.attribute_map
34
- {
35
- :'base_path' => :'base_path',
36
- :'content_guard' => :'content_guard',
37
- :'pulp_labels' => :'pulp_labels',
38
- :'name' => :'name',
39
- :'repository' => :'repository'
40
- }
41
- end
42
-
43
- # Attribute type mapping.
44
- def self.openapi_types
45
- {
46
- :'base_path' => :'String',
47
- :'content_guard' => :'String',
48
- :'pulp_labels' => :'Object',
49
- :'name' => :'String',
50
- :'repository' => :'String'
51
- }
52
- end
53
-
54
- # List of attributes with nullable: true
55
- def self.openapi_nullable
56
- Set.new([
57
- :'content_guard',
58
- :'repository'
59
- ])
60
- end
61
-
62
- # Initializes the object
63
- # @param [Hash] attributes Model attributes in the form of hash
64
- def initialize(attributes = {})
65
- if (!attributes.is_a?(Hash))
66
- fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::PatchedDistribution` initialize method"
67
- end
68
-
69
- # check to see if the attribute exists and convert string to symbol for hash key
70
- attributes = attributes.each_with_object({}) { |(k, v), h|
71
- if (!self.class.attribute_map.key?(k.to_sym))
72
- fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::PatchedDistribution`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
- end
74
- h[k.to_sym] = v
75
- }
76
-
77
- if attributes.key?(:'base_path')
78
- self.base_path = attributes[:'base_path']
79
- end
80
-
81
- if attributes.key?(:'content_guard')
82
- self.content_guard = attributes[:'content_guard']
83
- end
84
-
85
- if attributes.key?(:'pulp_labels')
86
- self.pulp_labels = attributes[:'pulp_labels']
87
- end
88
-
89
- if attributes.key?(:'name')
90
- self.name = attributes[:'name']
91
- end
92
-
93
- if attributes.key?(:'repository')
94
- self.repository = attributes[:'repository']
95
- end
96
- end
97
-
98
- # Show invalid properties with the reasons. Usually used together with valid?
99
- # @return Array for valid properties with the reasons
100
- def list_invalid_properties
101
- invalid_properties = Array.new
102
- if !@base_path.nil? && @base_path.to_s.length < 1
103
- invalid_properties.push('invalid value for "base_path", the character length must be great than or equal to 1.')
104
- end
105
-
106
- if !@name.nil? && @name.to_s.length < 1
107
- invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
108
- end
109
-
110
- invalid_properties
111
- end
112
-
113
- # Check to see if the all the properties in the model are valid
114
- # @return true if the model is valid
115
- def valid?
116
- return false if !@base_path.nil? && @base_path.to_s.length < 1
117
- return false if !@name.nil? && @name.to_s.length < 1
118
- true
119
- end
120
-
121
- # Custom attribute writer method with validation
122
- # @param [Object] base_path Value to be assigned
123
- def base_path=(base_path)
124
- if !base_path.nil? && base_path.to_s.length < 1
125
- fail ArgumentError, 'invalid value for "base_path", the character length must be great than or equal to 1.'
126
- end
127
-
128
- @base_path = base_path
129
- end
130
-
131
- # Custom attribute writer method with validation
132
- # @param [Object] name Value to be assigned
133
- def name=(name)
134
- if !name.nil? && name.to_s.length < 1
135
- fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
136
- end
137
-
138
- @name = name
139
- end
140
-
141
- # Checks equality by comparing each attribute.
142
- # @param [Object] Object to be compared
143
- def ==(o)
144
- return true if self.equal?(o)
145
- self.class == o.class &&
146
- base_path == o.base_path &&
147
- content_guard == o.content_guard &&
148
- pulp_labels == o.pulp_labels &&
149
- name == o.name &&
150
- repository == o.repository
151
- end
152
-
153
- # @see the `==` method
154
- # @param [Object] Object to be compared
155
- def eql?(o)
156
- self == o
157
- end
158
-
159
- # Calculates hash code according to all attributes.
160
- # @return [Integer] Hash code
161
- def hash
162
- [base_path, content_guard, pulp_labels, name, repository].hash
163
- end
164
-
165
- # Builds the object from hash
166
- # @param [Hash] attributes Model attributes in the form of hash
167
- # @return [Object] Returns the model itself
168
- def self.build_from_hash(attributes)
169
- new.build_from_hash(attributes)
170
- end
171
-
172
- # Builds the object from hash
173
- # @param [Hash] attributes Model attributes in the form of hash
174
- # @return [Object] Returns the model itself
175
- def build_from_hash(attributes)
176
- return nil unless attributes.is_a?(Hash)
177
- self.class.openapi_types.each_pair do |key, type|
178
- if type =~ /\AArray<(.*)>/i
179
- # check to ensure the input is an array given that the attribute
180
- # is documented as an array but the input is not
181
- if attributes[self.class.attribute_map[key]].is_a?(Array)
182
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
183
- end
184
- elsif !attributes[self.class.attribute_map[key]].nil?
185
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
186
- end # or else data not found in attributes(hash), not an issue as the data can be optional
187
- end
188
-
189
- self
190
- end
191
-
192
- # Deserializes the data based on type
193
- # @param string type Data type
194
- # @param string value Value to be deserialized
195
- # @return [Object] Deserialized data
196
- def _deserialize(type, value)
197
- case type.to_sym
198
- when :DateTime
199
- DateTime.parse(value)
200
- when :Date
201
- Date.parse(value)
202
- when :String
203
- value.to_s
204
- when :Integer
205
- value.to_i
206
- when :Float
207
- value.to_f
208
- when :Boolean
209
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
210
- true
211
- else
212
- false
213
- end
214
- when :Object
215
- # generic object (usually a Hash), return directly
216
- value
217
- when /\AArray<(?<inner_type>.+)>\z/
218
- inner_type = Regexp.last_match[:inner_type]
219
- value.map { |v| _deserialize(inner_type, v) }
220
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
221
- k_type = Regexp.last_match[:k_type]
222
- v_type = Regexp.last_match[:v_type]
223
- {}.tap do |hash|
224
- value.each do |k, v|
225
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
226
- end
227
- end
228
- else # model
229
- PulpcoreClient.const_get(type).build_from_hash(value)
230
- end
231
- end
232
-
233
- # Returns the string representation of the object
234
- # @return [String] String presentation of the object
235
- def to_s
236
- to_hash.to_s
237
- end
238
-
239
- # to_body is an alias to to_hash (backward compatibility)
240
- # @return [Hash] Returns the object in the form of hash
241
- def to_body
242
- to_hash
243
- end
244
-
245
- # Returns the object in the form of hash
246
- # @return [Hash] Returns the object in the form of hash
247
- def to_hash
248
- hash = {}
249
- self.class.attribute_map.each_pair do |attr, param|
250
- value = self.send(attr)
251
- if value.nil?
252
- is_nullable = self.class.openapi_nullable.include?(attr)
253
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
254
- end
255
-
256
- hash[param] = _to_hash(value)
257
- end
258
- hash
259
- end
260
-
261
- # Outputs non-array value in the form of hash
262
- # For object, use to_hash. Otherwise, just return the value
263
- # @param [Object] value Any valid value
264
- # @return [Hash] Returns the value in the form of hash
265
- def _to_hash(value)
266
- if value.is_a?(Array)
267
- value.compact.map { |v| _to_hash(v) }
268
- elsif value.is_a?(Hash)
269
- {}.tap do |hash|
270
- value.each { |k, v| hash[k] = _to_hash(v) }
271
- end
272
- elsif value.respond_to? :to_hash
273
- value.to_hash
274
- else
275
- value
276
- end
277
- end
278
- end
279
- end
@@ -1,223 +0,0 @@
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
- # Base serializer for Exporters.
17
- class PatchedExporter
18
- # Unique name of the file system exporter.
19
- attr_accessor :name
20
-
21
- # Attribute mapping from ruby-style variable name to JSON key.
22
- def self.attribute_map
23
- {
24
- :'name' => :'name'
25
- }
26
- end
27
-
28
- # Attribute type mapping.
29
- def self.openapi_types
30
- {
31
- :'name' => :'String'
32
- }
33
- end
34
-
35
- # List of attributes with nullable: true
36
- def self.openapi_nullable
37
- Set.new([
38
- ])
39
- end
40
-
41
- # Initializes the object
42
- # @param [Hash] attributes Model attributes in the form of hash
43
- def initialize(attributes = {})
44
- if (!attributes.is_a?(Hash))
45
- fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::PatchedExporter` initialize method"
46
- end
47
-
48
- # check to see if the attribute exists and convert string to symbol for hash key
49
- attributes = attributes.each_with_object({}) { |(k, v), h|
50
- if (!self.class.attribute_map.key?(k.to_sym))
51
- fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::PatchedExporter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
52
- end
53
- h[k.to_sym] = v
54
- }
55
-
56
- if attributes.key?(:'name')
57
- self.name = attributes[:'name']
58
- end
59
- end
60
-
61
- # Show invalid properties with the reasons. Usually used together with valid?
62
- # @return Array for valid properties with the reasons
63
- def list_invalid_properties
64
- invalid_properties = Array.new
65
- if !@name.nil? && @name.to_s.length < 1
66
- invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
67
- end
68
-
69
- invalid_properties
70
- end
71
-
72
- # Check to see if the all the properties in the model are valid
73
- # @return true if the model is valid
74
- def valid?
75
- return false if !@name.nil? && @name.to_s.length < 1
76
- true
77
- end
78
-
79
- # Custom attribute writer method with validation
80
- # @param [Object] name Value to be assigned
81
- def name=(name)
82
- if !name.nil? && name.to_s.length < 1
83
- fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
84
- end
85
-
86
- @name = name
87
- end
88
-
89
- # Checks equality by comparing each attribute.
90
- # @param [Object] Object to be compared
91
- def ==(o)
92
- return true if self.equal?(o)
93
- self.class == o.class &&
94
- name == o.name
95
- end
96
-
97
- # @see the `==` method
98
- # @param [Object] Object to be compared
99
- def eql?(o)
100
- self == o
101
- end
102
-
103
- # Calculates hash code according to all attributes.
104
- # @return [Integer] Hash code
105
- def hash
106
- [name].hash
107
- end
108
-
109
- # Builds the object from hash
110
- # @param [Hash] attributes Model attributes in the form of hash
111
- # @return [Object] Returns the model itself
112
- def self.build_from_hash(attributes)
113
- new.build_from_hash(attributes)
114
- end
115
-
116
- # Builds the object from hash
117
- # @param [Hash] attributes Model attributes in the form of hash
118
- # @return [Object] Returns the model itself
119
- def build_from_hash(attributes)
120
- return nil unless attributes.is_a?(Hash)
121
- self.class.openapi_types.each_pair do |key, type|
122
- if type =~ /\AArray<(.*)>/i
123
- # check to ensure the input is an array given that the attribute
124
- # is documented as an array but the input is not
125
- if attributes[self.class.attribute_map[key]].is_a?(Array)
126
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
- end
128
- elsif !attributes[self.class.attribute_map[key]].nil?
129
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
- end # or else data not found in attributes(hash), not an issue as the data can be optional
131
- end
132
-
133
- self
134
- end
135
-
136
- # Deserializes the data based on type
137
- # @param string type Data type
138
- # @param string value Value to be deserialized
139
- # @return [Object] Deserialized data
140
- def _deserialize(type, value)
141
- case type.to_sym
142
- when :DateTime
143
- DateTime.parse(value)
144
- when :Date
145
- Date.parse(value)
146
- when :String
147
- value.to_s
148
- when :Integer
149
- value.to_i
150
- when :Float
151
- value.to_f
152
- when :Boolean
153
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
- true
155
- else
156
- false
157
- end
158
- when :Object
159
- # generic object (usually a Hash), return directly
160
- value
161
- when /\AArray<(?<inner_type>.+)>\z/
162
- inner_type = Regexp.last_match[:inner_type]
163
- value.map { |v| _deserialize(inner_type, v) }
164
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
- k_type = Regexp.last_match[:k_type]
166
- v_type = Regexp.last_match[:v_type]
167
- {}.tap do |hash|
168
- value.each do |k, v|
169
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
- end
171
- end
172
- else # model
173
- PulpcoreClient.const_get(type).build_from_hash(value)
174
- end
175
- end
176
-
177
- # Returns the string representation of the object
178
- # @return [String] String presentation of the object
179
- def to_s
180
- to_hash.to_s
181
- end
182
-
183
- # to_body is an alias to to_hash (backward compatibility)
184
- # @return [Hash] Returns the object in the form of hash
185
- def to_body
186
- to_hash
187
- end
188
-
189
- # Returns the object in the form of hash
190
- # @return [Hash] Returns the object in the form of hash
191
- def to_hash
192
- hash = {}
193
- self.class.attribute_map.each_pair do |attr, param|
194
- value = self.send(attr)
195
- if value.nil?
196
- is_nullable = self.class.openapi_nullable.include?(attr)
197
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
198
- end
199
-
200
- hash[param] = _to_hash(value)
201
- end
202
- hash
203
- end
204
-
205
- # Outputs non-array value in the form of hash
206
- # For object, use to_hash. Otherwise, just return the value
207
- # @param [Object] value Any valid value
208
- # @return [Hash] Returns the value in the form of hash
209
- def _to_hash(value)
210
- if value.is_a?(Array)
211
- value.compact.map { |v| _to_hash(v) }
212
- elsif value.is_a?(Hash)
213
- {}.tap do |hash|
214
- value.each { |k, v| hash[k] = _to_hash(v) }
215
- end
216
- elsif value.respond_to? :to_hash
217
- value.to_hash
218
- else
219
- value
220
- end
221
- end
222
- end
223
- end