pulp_cookbook_client 0.1.0b9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +162 -0
  4. data/Rakefile +10 -0
  5. data/docs/AsyncOperationResponse.md +17 -0
  6. data/docs/ContentCookbooksApi.md +208 -0
  7. data/docs/ContentSummary.md +21 -0
  8. data/docs/ContentSummaryResponse.md +21 -0
  9. data/docs/CookbookCookbookDistribution.md +27 -0
  10. data/docs/CookbookCookbookDistributionResponse.md +33 -0
  11. data/docs/CookbookCookbookPackageContent.md +25 -0
  12. data/docs/CookbookCookbookPackageContentResponse.md +29 -0
  13. data/docs/CookbookCookbookPublication.md +19 -0
  14. data/docs/CookbookCookbookPublicationResponse.md +25 -0
  15. data/docs/CookbookCookbookRemote.md +59 -0
  16. data/docs/CookbookCookbookRemoteResponse.md +55 -0
  17. data/docs/CookbookCookbookRepository.md +25 -0
  18. data/docs/CookbookCookbookRepositoryResponse.md +33 -0
  19. data/docs/DistributionsCookbookApi.md +372 -0
  20. data/docs/PaginatedRepositoryVersionResponseList.md +23 -0
  21. data/docs/PaginatedcookbookCookbookDistributionResponseList.md +23 -0
  22. data/docs/PaginatedcookbookCookbookPackageContentResponseList.md +23 -0
  23. data/docs/PaginatedcookbookCookbookPublicationResponseList.md +23 -0
  24. data/docs/PaginatedcookbookCookbookRemoteResponseList.md +23 -0
  25. data/docs/PaginatedcookbookCookbookRepositoryResponseList.md +23 -0
  26. data/docs/PatchedcookbookCookbookDistribution.md +27 -0
  27. data/docs/PatchedcookbookCookbookRemote.md +59 -0
  28. data/docs/PatchedcookbookCookbookRepository.md +25 -0
  29. data/docs/PolicyEnum.md +16 -0
  30. data/docs/PublicationsCookbookApi.md +257 -0
  31. data/docs/RemotesCookbookApi.md +376 -0
  32. data/docs/RepositoriesCookbookApi.md +475 -0
  33. data/docs/RepositoriesCookbookVersionsApi.md +271 -0
  34. data/docs/RepositoryAddRemoveContent.md +21 -0
  35. data/docs/RepositorySyncURL.md +19 -0
  36. data/docs/RepositoryVersion.md +17 -0
  37. data/docs/RepositoryVersionResponse.md +27 -0
  38. data/git_push.sh +58 -0
  39. data/lib/pulp_cookbook_client/api/content_cookbooks_api.rb +264 -0
  40. data/lib/pulp_cookbook_client/api/distributions_cookbook_api.rb +457 -0
  41. data/lib/pulp_cookbook_client/api/publications_cookbook_api.rb +312 -0
  42. data/lib/pulp_cookbook_client/api/remotes_cookbook_api.rb +463 -0
  43. data/lib/pulp_cookbook_client/api/repositories_cookbook_api.rb +583 -0
  44. data/lib/pulp_cookbook_client/api/repositories_cookbook_versions_api.rb +339 -0
  45. data/lib/pulp_cookbook_client/api_client.rb +406 -0
  46. data/lib/pulp_cookbook_client/api_error.rb +57 -0
  47. data/lib/pulp_cookbook_client/configuration.rb +250 -0
  48. data/lib/pulp_cookbook_client/models/async_operation_response.rb +213 -0
  49. data/lib/pulp_cookbook_client/models/content_summary.rb +246 -0
  50. data/lib/pulp_cookbook_client/models/content_summary_response.rb +246 -0
  51. data/lib/pulp_cookbook_client/models/cookbook_cookbook_distribution.rb +308 -0
  52. data/lib/pulp_cookbook_client/models/cookbook_cookbook_distribution_response.rb +299 -0
  53. data/lib/pulp_cookbook_client/models/cookbook_cookbook_package_content.rb +287 -0
  54. data/lib/pulp_cookbook_client/models/cookbook_cookbook_package_content_response.rb +272 -0
  55. data/lib/pulp_cookbook_client/models/cookbook_cookbook_publication.rb +217 -0
  56. data/lib/pulp_cookbook_client/models/cookbook_cookbook_publication_response.rb +248 -0
  57. data/lib/pulp_cookbook_client/models/cookbook_cookbook_remote.rb +677 -0
  58. data/lib/pulp_cookbook_client/models/cookbook_cookbook_remote_response.rb +493 -0
  59. data/lib/pulp_cookbook_client/models/cookbook_cookbook_repository.rb +304 -0
  60. data/lib/pulp_cookbook_client/models/cookbook_cookbook_repository_response.rb +307 -0
  61. data/lib/pulp_cookbook_client/models/paginated_repository_version_response_list.rb +237 -0
  62. data/lib/pulp_cookbook_client/models/paginatedcookbook_cookbook_distribution_response_list.rb +237 -0
  63. data/lib/pulp_cookbook_client/models/paginatedcookbook_cookbook_package_content_response_list.rb +237 -0
  64. data/lib/pulp_cookbook_client/models/paginatedcookbook_cookbook_publication_response_list.rb +237 -0
  65. data/lib/pulp_cookbook_client/models/paginatedcookbook_cookbook_remote_response_list.rb +237 -0
  66. data/lib/pulp_cookbook_client/models/paginatedcookbook_cookbook_repository_response_list.rb +237 -0
  67. data/lib/pulp_cookbook_client/models/patchedcookbook_cookbook_distribution.rb +290 -0
  68. data/lib/pulp_cookbook_client/models/patchedcookbook_cookbook_remote.rb +659 -0
  69. data/lib/pulp_cookbook_client/models/patchedcookbook_cookbook_repository.rb +295 -0
  70. data/lib/pulp_cookbook_client/models/policy_enum.rb +37 -0
  71. data/lib/pulp_cookbook_client/models/repository_add_remove_content.rb +232 -0
  72. data/lib/pulp_cookbook_client/models/repository_sync_url.rb +220 -0
  73. data/lib/pulp_cookbook_client/models/repository_version.rb +208 -0
  74. data/lib/pulp_cookbook_client/models/repository_version_response.rb +255 -0
  75. data/lib/pulp_cookbook_client/version.rb +15 -0
  76. data/lib/pulp_cookbook_client.rb +72 -0
  77. data/pulp_cookbook_client.gemspec +39 -0
  78. data/spec/api/content_cookbooks_api_spec.rb +87 -0
  79. data/spec/api/distributions_cookbook_api_spec.rb +125 -0
  80. data/spec/api/publications_cookbook_api_spec.rb +98 -0
  81. data/spec/api/remotes_cookbook_api_spec.rb +127 -0
  82. data/spec/api/repositories_cookbook_api_spec.rb +146 -0
  83. data/spec/api/repositories_cookbook_versions_api_spec.rb +104 -0
  84. data/spec/api_client_spec.rb +188 -0
  85. data/spec/configuration_spec.rb +42 -0
  86. data/spec/models/async_operation_response_spec.rb +41 -0
  87. data/spec/models/content_summary_response_spec.rb +53 -0
  88. data/spec/models/content_summary_spec.rb +53 -0
  89. data/spec/models/cookbook_cookbook_distribution_response_spec.rb +89 -0
  90. data/spec/models/cookbook_cookbook_distribution_spec.rb +71 -0
  91. data/spec/models/cookbook_cookbook_package_content_response_spec.rb +77 -0
  92. data/spec/models/cookbook_cookbook_package_content_spec.rb +65 -0
  93. data/spec/models/cookbook_cookbook_publication_response_spec.rb +65 -0
  94. data/spec/models/cookbook_cookbook_publication_spec.rb +47 -0
  95. data/spec/models/cookbook_cookbook_remote_response_spec.rb +155 -0
  96. data/spec/models/cookbook_cookbook_remote_spec.rb +167 -0
  97. data/spec/models/cookbook_cookbook_repository_response_spec.rb +89 -0
  98. data/spec/models/cookbook_cookbook_repository_spec.rb +65 -0
  99. data/spec/models/paginated_repository_version_response_list_spec.rb +59 -0
  100. data/spec/models/paginatedcookbook_cookbook_distribution_response_list_spec.rb +59 -0
  101. data/spec/models/paginatedcookbook_cookbook_package_content_response_list_spec.rb +59 -0
  102. data/spec/models/paginatedcookbook_cookbook_publication_response_list_spec.rb +59 -0
  103. data/spec/models/paginatedcookbook_cookbook_remote_response_list_spec.rb +59 -0
  104. data/spec/models/paginatedcookbook_cookbook_repository_response_list_spec.rb +59 -0
  105. data/spec/models/patchedcookbook_cookbook_distribution_spec.rb +71 -0
  106. data/spec/models/patchedcookbook_cookbook_remote_spec.rb +167 -0
  107. data/spec/models/patchedcookbook_cookbook_repository_spec.rb +65 -0
  108. data/spec/models/policy_enum_spec.rb +35 -0
  109. data/spec/models/repository_add_remove_content_spec.rb +53 -0
  110. data/spec/models/repository_sync_url_spec.rb +47 -0
  111. data/spec/models/repository_version_response_spec.rb +71 -0
  112. data/spec/models/repository_version_spec.rb +41 -0
  113. data/spec/spec_helper.rb +111 -0
  114. metadata +251 -0
@@ -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
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpCookbookClient
16
+ # Serializer for Cookbook Publications.
17
+ class CookbookCookbookPublication
18
+ attr_accessor :repository_version
19
+
20
+ # A URI of the repository to be published.
21
+ attr_accessor :repository
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'repository_version' => :'repository_version',
27
+ :'repository' => :'repository'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'repository_version' => :'String',
35
+ :'repository' => :'String'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
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 `PulpCookbookClient::CookbookCookbookPublication` 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 `PulpCookbookClient::CookbookCookbookPublication`. 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?(:'repository_version')
61
+ self.repository_version = attributes[:'repository_version']
62
+ end
63
+
64
+ if attributes.key?(:'repository')
65
+ self.repository = attributes[:'repository']
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
+ 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
+ true
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(o)
85
+ return true if self.equal?(o)
86
+ self.class == o.class &&
87
+ repository_version == o.repository_version &&
88
+ repository == o.repository
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
+ [repository_version, repository].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
+ new.build_from_hash(attributes)
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.openapi_types.each_pair do |key, type|
116
+ if type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :DateTime
137
+ DateTime.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ PulpCookbookClient.const_get(type).build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+ end
217
+ end
@@ -0,0 +1,248 @@
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 PulpCookbookClient
16
+ # Serializer for Cookbook Publications.
17
+ class CookbookCookbookPublicationResponse
18
+ attr_accessor :pulp_href
19
+
20
+ # Timestamp of creation.
21
+ attr_accessor :pulp_created
22
+
23
+ attr_accessor :repository_version
24
+
25
+ # A URI of the repository to be published.
26
+ attr_accessor :repository
27
+
28
+ # This publication is currently being served as defined by these distributions.
29
+ attr_accessor :distributions
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'pulp_href' => :'pulp_href',
35
+ :'pulp_created' => :'pulp_created',
36
+ :'repository_version' => :'repository_version',
37
+ :'repository' => :'repository',
38
+ :'distributions' => :'distributions'
39
+ }
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'pulp_href' => :'String',
46
+ :'pulp_created' => :'DateTime',
47
+ :'repository_version' => :'String',
48
+ :'repository' => :'String',
49
+ :'distributions' => :'Array<String>'
50
+ }
51
+ end
52
+
53
+ # List of attributes with nullable: true
54
+ def self.openapi_nullable
55
+ Set.new([
56
+ ])
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ if (!attributes.is_a?(Hash))
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpCookbookClient::CookbookCookbookPublicationResponse` initialize method"
64
+ end
65
+
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!self.class.attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpCookbookClient::CookbookCookbookPublicationResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'pulp_href')
75
+ self.pulp_href = attributes[:'pulp_href']
76
+ end
77
+
78
+ if attributes.key?(:'pulp_created')
79
+ self.pulp_created = attributes[:'pulp_created']
80
+ end
81
+
82
+ if attributes.key?(:'repository_version')
83
+ self.repository_version = attributes[:'repository_version']
84
+ end
85
+
86
+ if attributes.key?(:'repository')
87
+ self.repository = attributes[:'repository']
88
+ end
89
+
90
+ if attributes.key?(:'distributions')
91
+ if (value = attributes[:'distributions']).is_a?(Array)
92
+ self.distributions = value
93
+ end
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ invalid_properties = Array.new
101
+ invalid_properties
102
+ end
103
+
104
+ # Check to see if the all the properties in the model are valid
105
+ # @return true if the model is valid
106
+ def valid?
107
+ true
108
+ end
109
+
110
+ # Checks equality by comparing each attribute.
111
+ # @param [Object] Object to be compared
112
+ def ==(o)
113
+ return true if self.equal?(o)
114
+ self.class == o.class &&
115
+ pulp_href == o.pulp_href &&
116
+ pulp_created == o.pulp_created &&
117
+ repository_version == o.repository_version &&
118
+ repository == o.repository &&
119
+ distributions == o.distributions
120
+ end
121
+
122
+ # @see the `==` method
123
+ # @param [Object] Object to be compared
124
+ def eql?(o)
125
+ self == o
126
+ end
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Integer] Hash code
130
+ def hash
131
+ [pulp_href, pulp_created, repository_version, repository, distributions].hash
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def self.build_from_hash(attributes)
138
+ new.build_from_hash(attributes)
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def build_from_hash(attributes)
145
+ return nil unless attributes.is_a?(Hash)
146
+ self.class.openapi_types.each_pair do |key, type|
147
+ if type =~ /\AArray<(.*)>/i
148
+ # check to ensure the input is an array given that the attribute
149
+ # is documented as an array but the input is not
150
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
151
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
152
+ end
153
+ elsif !attributes[self.class.attribute_map[key]].nil?
154
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
155
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
156
+ end
157
+
158
+ self
159
+ end
160
+
161
+ # Deserializes the data based on type
162
+ # @param string type Data type
163
+ # @param string value Value to be deserialized
164
+ # @return [Object] Deserialized data
165
+ def _deserialize(type, value)
166
+ case type.to_sym
167
+ when :DateTime
168
+ DateTime.parse(value)
169
+ when :Date
170
+ Date.parse(value)
171
+ when :String
172
+ value.to_s
173
+ when :Integer
174
+ value.to_i
175
+ when :Float
176
+ value.to_f
177
+ when :Boolean
178
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
179
+ true
180
+ else
181
+ false
182
+ end
183
+ when :Object
184
+ # generic object (usually a Hash), return directly
185
+ value
186
+ when /\AArray<(?<inner_type>.+)>\z/
187
+ inner_type = Regexp.last_match[:inner_type]
188
+ value.map { |v| _deserialize(inner_type, v) }
189
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
190
+ k_type = Regexp.last_match[:k_type]
191
+ v_type = Regexp.last_match[:v_type]
192
+ {}.tap do |hash|
193
+ value.each do |k, v|
194
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
195
+ end
196
+ end
197
+ else # model
198
+ PulpCookbookClient.const_get(type).build_from_hash(value)
199
+ end
200
+ end
201
+
202
+ # Returns the string representation of the object
203
+ # @return [String] String presentation of the object
204
+ def to_s
205
+ to_hash.to_s
206
+ end
207
+
208
+ # to_body is an alias to to_hash (backward compatibility)
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_body
211
+ to_hash
212
+ end
213
+
214
+ # Returns the object in the form of hash
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_hash
217
+ hash = {}
218
+ self.class.attribute_map.each_pair do |attr, param|
219
+ value = self.send(attr)
220
+ if value.nil?
221
+ is_nullable = self.class.openapi_nullable.include?(attr)
222
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
223
+ end
224
+
225
+ hash[param] = _to_hash(value)
226
+ end
227
+ hash
228
+ end
229
+
230
+ # Outputs non-array value in the form of hash
231
+ # For object, use to_hash. Otherwise, just return the value
232
+ # @param [Object] value Any valid value
233
+ # @return [Hash] Returns the value in the form of hash
234
+ def _to_hash(value)
235
+ if value.is_a?(Array)
236
+ value.compact.map { |v| _to_hash(v) }
237
+ elsif value.is_a?(Hash)
238
+ {}.tap do |hash|
239
+ value.each { |k, v| hash[k] = _to_hash(v) }
240
+ end
241
+ elsif value.respond_to? :to_hash
242
+ value.to_hash
243
+ else
244
+ value
245
+ end
246
+ end
247
+ end
248
+ end