autosde_openapi_client 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,254 +0,0 @@
1
- =begin
2
- #Site Manager API
3
-
4
- #Site Manager API
5
-
6
- The version of the OpenAPI document: 1.0.0
7
- Contact: autosde@il.ibm.com
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0
10
-
11
- =end
12
-
13
- require 'cgi'
14
-
15
- module AutosdeOpenapiClient
16
- class VolumeSafeDeleteApi
17
- attr_accessor :api_client
18
-
19
- def initialize(api_client = ApiClient.default)
20
- @api_client = api_client
21
- end
22
- # @param [Hash] opts the optional parameters
23
- # @return [Array<VolumeSafeDelete>]
24
- def safe_deletes_get(opts = {})
25
- data, _status_code, _headers = safe_deletes_get_with_http_info(opts)
26
- data
27
- end
28
-
29
- # @param [Hash] opts the optional parameters
30
- # @return [Array<(Array<VolumeSafeDelete>, Integer, Hash)>] Array<VolumeSafeDelete> data, response status code and response headers
31
- def safe_deletes_get_with_http_info(opts = {})
32
- if @api_client.config.debugging
33
- @api_client.config.logger.debug 'Calling API: VolumeSafeDeleteApi.safe_deletes_get ...'
34
- end
35
- # resource path
36
- local_var_path = '/safe-deletes'
37
-
38
- # query parameters
39
- query_params = opts[:query_params] || {}
40
-
41
- # header parameters
42
- header_params = opts[:header_params] || {}
43
- # HTTP header 'Accept' (if needed)
44
- header_params['Accept'] = @api_client.select_header_accept(['*/*'])
45
-
46
- # form parameters
47
- form_params = opts[:form_params] || {}
48
-
49
- # http body (model)
50
- post_body = opts[:debug_body]
51
-
52
- # return_type
53
- return_type = opts[:debug_return_type] || 'Array<VolumeSafeDelete>'
54
-
55
- # auth_names
56
- auth_names = opts[:debug_auth_names] || ['bearerAuth']
57
-
58
- new_options = opts.merge(
59
- :operation => :"VolumeSafeDeleteApi.safe_deletes_get",
60
- :header_params => header_params,
61
- :query_params => query_params,
62
- :form_params => form_params,
63
- :body => post_body,
64
- :auth_names => auth_names,
65
- :return_type => return_type
66
- )
67
-
68
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
69
- if @api_client.config.debugging
70
- @api_client.config.logger.debug "API called: VolumeSafeDeleteApi#safe_deletes_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
71
- end
72
- return data, status_code, headers
73
- end
74
-
75
- # @param pk [Integer]
76
- # @param [Hash] opts the optional parameters
77
- # @return [VolumeSafeDelete]
78
- def safe_deletes_pk_delete(pk, opts = {})
79
- data, _status_code, _headers = safe_deletes_pk_delete_with_http_info(pk, opts)
80
- data
81
- end
82
-
83
- # @param pk [Integer]
84
- # @param [Hash] opts the optional parameters
85
- # @return [Array<(VolumeSafeDelete, Integer, Hash)>] VolumeSafeDelete data, response status code and response headers
86
- def safe_deletes_pk_delete_with_http_info(pk, opts = {})
87
- if @api_client.config.debugging
88
- @api_client.config.logger.debug 'Calling API: VolumeSafeDeleteApi.safe_deletes_pk_delete ...'
89
- end
90
- # verify the required parameter 'pk' is set
91
- if @api_client.config.client_side_validation && pk.nil?
92
- fail ArgumentError, "Missing the required parameter 'pk' when calling VolumeSafeDeleteApi.safe_deletes_pk_delete"
93
- end
94
- # resource path
95
- local_var_path = '/safe-deletes/{pk}'.sub('{' + 'pk' + '}', CGI.escape(pk.to_s))
96
-
97
- # query parameters
98
- query_params = opts[:query_params] || {}
99
-
100
- # header parameters
101
- header_params = opts[:header_params] || {}
102
- # HTTP header 'Accept' (if needed)
103
- header_params['Accept'] = @api_client.select_header_accept(['*/*'])
104
-
105
- # form parameters
106
- form_params = opts[:form_params] || {}
107
-
108
- # http body (model)
109
- post_body = opts[:debug_body]
110
-
111
- # return_type
112
- return_type = opts[:debug_return_type] || 'VolumeSafeDelete'
113
-
114
- # auth_names
115
- auth_names = opts[:debug_auth_names] || ['bearerAuth']
116
-
117
- new_options = opts.merge(
118
- :operation => :"VolumeSafeDeleteApi.safe_deletes_pk_delete",
119
- :header_params => header_params,
120
- :query_params => query_params,
121
- :form_params => form_params,
122
- :body => post_body,
123
- :auth_names => auth_names,
124
- :return_type => return_type
125
- )
126
-
127
- data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
128
- if @api_client.config.debugging
129
- @api_client.config.logger.debug "API called: VolumeSafeDeleteApi#safe_deletes_pk_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
130
- end
131
- return data, status_code, headers
132
- end
133
-
134
- # @param pk [Integer]
135
- # @param [Hash] opts the optional parameters
136
- # @return [VolumeSafeDelete]
137
- def safe_deletes_pk_get(pk, opts = {})
138
- data, _status_code, _headers = safe_deletes_pk_get_with_http_info(pk, opts)
139
- data
140
- end
141
-
142
- # @param pk [Integer]
143
- # @param [Hash] opts the optional parameters
144
- # @return [Array<(VolumeSafeDelete, Integer, Hash)>] VolumeSafeDelete data, response status code and response headers
145
- def safe_deletes_pk_get_with_http_info(pk, opts = {})
146
- if @api_client.config.debugging
147
- @api_client.config.logger.debug 'Calling API: VolumeSafeDeleteApi.safe_deletes_pk_get ...'
148
- end
149
- # verify the required parameter 'pk' is set
150
- if @api_client.config.client_side_validation && pk.nil?
151
- fail ArgumentError, "Missing the required parameter 'pk' when calling VolumeSafeDeleteApi.safe_deletes_pk_get"
152
- end
153
- # resource path
154
- local_var_path = '/safe-deletes/{pk}'.sub('{' + 'pk' + '}', CGI.escape(pk.to_s))
155
-
156
- # query parameters
157
- query_params = opts[:query_params] || {}
158
-
159
- # header parameters
160
- header_params = opts[:header_params] || {}
161
- # HTTP header 'Accept' (if needed)
162
- header_params['Accept'] = @api_client.select_header_accept(['*/*'])
163
-
164
- # form parameters
165
- form_params = opts[:form_params] || {}
166
-
167
- # http body (model)
168
- post_body = opts[:debug_body]
169
-
170
- # return_type
171
- return_type = opts[:debug_return_type] || 'VolumeSafeDelete'
172
-
173
- # auth_names
174
- auth_names = opts[:debug_auth_names] || ['bearerAuth']
175
-
176
- new_options = opts.merge(
177
- :operation => :"VolumeSafeDeleteApi.safe_deletes_pk_get",
178
- :header_params => header_params,
179
- :query_params => query_params,
180
- :form_params => form_params,
181
- :body => post_body,
182
- :auth_names => auth_names,
183
- :return_type => return_type
184
- )
185
-
186
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
187
- if @api_client.config.debugging
188
- @api_client.config.logger.debug "API called: VolumeSafeDeleteApi#safe_deletes_pk_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
189
- end
190
- return data, status_code, headers
191
- end
192
-
193
- # @param volume_safe_delete_create [VolumeSafeDeleteCreate]
194
- # @param [Hash] opts the optional parameters
195
- # @return [VolumeSafeDelete]
196
- def safe_deletes_post(volume_safe_delete_create, opts = {})
197
- data, _status_code, _headers = safe_deletes_post_with_http_info(volume_safe_delete_create, opts)
198
- data
199
- end
200
-
201
- # @param volume_safe_delete_create [VolumeSafeDeleteCreate]
202
- # @param [Hash] opts the optional parameters
203
- # @return [Array<(VolumeSafeDelete, Integer, Hash)>] VolumeSafeDelete data, response status code and response headers
204
- def safe_deletes_post_with_http_info(volume_safe_delete_create, opts = {})
205
- if @api_client.config.debugging
206
- @api_client.config.logger.debug 'Calling API: VolumeSafeDeleteApi.safe_deletes_post ...'
207
- end
208
- # verify the required parameter 'volume_safe_delete_create' is set
209
- if @api_client.config.client_side_validation && volume_safe_delete_create.nil?
210
- fail ArgumentError, "Missing the required parameter 'volume_safe_delete_create' when calling VolumeSafeDeleteApi.safe_deletes_post"
211
- end
212
- # resource path
213
- local_var_path = '/safe-deletes'
214
-
215
- # query parameters
216
- query_params = opts[:query_params] || {}
217
-
218
- # header parameters
219
- header_params = opts[:header_params] || {}
220
- # HTTP header 'Accept' (if needed)
221
- header_params['Accept'] = @api_client.select_header_accept(['*/*'])
222
- # HTTP header 'Content-Type'
223
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
224
-
225
- # form parameters
226
- form_params = opts[:form_params] || {}
227
-
228
- # http body (model)
229
- post_body = opts[:debug_body] || @api_client.object_to_http_body(volume_safe_delete_create)
230
-
231
- # return_type
232
- return_type = opts[:debug_return_type] || 'VolumeSafeDelete'
233
-
234
- # auth_names
235
- auth_names = opts[:debug_auth_names] || ['bearerAuth']
236
-
237
- new_options = opts.merge(
238
- :operation => :"VolumeSafeDeleteApi.safe_deletes_post",
239
- :header_params => header_params,
240
- :query_params => query_params,
241
- :form_params => form_params,
242
- :body => post_body,
243
- :auth_names => auth_names,
244
- :return_type => return_type
245
- )
246
-
247
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
248
- if @api_client.config.debugging
249
- @api_client.config.logger.debug "API called: VolumeSafeDeleteApi#safe_deletes_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
250
- end
251
- return data, status_code, headers
252
- end
253
- end
254
- end
@@ -1,239 +0,0 @@
1
- =begin
2
- #Site Manager API
3
-
4
- #Site Manager API
5
-
6
- The version of the OpenAPI document: 1.0.0
7
- Contact: autosde@il.ibm.com
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module AutosdeOpenapiClient
17
- # Volume safe delete api
18
- class VolumeSafeDelete
19
- # task_id
20
- attr_accessor :task_id
21
-
22
- # uuid
23
- attr_accessor :uuid
24
-
25
- attr_accessor :volume
26
-
27
- # Attribute mapping from ruby-style variable name to JSON key.
28
- def self.attribute_map
29
- {
30
- :'task_id' => :'task_id',
31
- :'uuid' => :'uuid',
32
- :'volume' => :'volume'
33
- }
34
- end
35
-
36
- # Returns all the JSON keys this model knows about
37
- def self.acceptable_attributes
38
- attribute_map.values
39
- end
40
-
41
- # Attribute type mapping.
42
- def self.openapi_types
43
- {
44
- :'task_id' => :'String',
45
- :'uuid' => :'String',
46
- :'volume' => :'Volume'
47
- }
48
- end
49
-
50
- # List of attributes with nullable: true
51
- def self.openapi_nullable
52
- Set.new([
53
- ])
54
- end
55
-
56
- # Initializes the object
57
- # @param [Hash] attributes Model attributes in the form of hash
58
- def initialize(attributes = {})
59
- if (!attributes.is_a?(Hash))
60
- fail ArgumentError, "The input argument (attributes) must be a hash in `AutosdeOpenapiClient::VolumeSafeDelete` initialize method"
61
- end
62
-
63
- # check to see if the attribute exists and convert string to symbol for hash key
64
- attributes = attributes.each_with_object({}) { |(k, v), h|
65
- if (!self.class.attribute_map.key?(k.to_sym))
66
- fail ArgumentError, "`#{k}` is not a valid attribute in `AutosdeOpenapiClient::VolumeSafeDelete`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
- end
68
- h[k.to_sym] = v
69
- }
70
-
71
- if attributes.key?(:'task_id')
72
- self.task_id = attributes[:'task_id']
73
- end
74
-
75
- if attributes.key?(:'uuid')
76
- self.uuid = attributes[:'uuid']
77
- end
78
-
79
- if attributes.key?(:'volume')
80
- self.volume = attributes[:'volume']
81
- end
82
- end
83
-
84
- # Show invalid properties with the reasons. Usually used together with valid?
85
- # @return Array for valid properties with the reasons
86
- def list_invalid_properties
87
- invalid_properties = Array.new
88
- invalid_properties
89
- end
90
-
91
- # Check to see if the all the properties in the model are valid
92
- # @return true if the model is valid
93
- def valid?
94
- true
95
- end
96
-
97
- # Checks equality by comparing each attribute.
98
- # @param [Object] Object to be compared
99
- def ==(o)
100
- return true if self.equal?(o)
101
- self.class == o.class &&
102
- task_id == o.task_id &&
103
- uuid == o.uuid &&
104
- volume == o.volume
105
- end
106
-
107
- # @see the `==` method
108
- # @param [Object] Object to be compared
109
- def eql?(o)
110
- self == o
111
- end
112
-
113
- # Calculates hash code according to all attributes.
114
- # @return [Integer] Hash code
115
- def hash
116
- [task_id, uuid, volume].hash
117
- end
118
-
119
- # Builds the object from hash
120
- # @param [Hash] attributes Model attributes in the form of hash
121
- # @return [Object] Returns the model itself
122
- def self.build_from_hash(attributes)
123
- new.build_from_hash(attributes)
124
- end
125
-
126
- # Builds the object from hash
127
- # @param [Hash] attributes Model attributes in the form of hash
128
- # @return [Object] Returns the model itself
129
- def build_from_hash(attributes)
130
- return nil unless attributes.is_a?(Hash)
131
- self.class.openapi_types.each_pair do |key, type|
132
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
133
- self.send("#{key}=", nil)
134
- elsif type =~ /\AArray<(.*)>/i
135
- # check to ensure the input is an array given that the attribute
136
- # is documented as an array but the input is not
137
- if attributes[self.class.attribute_map[key]].is_a?(Array)
138
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
139
- end
140
- elsif !attributes[self.class.attribute_map[key]].nil?
141
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
- end
143
- end
144
-
145
- self
146
- end
147
-
148
- # Deserializes the data based on type
149
- # @param string type Data type
150
- # @param string value Value to be deserialized
151
- # @return [Object] Deserialized data
152
- def _deserialize(type, value)
153
- case type.to_sym
154
- when :Time
155
- Time.parse(value)
156
- when :Date
157
- Date.parse(value)
158
- when :String
159
- value.to_s
160
- when :Integer
161
- value.to_i
162
- when :Float
163
- value.to_f
164
- when :Boolean
165
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
- true
167
- else
168
- false
169
- end
170
- when :Object
171
- # generic object (usually a Hash), return directly
172
- value
173
- when /\AArray<(?<inner_type>.+)>\z/
174
- inner_type = Regexp.last_match[:inner_type]
175
- value.map { |v| _deserialize(inner_type, v) }
176
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
- k_type = Regexp.last_match[:k_type]
178
- v_type = Regexp.last_match[:v_type]
179
- {}.tap do |hash|
180
- value.each do |k, v|
181
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
- end
183
- end
184
- else # model
185
- # models (e.g. Pet) or oneOf
186
- klass = AutosdeOpenapiClient.const_get(type)
187
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
- end
189
- end
190
-
191
- # Returns the string representation of the object
192
- # @return [String] String presentation of the object
193
- def to_s
194
- to_hash.to_s
195
- end
196
-
197
- # to_body is an alias to to_hash (backward compatibility)
198
- # @return [Hash] Returns the object in the form of hash
199
- def to_body
200
- to_hash
201
- end
202
-
203
- # Returns the object in the form of hash
204
- # @return [Hash] Returns the object in the form of hash
205
- def to_hash
206
- hash = {}
207
- self.class.attribute_map.each_pair do |attr, param|
208
- value = self.send(attr)
209
- if value.nil?
210
- is_nullable = self.class.openapi_nullable.include?(attr)
211
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
- end
213
-
214
- hash[param] = _to_hash(value)
215
- end
216
- hash
217
- end
218
-
219
- # Outputs non-array value in the form of hash
220
- # For object, use to_hash. Otherwise, just return the value
221
- # @param [Object] value Any valid value
222
- # @return [Hash] Returns the value in the form of hash
223
- def _to_hash(value)
224
- if value.is_a?(Array)
225
- value.compact.map { |v| _to_hash(v) }
226
- elsif value.is_a?(Hash)
227
- {}.tap do |hash|
228
- value.each { |k, v| hash[k] = _to_hash(v) }
229
- end
230
- elsif value.respond_to? :to_hash
231
- value.to_hash
232
- else
233
- value
234
- end
235
- end
236
-
237
- end
238
-
239
- end
@@ -1,219 +0,0 @@
1
- =begin
2
- #Site Manager API
3
-
4
- #Site Manager API
5
-
6
- The version of the OpenAPI document: 1.0.0
7
- Contact: autosde@il.ibm.com
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module AutosdeOpenapiClient
17
- # TODO add description
18
- class VolumeSafeDeleteCreate
19
- attr_accessor :volume
20
-
21
- # Attribute mapping from ruby-style variable name to JSON key.
22
- def self.attribute_map
23
- {
24
- :'volume' => :'volume'
25
- }
26
- end
27
-
28
- # Returns all the JSON keys this model knows about
29
- def self.acceptable_attributes
30
- attribute_map.values
31
- end
32
-
33
- # Attribute type mapping.
34
- def self.openapi_types
35
- {
36
- :'volume' => :'Volume'
37
- }
38
- end
39
-
40
- # List of attributes with nullable: true
41
- def self.openapi_nullable
42
- Set.new([
43
- ])
44
- end
45
-
46
- # Initializes the object
47
- # @param [Hash] attributes Model attributes in the form of hash
48
- def initialize(attributes = {})
49
- if (!attributes.is_a?(Hash))
50
- fail ArgumentError, "The input argument (attributes) must be a hash in `AutosdeOpenapiClient::VolumeSafeDeleteCreate` initialize method"
51
- end
52
-
53
- # check to see if the attribute exists and convert string to symbol for hash key
54
- attributes = attributes.each_with_object({}) { |(k, v), h|
55
- if (!self.class.attribute_map.key?(k.to_sym))
56
- fail ArgumentError, "`#{k}` is not a valid attribute in `AutosdeOpenapiClient::VolumeSafeDeleteCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
- end
58
- h[k.to_sym] = v
59
- }
60
-
61
- if attributes.key?(:'volume')
62
- self.volume = attributes[:'volume']
63
- end
64
- end
65
-
66
- # Show invalid properties with the reasons. Usually used together with valid?
67
- # @return Array for valid properties with the reasons
68
- def list_invalid_properties
69
- invalid_properties = Array.new
70
- invalid_properties
71
- end
72
-
73
- # Check to see if the all the properties in the model are valid
74
- # @return true if the model is valid
75
- def valid?
76
- true
77
- end
78
-
79
- # Checks equality by comparing each attribute.
80
- # @param [Object] Object to be compared
81
- def ==(o)
82
- return true if self.equal?(o)
83
- self.class == o.class &&
84
- volume == o.volume
85
- end
86
-
87
- # @see the `==` method
88
- # @param [Object] Object to be compared
89
- def eql?(o)
90
- self == o
91
- end
92
-
93
- # Calculates hash code according to all attributes.
94
- # @return [Integer] Hash code
95
- def hash
96
- [volume].hash
97
- end
98
-
99
- # Builds the object from hash
100
- # @param [Hash] attributes Model attributes in the form of hash
101
- # @return [Object] Returns the model itself
102
- def self.build_from_hash(attributes)
103
- new.build_from_hash(attributes)
104
- end
105
-
106
- # Builds the object from hash
107
- # @param [Hash] attributes Model attributes in the form of hash
108
- # @return [Object] Returns the model itself
109
- def build_from_hash(attributes)
110
- return nil unless attributes.is_a?(Hash)
111
- self.class.openapi_types.each_pair do |key, type|
112
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
113
- self.send("#{key}=", nil)
114
- elsif type =~ /\AArray<(.*)>/i
115
- # check to ensure the input is an array given that the attribute
116
- # is documented as an array but the input is not
117
- if attributes[self.class.attribute_map[key]].is_a?(Array)
118
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
- end
120
- elsif !attributes[self.class.attribute_map[key]].nil?
121
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
- end
123
- end
124
-
125
- self
126
- end
127
-
128
- # Deserializes the data based on type
129
- # @param string type Data type
130
- # @param string value Value to be deserialized
131
- # @return [Object] Deserialized data
132
- def _deserialize(type, value)
133
- case type.to_sym
134
- when :Time
135
- Time.parse(value)
136
- when :Date
137
- Date.parse(value)
138
- when :String
139
- value.to_s
140
- when :Integer
141
- value.to_i
142
- when :Float
143
- value.to_f
144
- when :Boolean
145
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
- true
147
- else
148
- false
149
- end
150
- when :Object
151
- # generic object (usually a Hash), return directly
152
- value
153
- when /\AArray<(?<inner_type>.+)>\z/
154
- inner_type = Regexp.last_match[:inner_type]
155
- value.map { |v| _deserialize(inner_type, v) }
156
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
- k_type = Regexp.last_match[:k_type]
158
- v_type = Regexp.last_match[:v_type]
159
- {}.tap do |hash|
160
- value.each do |k, v|
161
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
- end
163
- end
164
- else # model
165
- # models (e.g. Pet) or oneOf
166
- klass = AutosdeOpenapiClient.const_get(type)
167
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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
-
217
- end
218
-
219
- end