hatchet-sdk 0.7.0 → 0.8.1

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.
@@ -1,346 +0,0 @@
1
- =begin
2
- #Hatchet API
3
-
4
- #The Hatchet API
5
-
6
- The version of the OpenAPI document: 1.0.0
7
-
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.14.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module HatchetSdkRest
17
- class V1CreateHTTPOperatorRequest
18
- # The name of the operator.
19
- attr_accessor :name
20
-
21
- # The HTTPS endpoint (https, port 443) that assigned tasks are delivered to.
22
- attr_accessor :trigger_endpoint
23
-
24
- # The HTTPS endpoint polled periodically to discover the actions this operator handles.
25
- attr_accessor :healthcheck_endpoint
26
-
27
- # The secret used to HMAC-sign delivered requests (sent in the X-Hatchet-Signature header). Write-only: it is never returned in responses.
28
- attr_accessor :signing_secret
29
-
30
- # The per-request timeout backstop, in seconds.
31
- attr_accessor :request_timeout_seconds
32
-
33
- # Attribute mapping from ruby-style variable name to JSON key.
34
- def self.attribute_map
35
- {
36
- :'name' => :'name',
37
- :'trigger_endpoint' => :'triggerEndpoint',
38
- :'healthcheck_endpoint' => :'healthcheckEndpoint',
39
- :'signing_secret' => :'signingSecret',
40
- :'request_timeout_seconds' => :'requestTimeoutSeconds'
41
- }
42
- end
43
-
44
- # Returns attribute mapping this model knows about
45
- def self.acceptable_attribute_map
46
- attribute_map
47
- end
48
-
49
- # Returns all the JSON keys this model knows about
50
- def self.acceptable_attributes
51
- acceptable_attribute_map.values
52
- end
53
-
54
- # Attribute type mapping.
55
- def self.openapi_types
56
- {
57
- :'name' => :'String',
58
- :'trigger_endpoint' => :'String',
59
- :'healthcheck_endpoint' => :'String',
60
- :'signing_secret' => :'String',
61
- :'request_timeout_seconds' => :'Integer'
62
- }
63
- end
64
-
65
- # List of attributes with nullable: true
66
- def self.openapi_nullable
67
- Set.new([
68
- ])
69
- end
70
-
71
- # Initializes the object
72
- # @param [Hash] attributes Model attributes in the form of hash
73
- def initialize(attributes = {})
74
- if (!attributes.is_a?(Hash))
75
- fail ArgumentError, "The input argument (attributes) must be a hash in `HatchetSdkRest::V1CreateHTTPOperatorRequest` initialize method"
76
- end
77
-
78
- # check to see if the attribute exists and convert string to symbol for hash key
79
- acceptable_attribute_map = self.class.acceptable_attribute_map
80
- attributes = attributes.each_with_object({}) { |(k, v), h|
81
- if (!acceptable_attribute_map.key?(k.to_sym))
82
- fail ArgumentError, "`#{k}` is not a valid attribute in `HatchetSdkRest::V1CreateHTTPOperatorRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
83
- end
84
- h[k.to_sym] = v
85
- }
86
-
87
- if attributes.key?(:'name')
88
- self.name = attributes[:'name']
89
- else
90
- self.name = nil
91
- end
92
-
93
- if attributes.key?(:'trigger_endpoint')
94
- self.trigger_endpoint = attributes[:'trigger_endpoint']
95
- else
96
- self.trigger_endpoint = nil
97
- end
98
-
99
- if attributes.key?(:'healthcheck_endpoint')
100
- self.healthcheck_endpoint = attributes[:'healthcheck_endpoint']
101
- else
102
- self.healthcheck_endpoint = nil
103
- end
104
-
105
- if attributes.key?(:'signing_secret')
106
- self.signing_secret = attributes[:'signing_secret']
107
- else
108
- self.signing_secret = nil
109
- end
110
-
111
- if attributes.key?(:'request_timeout_seconds')
112
- self.request_timeout_seconds = attributes[:'request_timeout_seconds']
113
- else
114
- self.request_timeout_seconds = nil
115
- end
116
- end
117
-
118
- # Show invalid properties with the reasons. Usually used together with valid?
119
- # @return Array for valid properties with the reasons
120
- def list_invalid_properties
121
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
122
- invalid_properties = Array.new
123
- if @name.nil?
124
- invalid_properties.push('invalid value for "name", name cannot be nil.')
125
- end
126
-
127
- if @trigger_endpoint.nil?
128
- invalid_properties.push('invalid value for "trigger_endpoint", trigger_endpoint cannot be nil.')
129
- end
130
-
131
- if @healthcheck_endpoint.nil?
132
- invalid_properties.push('invalid value for "healthcheck_endpoint", healthcheck_endpoint cannot be nil.')
133
- end
134
-
135
- if @signing_secret.nil?
136
- invalid_properties.push('invalid value for "signing_secret", signing_secret cannot be nil.')
137
- end
138
-
139
- if @request_timeout_seconds.nil?
140
- invalid_properties.push('invalid value for "request_timeout_seconds", request_timeout_seconds cannot be nil.')
141
- end
142
-
143
- invalid_properties
144
- end
145
-
146
- # Check to see if the all the properties in the model are valid
147
- # @return true if the model is valid
148
- def valid?
149
- warn '[DEPRECATED] the `valid?` method is obsolete'
150
- return false if @name.nil?
151
- return false if @trigger_endpoint.nil?
152
- return false if @healthcheck_endpoint.nil?
153
- return false if @signing_secret.nil?
154
- return false if @request_timeout_seconds.nil?
155
- true
156
- end
157
-
158
- # Custom attribute writer method with validation
159
- # @param [Object] name Value to be assigned
160
- def name=(name)
161
- if name.nil?
162
- fail ArgumentError, 'name cannot be nil'
163
- end
164
-
165
- @name = name
166
- end
167
-
168
- # Custom attribute writer method with validation
169
- # @param [Object] trigger_endpoint Value to be assigned
170
- def trigger_endpoint=(trigger_endpoint)
171
- if trigger_endpoint.nil?
172
- fail ArgumentError, 'trigger_endpoint cannot be nil'
173
- end
174
-
175
- @trigger_endpoint = trigger_endpoint
176
- end
177
-
178
- # Custom attribute writer method with validation
179
- # @param [Object] healthcheck_endpoint Value to be assigned
180
- def healthcheck_endpoint=(healthcheck_endpoint)
181
- if healthcheck_endpoint.nil?
182
- fail ArgumentError, 'healthcheck_endpoint cannot be nil'
183
- end
184
-
185
- @healthcheck_endpoint = healthcheck_endpoint
186
- end
187
-
188
- # Custom attribute writer method with validation
189
- # @param [Object] signing_secret Value to be assigned
190
- def signing_secret=(signing_secret)
191
- if signing_secret.nil?
192
- fail ArgumentError, 'signing_secret cannot be nil'
193
- end
194
-
195
- @signing_secret = signing_secret
196
- end
197
-
198
- # Custom attribute writer method with validation
199
- # @param [Object] request_timeout_seconds Value to be assigned
200
- def request_timeout_seconds=(request_timeout_seconds)
201
- if request_timeout_seconds.nil?
202
- fail ArgumentError, 'request_timeout_seconds cannot be nil'
203
- end
204
-
205
- @request_timeout_seconds = request_timeout_seconds
206
- end
207
-
208
- # Checks equality by comparing each attribute.
209
- # @param [Object] Object to be compared
210
- def ==(o)
211
- return true if self.equal?(o)
212
- self.class == o.class &&
213
- name == o.name &&
214
- trigger_endpoint == o.trigger_endpoint &&
215
- healthcheck_endpoint == o.healthcheck_endpoint &&
216
- signing_secret == o.signing_secret &&
217
- request_timeout_seconds == o.request_timeout_seconds
218
- end
219
-
220
- # @see the `==` method
221
- # @param [Object] Object to be compared
222
- def eql?(o)
223
- self == o
224
- end
225
-
226
- # Calculates hash code according to all attributes.
227
- # @return [Integer] Hash code
228
- def hash
229
- [name, trigger_endpoint, healthcheck_endpoint, signing_secret, request_timeout_seconds].hash
230
- end
231
-
232
- # Builds the object from hash
233
- # @param [Hash] attributes Model attributes in the form of hash
234
- # @return [Object] Returns the model itself
235
- def self.build_from_hash(attributes)
236
- return nil unless attributes.is_a?(Hash)
237
- attributes = attributes.transform_keys(&:to_sym)
238
- transformed_hash = {}
239
- openapi_types.each_pair do |key, type|
240
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
241
- transformed_hash["#{key}"] = nil
242
- elsif type =~ /\AArray<(.*)>/i
243
- # check to ensure the input is an array given that the attribute
244
- # is documented as an array but the input is not
245
- if attributes[attribute_map[key]].is_a?(Array)
246
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
247
- end
248
- elsif !attributes[attribute_map[key]].nil?
249
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
250
- end
251
- end
252
- new(transformed_hash)
253
- end
254
-
255
- # Deserializes the data based on type
256
- # @param string type Data type
257
- # @param string value Value to be deserialized
258
- # @return [Object] Deserialized data
259
- def self._deserialize(type, value)
260
- case type.to_sym
261
- when :Time
262
- Time.parse(value)
263
- when :Date
264
- Date.parse(value)
265
- when :String
266
- value.to_s
267
- when :Integer
268
- value.to_i
269
- when :Float
270
- value.to_f
271
- when :Boolean
272
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
273
- true
274
- else
275
- false
276
- end
277
- when :Object
278
- # generic object (usually a Hash), return directly
279
- value
280
- when /\AArray<(?<inner_type>.+)>\z/
281
- inner_type = Regexp.last_match[:inner_type]
282
- value.map { |v| _deserialize(inner_type, v) }
283
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
284
- k_type = Regexp.last_match[:k_type]
285
- v_type = Regexp.last_match[:v_type]
286
- {}.tap do |hash|
287
- value.each do |k, v|
288
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
289
- end
290
- end
291
- else # model
292
- # models (e.g. Pet) or oneOf
293
- klass = HatchetSdkRest.const_get(type)
294
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
295
- end
296
- end
297
-
298
- # Returns the string representation of the object
299
- # @return [String] String presentation of the object
300
- def to_s
301
- to_hash.to_s
302
- end
303
-
304
- # to_body is an alias to to_hash (backward compatibility)
305
- # @return [Hash] Returns the object in the form of hash
306
- def to_body
307
- to_hash
308
- end
309
-
310
- # Returns the object in the form of hash
311
- # @return [Hash] Returns the object in the form of hash
312
- def to_hash
313
- hash = {}
314
- self.class.attribute_map.each_pair do |attr, param|
315
- value = self.send(attr)
316
- if value.nil?
317
- is_nullable = self.class.openapi_nullable.include?(attr)
318
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
319
- end
320
-
321
- hash[param] = _to_hash(value)
322
- end
323
- hash
324
- end
325
-
326
- # Outputs non-array value in the form of hash
327
- # For object, use to_hash. Otherwise, just return the value
328
- # @param [Object] value Any valid value
329
- # @return [Hash] Returns the value in the form of hash
330
- def _to_hash(value)
331
- if value.is_a?(Array)
332
- value.compact.map { |v| _to_hash(v) }
333
- elsif value.is_a?(Hash)
334
- {}.tap do |hash|
335
- value.each { |k, v| hash[k] = _to_hash(v) }
336
- end
337
- elsif value.respond_to? :to_hash
338
- value.to_hash
339
- else
340
- value
341
- end
342
- end
343
-
344
- end
345
-
346
- end
@@ -1,372 +0,0 @@
1
- =begin
2
- #Hatchet API
3
-
4
- #The Hatchet API
5
-
6
- The version of the OpenAPI document: 1.0.0
7
-
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.14.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module HatchetSdkRest
17
- class V1HTTPOperator
18
- attr_accessor :metadata
19
-
20
- # The ID of the tenant associated with this operator.
21
- attr_accessor :tenant_id
22
-
23
- # The name of the operator.
24
- attr_accessor :name
25
-
26
- # The HTTPS endpoint (https, port 443) that assigned tasks are delivered to.
27
- attr_accessor :trigger_endpoint
28
-
29
- # The HTTPS endpoint polled periodically to discover the actions this operator handles.
30
- attr_accessor :healthcheck_endpoint
31
-
32
- # The per-request timeout backstop, in seconds.
33
- attr_accessor :request_timeout_seconds
34
-
35
- # Attribute mapping from ruby-style variable name to JSON key.
36
- def self.attribute_map
37
- {
38
- :'metadata' => :'metadata',
39
- :'tenant_id' => :'tenantId',
40
- :'name' => :'name',
41
- :'trigger_endpoint' => :'triggerEndpoint',
42
- :'healthcheck_endpoint' => :'healthcheckEndpoint',
43
- :'request_timeout_seconds' => :'requestTimeoutSeconds'
44
- }
45
- end
46
-
47
- # Returns attribute mapping this model knows about
48
- def self.acceptable_attribute_map
49
- attribute_map
50
- end
51
-
52
- # Returns all the JSON keys this model knows about
53
- def self.acceptable_attributes
54
- acceptable_attribute_map.values
55
- end
56
-
57
- # Attribute type mapping.
58
- def self.openapi_types
59
- {
60
- :'metadata' => :'APIResourceMeta',
61
- :'tenant_id' => :'String',
62
- :'name' => :'String',
63
- :'trigger_endpoint' => :'String',
64
- :'healthcheck_endpoint' => :'String',
65
- :'request_timeout_seconds' => :'Integer'
66
- }
67
- end
68
-
69
- # List of attributes with nullable: true
70
- def self.openapi_nullable
71
- Set.new([
72
- ])
73
- end
74
-
75
- # Initializes the object
76
- # @param [Hash] attributes Model attributes in the form of hash
77
- def initialize(attributes = {})
78
- if (!attributes.is_a?(Hash))
79
- fail ArgumentError, "The input argument (attributes) must be a hash in `HatchetSdkRest::V1HTTPOperator` initialize method"
80
- end
81
-
82
- # check to see if the attribute exists and convert string to symbol for hash key
83
- acceptable_attribute_map = self.class.acceptable_attribute_map
84
- attributes = attributes.each_with_object({}) { |(k, v), h|
85
- if (!acceptable_attribute_map.key?(k.to_sym))
86
- fail ArgumentError, "`#{k}` is not a valid attribute in `HatchetSdkRest::V1HTTPOperator`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
87
- end
88
- h[k.to_sym] = v
89
- }
90
-
91
- if attributes.key?(:'metadata')
92
- self.metadata = attributes[:'metadata']
93
- else
94
- self.metadata = nil
95
- end
96
-
97
- if attributes.key?(:'tenant_id')
98
- self.tenant_id = attributes[:'tenant_id']
99
- else
100
- self.tenant_id = nil
101
- end
102
-
103
- if attributes.key?(:'name')
104
- self.name = attributes[:'name']
105
- else
106
- self.name = nil
107
- end
108
-
109
- if attributes.key?(:'trigger_endpoint')
110
- self.trigger_endpoint = attributes[:'trigger_endpoint']
111
- else
112
- self.trigger_endpoint = nil
113
- end
114
-
115
- if attributes.key?(:'healthcheck_endpoint')
116
- self.healthcheck_endpoint = attributes[:'healthcheck_endpoint']
117
- else
118
- self.healthcheck_endpoint = nil
119
- end
120
-
121
- if attributes.key?(:'request_timeout_seconds')
122
- self.request_timeout_seconds = attributes[:'request_timeout_seconds']
123
- else
124
- self.request_timeout_seconds = nil
125
- end
126
- end
127
-
128
- # Show invalid properties with the reasons. Usually used together with valid?
129
- # @return Array for valid properties with the reasons
130
- def list_invalid_properties
131
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
132
- invalid_properties = Array.new
133
- if @metadata.nil?
134
- invalid_properties.push('invalid value for "metadata", metadata cannot be nil.')
135
- end
136
-
137
- if @tenant_id.nil?
138
- invalid_properties.push('invalid value for "tenant_id", tenant_id cannot be nil.')
139
- end
140
-
141
- if @name.nil?
142
- invalid_properties.push('invalid value for "name", name cannot be nil.')
143
- end
144
-
145
- if @trigger_endpoint.nil?
146
- invalid_properties.push('invalid value for "trigger_endpoint", trigger_endpoint cannot be nil.')
147
- end
148
-
149
- if @healthcheck_endpoint.nil?
150
- invalid_properties.push('invalid value for "healthcheck_endpoint", healthcheck_endpoint cannot be nil.')
151
- end
152
-
153
- if @request_timeout_seconds.nil?
154
- invalid_properties.push('invalid value for "request_timeout_seconds", request_timeout_seconds cannot be nil.')
155
- end
156
-
157
- invalid_properties
158
- end
159
-
160
- # Check to see if the all the properties in the model are valid
161
- # @return true if the model is valid
162
- def valid?
163
- warn '[DEPRECATED] the `valid?` method is obsolete'
164
- return false if @metadata.nil?
165
- return false if @tenant_id.nil?
166
- return false if @name.nil?
167
- return false if @trigger_endpoint.nil?
168
- return false if @healthcheck_endpoint.nil?
169
- return false if @request_timeout_seconds.nil?
170
- true
171
- end
172
-
173
- # Custom attribute writer method with validation
174
- # @param [Object] metadata Value to be assigned
175
- def metadata=(metadata)
176
- if metadata.nil?
177
- fail ArgumentError, 'metadata cannot be nil'
178
- end
179
-
180
- @metadata = metadata
181
- end
182
-
183
- # Custom attribute writer method with validation
184
- # @param [Object] tenant_id Value to be assigned
185
- def tenant_id=(tenant_id)
186
- if tenant_id.nil?
187
- fail ArgumentError, 'tenant_id cannot be nil'
188
- end
189
-
190
- @tenant_id = tenant_id
191
- end
192
-
193
- # Custom attribute writer method with validation
194
- # @param [Object] name Value to be assigned
195
- def name=(name)
196
- if name.nil?
197
- fail ArgumentError, 'name cannot be nil'
198
- end
199
-
200
- @name = name
201
- end
202
-
203
- # Custom attribute writer method with validation
204
- # @param [Object] trigger_endpoint Value to be assigned
205
- def trigger_endpoint=(trigger_endpoint)
206
- if trigger_endpoint.nil?
207
- fail ArgumentError, 'trigger_endpoint cannot be nil'
208
- end
209
-
210
- @trigger_endpoint = trigger_endpoint
211
- end
212
-
213
- # Custom attribute writer method with validation
214
- # @param [Object] healthcheck_endpoint Value to be assigned
215
- def healthcheck_endpoint=(healthcheck_endpoint)
216
- if healthcheck_endpoint.nil?
217
- fail ArgumentError, 'healthcheck_endpoint cannot be nil'
218
- end
219
-
220
- @healthcheck_endpoint = healthcheck_endpoint
221
- end
222
-
223
- # Custom attribute writer method with validation
224
- # @param [Object] request_timeout_seconds Value to be assigned
225
- def request_timeout_seconds=(request_timeout_seconds)
226
- if request_timeout_seconds.nil?
227
- fail ArgumentError, 'request_timeout_seconds cannot be nil'
228
- end
229
-
230
- @request_timeout_seconds = request_timeout_seconds
231
- end
232
-
233
- # Checks equality by comparing each attribute.
234
- # @param [Object] Object to be compared
235
- def ==(o)
236
- return true if self.equal?(o)
237
- self.class == o.class &&
238
- metadata == o.metadata &&
239
- tenant_id == o.tenant_id &&
240
- name == o.name &&
241
- trigger_endpoint == o.trigger_endpoint &&
242
- healthcheck_endpoint == o.healthcheck_endpoint &&
243
- request_timeout_seconds == o.request_timeout_seconds
244
- end
245
-
246
- # @see the `==` method
247
- # @param [Object] Object to be compared
248
- def eql?(o)
249
- self == o
250
- end
251
-
252
- # Calculates hash code according to all attributes.
253
- # @return [Integer] Hash code
254
- def hash
255
- [metadata, tenant_id, name, trigger_endpoint, healthcheck_endpoint, request_timeout_seconds].hash
256
- end
257
-
258
- # Builds the object from hash
259
- # @param [Hash] attributes Model attributes in the form of hash
260
- # @return [Object] Returns the model itself
261
- def self.build_from_hash(attributes)
262
- return nil unless attributes.is_a?(Hash)
263
- attributes = attributes.transform_keys(&:to_sym)
264
- transformed_hash = {}
265
- openapi_types.each_pair do |key, type|
266
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
267
- transformed_hash["#{key}"] = nil
268
- elsif type =~ /\AArray<(.*)>/i
269
- # check to ensure the input is an array given that the attribute
270
- # is documented as an array but the input is not
271
- if attributes[attribute_map[key]].is_a?(Array)
272
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
273
- end
274
- elsif !attributes[attribute_map[key]].nil?
275
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
276
- end
277
- end
278
- new(transformed_hash)
279
- end
280
-
281
- # Deserializes the data based on type
282
- # @param string type Data type
283
- # @param string value Value to be deserialized
284
- # @return [Object] Deserialized data
285
- def self._deserialize(type, value)
286
- case type.to_sym
287
- when :Time
288
- Time.parse(value)
289
- when :Date
290
- Date.parse(value)
291
- when :String
292
- value.to_s
293
- when :Integer
294
- value.to_i
295
- when :Float
296
- value.to_f
297
- when :Boolean
298
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
299
- true
300
- else
301
- false
302
- end
303
- when :Object
304
- # generic object (usually a Hash), return directly
305
- value
306
- when /\AArray<(?<inner_type>.+)>\z/
307
- inner_type = Regexp.last_match[:inner_type]
308
- value.map { |v| _deserialize(inner_type, v) }
309
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
310
- k_type = Regexp.last_match[:k_type]
311
- v_type = Regexp.last_match[:v_type]
312
- {}.tap do |hash|
313
- value.each do |k, v|
314
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
315
- end
316
- end
317
- else # model
318
- # models (e.g. Pet) or oneOf
319
- klass = HatchetSdkRest.const_get(type)
320
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
321
- end
322
- end
323
-
324
- # Returns the string representation of the object
325
- # @return [String] String presentation of the object
326
- def to_s
327
- to_hash.to_s
328
- end
329
-
330
- # to_body is an alias to to_hash (backward compatibility)
331
- # @return [Hash] Returns the object in the form of hash
332
- def to_body
333
- to_hash
334
- end
335
-
336
- # Returns the object in the form of hash
337
- # @return [Hash] Returns the object in the form of hash
338
- def to_hash
339
- hash = {}
340
- self.class.attribute_map.each_pair do |attr, param|
341
- value = self.send(attr)
342
- if value.nil?
343
- is_nullable = self.class.openapi_nullable.include?(attr)
344
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
345
- end
346
-
347
- hash[param] = _to_hash(value)
348
- end
349
- hash
350
- end
351
-
352
- # Outputs non-array value in the form of hash
353
- # For object, use to_hash. Otherwise, just return the value
354
- # @param [Object] value Any valid value
355
- # @return [Hash] Returns the value in the form of hash
356
- def _to_hash(value)
357
- if value.is_a?(Array)
358
- value.compact.map { |v| _to_hash(v) }
359
- elsif value.is_a?(Hash)
360
- {}.tap do |hash|
361
- value.each { |k, v| hash[k] = _to_hash(v) }
362
- end
363
- elsif value.respond_to? :to_hash
364
- value.to_hash
365
- else
366
- value
367
- end
368
- end
369
-
370
- end
371
-
372
- end