pulpcore_client 3.22.20 → 3.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -4
  3. data/docs/ArtifactDistributionResponse.md +9 -9
  4. data/docs/DistributionsApi.md +4 -0
  5. data/docs/DistributionsArtifactsApi.md +4 -0
  6. data/docs/Domain.md +27 -0
  7. data/docs/DomainResponse.md +31 -0
  8. data/docs/DomainsApi.md +362 -0
  9. data/docs/ExportersFilesystemApi.md +3 -3
  10. data/docs/ExportersFilesystemExportsApi.md +3 -3
  11. data/docs/GroupRole.md +3 -1
  12. data/docs/GroupRoleResponse.md +3 -1
  13. data/docs/GroupsApi.md +6 -6
  14. data/docs/GroupsRolesApi.md +6 -4
  15. data/docs/PaginatedDomainResponseList.md +23 -0
  16. data/docs/PaginatedUpstreamPulpResponseList.md +23 -0
  17. data/docs/PatchedDomain.md +27 -0
  18. data/docs/PatchedUpstreamPulp.md +37 -0
  19. data/docs/RepositoriesApi.md +16 -0
  20. data/docs/RepositoryResponse.md +1 -1
  21. data/docs/RolesApi.md +6 -6
  22. data/docs/StatusResponse.md +3 -1
  23. data/docs/StorageClassEnum.md +16 -0
  24. data/docs/TaskSchedulesApi.md +2 -2
  25. data/docs/TasksApi.md +1 -1
  26. data/docs/UpstreamPulp.md +37 -0
  27. data/docs/UpstreamPulpResponse.md +39 -0
  28. data/docs/UpstreamPulpsApi.md +405 -0
  29. data/docs/UserRole.md +4 -2
  30. data/docs/UserRoleResponse.md +4 -2
  31. data/docs/UsersApi.md +6 -6
  32. data/docs/UsersRolesApi.md +6 -4
  33. data/docs/VersionResponse.md +3 -1
  34. data/lib/pulpcore_client/api/distributions_api.rb +6 -0
  35. data/lib/pulpcore_client/api/distributions_artifacts_api.rb +6 -0
  36. data/lib/pulpcore_client/api/domains_api.rb +446 -0
  37. data/lib/pulpcore_client/api/exporters_filesystem_api.rb +6 -6
  38. data/lib/pulpcore_client/api/exporters_filesystem_exports_api.rb +6 -6
  39. data/lib/pulpcore_client/api/groups_api.rb +12 -12
  40. data/lib/pulpcore_client/api/groups_roles_api.rb +11 -8
  41. data/lib/pulpcore_client/api/repositories_api.rb +24 -0
  42. data/lib/pulpcore_client/api/roles_api.rb +12 -12
  43. data/lib/pulpcore_client/api/task_schedules_api.rb +4 -4
  44. data/lib/pulpcore_client/api/tasks_api.rb +2 -2
  45. data/lib/pulpcore_client/api/upstream_pulps_api.rb +492 -0
  46. data/lib/pulpcore_client/api/users_api.rb +12 -12
  47. data/lib/pulpcore_client/api/users_roles_api.rb +11 -8
  48. data/lib/pulpcore_client/api/workers_api.rb +1 -1
  49. data/lib/pulpcore_client/models/artifact_distribution_response.rb +43 -43
  50. data/lib/pulpcore_client/models/domain.rb +323 -0
  51. data/lib/pulpcore_client/models/domain_response.rb +318 -0
  52. data/lib/pulpcore_client/models/group_role.rb +16 -5
  53. data/lib/pulpcore_client/models/group_role_response.rb +15 -4
  54. data/lib/pulpcore_client/models/nested_role.rb +19 -0
  55. data/lib/pulpcore_client/models/paginated_domain_response_list.rb +237 -0
  56. data/lib/pulpcore_client/models/paginated_upstream_pulp_response_list.rb +237 -0
  57. data/lib/pulpcore_client/models/patched_domain.rb +304 -0
  58. data/lib/pulpcore_client/models/patched_upstream_pulp.rb +450 -0
  59. data/lib/pulpcore_client/models/repository_response.rb +1 -1
  60. data/lib/pulpcore_client/models/status_response.rb +19 -4
  61. data/lib/pulpcore_client/models/storage_class_enum.rb +37 -0
  62. data/lib/pulpcore_client/models/upstream_pulp.rb +477 -0
  63. data/lib/pulpcore_client/models/upstream_pulp_response.rb +338 -0
  64. data/lib/pulpcore_client/models/user_role.rb +17 -6
  65. data/lib/pulpcore_client/models/user_role_response.rb +16 -5
  66. data/lib/pulpcore_client/models/version_response.rb +19 -4
  67. data/lib/pulpcore_client/version.rb +1 -1
  68. data/lib/pulpcore_client.rb +11 -0
  69. data/spec/api/distributions_api_spec.rb +2 -0
  70. data/spec/api/distributions_artifacts_api_spec.rb +2 -0
  71. data/spec/api/domains_api_spec.rb +120 -0
  72. data/spec/api/exporters_filesystem_api_spec.rb +3 -3
  73. data/spec/api/exporters_filesystem_exports_api_spec.rb +3 -3
  74. data/spec/api/groups_api_spec.rb +6 -6
  75. data/spec/api/groups_roles_api_spec.rb +5 -4
  76. data/spec/api/repositories_api_spec.rb +8 -0
  77. data/spec/api/roles_api_spec.rb +6 -6
  78. data/spec/api/task_schedules_api_spec.rb +2 -2
  79. data/spec/api/tasks_api_spec.rb +1 -1
  80. data/spec/api/upstream_pulps_api_spec.rb +127 -0
  81. data/spec/api/users_api_spec.rb +6 -6
  82. data/spec/api/users_roles_api_spec.rb +5 -4
  83. data/spec/models/artifact_distribution_response_spec.rb +7 -7
  84. data/spec/models/domain_response_spec.rb +83 -0
  85. data/spec/models/domain_spec.rb +71 -0
  86. data/spec/models/group_role_response_spec.rb +6 -0
  87. data/spec/models/group_role_spec.rb +6 -0
  88. data/spec/models/paginated_domain_response_list_spec.rb +59 -0
  89. data/spec/models/paginated_upstream_pulp_response_list_spec.rb +59 -0
  90. data/spec/models/patched_domain_spec.rb +71 -0
  91. data/spec/models/patched_upstream_pulp_spec.rb +101 -0
  92. data/spec/models/status_response_spec.rb +6 -0
  93. data/spec/models/storage_class_enum_spec.rb +35 -0
  94. data/spec/models/upstream_pulp_response_spec.rb +107 -0
  95. data/spec/models/upstream_pulp_spec.rb +101 -0
  96. data/spec/models/user_role_response_spec.rb +6 -0
  97. data/spec/models/user_role_spec.rb +6 -0
  98. data/spec/models/version_response_spec.rb +6 -0
  99. metadata +178 -134
@@ -72,7 +72,7 @@ module PulpcoreClient
72
72
  if @api_client.config.debugging
73
73
  @api_client.config.logger.debug 'Calling API: WorkersApi.list ...'
74
74
  end
75
- allowable_values = ["-last_heartbeat", "-name", "-pk", "-pulp_created", "-pulp_id", "-pulp_last_updated", "last_heartbeat", "name", "pk", "pulp_created", "pulp_id", "pulp_last_updated"]
75
+ allowable_values = ["-last_heartbeat", "-name", "-pk", "-pulp_created", "-pulp_id", "-pulp_last_updated", "-versions", "last_heartbeat", "name", "pk", "pulp_created", "pulp_id", "pulp_last_updated", "versions"]
76
76
  if @api_client.config.client_side_validation && opts[:'ordering'] && !opts[:'ordering'].all? { |item| allowable_values.include?(item) }
77
77
  fail ArgumentError, "invalid value for \"ordering\", must include one of #{allowable_values}"
78
78
  end
@@ -15,48 +15,48 @@ 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
18
+ attr_accessor :pulp_href
19
+
20
+ attr_accessor :pulp_labels
20
21
 
21
22
  # Timestamp of creation.
22
23
  attr_accessor :pulp_created
23
24
 
24
- attr_accessor :pulp_href
25
-
26
- # The URL for accessing the publication as defined by this distribution.
27
- attr_accessor :base_url
28
-
29
25
  # An optional content-guard.
30
26
  attr_accessor :content_guard
31
27
 
32
- attr_accessor :pulp_labels
28
+ # The URL for accessing the publication as defined by this distribution.
29
+ attr_accessor :base_url
33
30
 
34
31
  # A unique name. Ex, `rawhide` and `stable`.
35
32
  attr_accessor :name
36
33
 
34
+ # The base (relative) path component of the published url. Avoid paths that overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")
35
+ attr_accessor :base_path
36
+
37
37
  # Attribute mapping from ruby-style variable name to JSON key.
38
38
  def self.attribute_map
39
39
  {
40
- :'base_path' => :'base_path',
41
- :'pulp_created' => :'pulp_created',
42
40
  :'pulp_href' => :'pulp_href',
43
- :'base_url' => :'base_url',
44
- :'content_guard' => :'content_guard',
45
41
  :'pulp_labels' => :'pulp_labels',
46
- :'name' => :'name'
42
+ :'pulp_created' => :'pulp_created',
43
+ :'content_guard' => :'content_guard',
44
+ :'base_url' => :'base_url',
45
+ :'name' => :'name',
46
+ :'base_path' => :'base_path'
47
47
  }
48
48
  end
49
49
 
50
50
  # Attribute type mapping.
51
51
  def self.openapi_types
52
52
  {
53
- :'base_path' => :'String',
54
- :'pulp_created' => :'DateTime',
55
53
  :'pulp_href' => :'String',
56
- :'base_url' => :'String',
57
- :'content_guard' => :'String',
58
54
  :'pulp_labels' => :'Hash<String, String>',
59
- :'name' => :'String'
55
+ :'pulp_created' => :'DateTime',
56
+ :'content_guard' => :'String',
57
+ :'base_url' => :'String',
58
+ :'name' => :'String',
59
+ :'base_path' => :'String'
60
60
  }
61
61
  end
62
62
 
@@ -82,57 +82,57 @@ module PulpcoreClient
82
82
  h[k.to_sym] = v
83
83
  }
84
84
 
85
- if attributes.key?(:'base_path')
86
- self.base_path = attributes[:'base_path']
87
- end
88
-
89
- if attributes.key?(:'pulp_created')
90
- self.pulp_created = attributes[:'pulp_created']
91
- end
92
-
93
85
  if attributes.key?(:'pulp_href')
94
86
  self.pulp_href = attributes[:'pulp_href']
95
87
  end
96
88
 
97
- if attributes.key?(:'base_url')
98
- self.base_url = attributes[:'base_url']
89
+ if attributes.key?(:'pulp_labels')
90
+ if (value = attributes[:'pulp_labels']).is_a?(Hash)
91
+ self.pulp_labels = value
92
+ end
93
+ end
94
+
95
+ if attributes.key?(:'pulp_created')
96
+ self.pulp_created = attributes[:'pulp_created']
99
97
  end
100
98
 
101
99
  if attributes.key?(:'content_guard')
102
100
  self.content_guard = attributes[:'content_guard']
103
101
  end
104
102
 
105
- if attributes.key?(:'pulp_labels')
106
- if (value = attributes[:'pulp_labels']).is_a?(Hash)
107
- self.pulp_labels = value
108
- end
103
+ if attributes.key?(:'base_url')
104
+ self.base_url = attributes[:'base_url']
109
105
  end
110
106
 
111
107
  if attributes.key?(:'name')
112
108
  self.name = attributes[:'name']
113
109
  end
110
+
111
+ if attributes.key?(:'base_path')
112
+ self.base_path = attributes[:'base_path']
113
+ end
114
114
  end
115
115
 
116
116
  # Show invalid properties with the reasons. Usually used together with valid?
117
117
  # @return Array for valid properties with the reasons
118
118
  def list_invalid_properties
119
119
  invalid_properties = Array.new
120
- if @base_path.nil?
121
- invalid_properties.push('invalid value for "base_path", base_path cannot be nil.')
122
- end
123
-
124
120
  if @name.nil?
125
121
  invalid_properties.push('invalid value for "name", name cannot be nil.')
126
122
  end
127
123
 
124
+ if @base_path.nil?
125
+ invalid_properties.push('invalid value for "base_path", base_path cannot be nil.')
126
+ end
127
+
128
128
  invalid_properties
129
129
  end
130
130
 
131
131
  # Check to see if the all the properties in the model are valid
132
132
  # @return true if the model is valid
133
133
  def valid?
134
- return false if @base_path.nil?
135
134
  return false if @name.nil?
135
+ return false if @base_path.nil?
136
136
  true
137
137
  end
138
138
 
@@ -141,13 +141,13 @@ module PulpcoreClient
141
141
  def ==(o)
142
142
  return true if self.equal?(o)
143
143
  self.class == o.class &&
144
- base_path == o.base_path &&
145
- pulp_created == o.pulp_created &&
146
144
  pulp_href == o.pulp_href &&
147
- base_url == o.base_url &&
148
- content_guard == o.content_guard &&
149
145
  pulp_labels == o.pulp_labels &&
150
- name == o.name
146
+ pulp_created == o.pulp_created &&
147
+ content_guard == o.content_guard &&
148
+ base_url == o.base_url &&
149
+ name == o.name &&
150
+ base_path == o.base_path
151
151
  end
152
152
 
153
153
  # @see the `==` method
@@ -159,7 +159,7 @@ module PulpcoreClient
159
159
  # Calculates hash code according to all attributes.
160
160
  # @return [Integer] Hash code
161
161
  def hash
162
- [base_path, pulp_created, pulp_href, base_url, content_guard, pulp_labels, name].hash
162
+ [pulp_href, pulp_labels, pulp_created, content_guard, base_url, name, base_path].hash
163
163
  end
164
164
 
165
165
  # Builds the object from hash
@@ -0,0 +1,323 @@
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
+ # Serializer for Domain.
17
+ class Domain
18
+ # A name for this domain.
19
+ attr_accessor :name
20
+
21
+ # An optional description.
22
+ attr_accessor :description
23
+
24
+ # Backend storage class for domain.
25
+ attr_accessor :storage_class
26
+
27
+ # Settings for storage class.
28
+ attr_accessor :storage_settings
29
+
30
+ # Boolean to have the content app redirect to object storage.
31
+ attr_accessor :redirect_to_object_storage
32
+
33
+ # Boolean to hide distributions with a content guard in the content app.
34
+ attr_accessor :hide_guarded_distributions
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'name' => :'name',
40
+ :'description' => :'description',
41
+ :'storage_class' => :'storage_class',
42
+ :'storage_settings' => :'storage_settings',
43
+ :'redirect_to_object_storage' => :'redirect_to_object_storage',
44
+ :'hide_guarded_distributions' => :'hide_guarded_distributions'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.openapi_types
50
+ {
51
+ :'name' => :'String',
52
+ :'description' => :'String',
53
+ :'storage_class' => :'StorageClassEnum',
54
+ :'storage_settings' => :'Object',
55
+ :'redirect_to_object_storage' => :'Boolean',
56
+ :'hide_guarded_distributions' => :'Boolean'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ :'description',
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::Domain` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::Domain`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'name')
83
+ self.name = attributes[:'name']
84
+ end
85
+
86
+ if attributes.key?(:'description')
87
+ self.description = attributes[:'description']
88
+ end
89
+
90
+ if attributes.key?(:'storage_class')
91
+ self.storage_class = attributes[:'storage_class']
92
+ end
93
+
94
+ if attributes.key?(:'storage_settings')
95
+ self.storage_settings = attributes[:'storage_settings']
96
+ end
97
+
98
+ if attributes.key?(:'redirect_to_object_storage')
99
+ self.redirect_to_object_storage = attributes[:'redirect_to_object_storage']
100
+ else
101
+ self.redirect_to_object_storage = true
102
+ end
103
+
104
+ if attributes.key?(:'hide_guarded_distributions')
105
+ self.hide_guarded_distributions = attributes[:'hide_guarded_distributions']
106
+ else
107
+ self.hide_guarded_distributions = false
108
+ end
109
+ end
110
+
111
+ # Show invalid properties with the reasons. Usually used together with valid?
112
+ # @return Array for valid properties with the reasons
113
+ def list_invalid_properties
114
+ invalid_properties = Array.new
115
+ if @name.nil?
116
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
117
+ end
118
+
119
+ if @name.to_s.length < 1
120
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
121
+ end
122
+
123
+ pattern = Regexp.new(/^[-a-zA-Z0-9_]+$/)
124
+ if @name !~ pattern
125
+ invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
126
+ end
127
+
128
+ if !@description.nil? && @description.to_s.length < 1
129
+ invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.')
130
+ end
131
+
132
+ if @storage_class.nil?
133
+ invalid_properties.push('invalid value for "storage_class", storage_class cannot be nil.')
134
+ end
135
+
136
+ if @storage_settings.nil?
137
+ invalid_properties.push('invalid value for "storage_settings", storage_settings cannot be nil.')
138
+ end
139
+
140
+ invalid_properties
141
+ end
142
+
143
+ # Check to see if the all the properties in the model are valid
144
+ # @return true if the model is valid
145
+ def valid?
146
+ return false if @name.nil?
147
+ return false if @name.to_s.length < 1
148
+ return false if @name !~ Regexp.new(/^[-a-zA-Z0-9_]+$/)
149
+ return false if !@description.nil? && @description.to_s.length < 1
150
+ return false if @storage_class.nil?
151
+ return false if @storage_settings.nil?
152
+ true
153
+ end
154
+
155
+ # Custom attribute writer method with validation
156
+ # @param [Object] name Value to be assigned
157
+ def name=(name)
158
+ if name.nil?
159
+ fail ArgumentError, 'name cannot be nil'
160
+ end
161
+
162
+ if name.to_s.length < 1
163
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
164
+ end
165
+
166
+ pattern = Regexp.new(/^[-a-zA-Z0-9_]+$/)
167
+ if name !~ pattern
168
+ fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
169
+ end
170
+
171
+ @name = name
172
+ end
173
+
174
+ # Custom attribute writer method with validation
175
+ # @param [Object] description Value to be assigned
176
+ def description=(description)
177
+ if !description.nil? && description.to_s.length < 1
178
+ fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.'
179
+ end
180
+
181
+ @description = description
182
+ end
183
+
184
+ # Checks equality by comparing each attribute.
185
+ # @param [Object] Object to be compared
186
+ def ==(o)
187
+ return true if self.equal?(o)
188
+ self.class == o.class &&
189
+ name == o.name &&
190
+ description == o.description &&
191
+ storage_class == o.storage_class &&
192
+ storage_settings == o.storage_settings &&
193
+ redirect_to_object_storage == o.redirect_to_object_storage &&
194
+ hide_guarded_distributions == o.hide_guarded_distributions
195
+ end
196
+
197
+ # @see the `==` method
198
+ # @param [Object] Object to be compared
199
+ def eql?(o)
200
+ self == o
201
+ end
202
+
203
+ # Calculates hash code according to all attributes.
204
+ # @return [Integer] Hash code
205
+ def hash
206
+ [name, description, storage_class, storage_settings, redirect_to_object_storage, hide_guarded_distributions].hash
207
+ end
208
+
209
+ # Builds the object from hash
210
+ # @param [Hash] attributes Model attributes in the form of hash
211
+ # @return [Object] Returns the model itself
212
+ def self.build_from_hash(attributes)
213
+ new.build_from_hash(attributes)
214
+ end
215
+
216
+ # Builds the object from hash
217
+ # @param [Hash] attributes Model attributes in the form of hash
218
+ # @return [Object] Returns the model itself
219
+ def build_from_hash(attributes)
220
+ return nil unless attributes.is_a?(Hash)
221
+ self.class.openapi_types.each_pair do |key, type|
222
+ if type =~ /\AArray<(.*)>/i
223
+ # check to ensure the input is an array given that the attribute
224
+ # is documented as an array but the input is not
225
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
226
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
227
+ end
228
+ elsif !attributes[self.class.attribute_map[key]].nil?
229
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
230
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
231
+ end
232
+
233
+ self
234
+ end
235
+
236
+ # Deserializes the data based on type
237
+ # @param string type Data type
238
+ # @param string value Value to be deserialized
239
+ # @return [Object] Deserialized data
240
+ def _deserialize(type, value)
241
+ case type.to_sym
242
+ when :DateTime
243
+ DateTime.parse(value)
244
+ when :Date
245
+ Date.parse(value)
246
+ when :String
247
+ value.to_s
248
+ when :Integer
249
+ value.to_i
250
+ when :Float
251
+ value.to_f
252
+ when :Boolean
253
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
254
+ true
255
+ else
256
+ false
257
+ end
258
+ when :Object
259
+ # generic object (usually a Hash), return directly
260
+ value
261
+ when /\AArray<(?<inner_type>.+)>\z/
262
+ inner_type = Regexp.last_match[:inner_type]
263
+ value.map { |v| _deserialize(inner_type, v) }
264
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
265
+ k_type = Regexp.last_match[:k_type]
266
+ v_type = Regexp.last_match[:v_type]
267
+ {}.tap do |hash|
268
+ value.each do |k, v|
269
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
270
+ end
271
+ end
272
+ else # model
273
+ PulpcoreClient.const_get(type).build_from_hash(value)
274
+ end
275
+ end
276
+
277
+ # Returns the string representation of the object
278
+ # @return [String] String presentation of the object
279
+ def to_s
280
+ to_hash.to_s
281
+ end
282
+
283
+ # to_body is an alias to to_hash (backward compatibility)
284
+ # @return [Hash] Returns the object in the form of hash
285
+ def to_body
286
+ to_hash
287
+ end
288
+
289
+ # Returns the object in the form of hash
290
+ # @return [Hash] Returns the object in the form of hash
291
+ def to_hash
292
+ hash = {}
293
+ self.class.attribute_map.each_pair do |attr, param|
294
+ value = self.send(attr)
295
+ if value.nil?
296
+ is_nullable = self.class.openapi_nullable.include?(attr)
297
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
298
+ end
299
+
300
+ hash[param] = _to_hash(value)
301
+ end
302
+ hash
303
+ end
304
+
305
+ # Outputs non-array value in the form of hash
306
+ # For object, use to_hash. Otherwise, just return the value
307
+ # @param [Object] value Any valid value
308
+ # @return [Hash] Returns the value in the form of hash
309
+ def _to_hash(value)
310
+ if value.is_a?(Array)
311
+ value.compact.map { |v| _to_hash(v) }
312
+ elsif value.is_a?(Hash)
313
+ {}.tap do |hash|
314
+ value.each { |k, v| hash[k] = _to_hash(v) }
315
+ end
316
+ elsif value.respond_to? :to_hash
317
+ value.to_hash
318
+ else
319
+ value
320
+ end
321
+ end
322
+ end
323
+ end