hatchet-sdk 0.10.0 → 0.11.0

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.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/lib/hatchet/clients/grpc/admin.rb +20 -0
  4. data/lib/hatchet/clients/rest/.openapi-generator/FILES +10 -0
  5. data/lib/hatchet/clients/rest/README.md +16 -0
  6. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/serverless_api.rb +405 -0
  7. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/streams_api.rb +80 -0
  8. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/tenant_api.rb +71 -0
  9. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/rate_limit.rb +14 -4
  10. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_entitlements.rb +367 -0
  11. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_serverless_endpoint_request.rb +411 -0
  12. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_serverless_endpoint.rb +556 -0
  13. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_serverless_endpoint_kind.rb +40 -0
  14. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_serverless_endpoint_list.rb +231 -0
  15. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_serverless_endpoint_status.rb +271 -0
  16. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_stream_topic.rb +343 -0
  17. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_stream_topic_list.rb +292 -0
  18. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_update_serverless_endpoint_request.rb +354 -0
  19. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow.rb +14 -4
  20. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest.rb +10 -0
  21. data/lib/hatchet/context.rb +13 -0
  22. data/lib/hatchet/contracts/workflows/workflows_pb.rb +3 -1
  23. data/lib/hatchet/contracts/workflows/workflows_services_pb.rb +1 -0
  24. data/lib/hatchet/features/rate_limits.rb +13 -0
  25. data/lib/hatchet/version.rb +1 -1
  26. data/sig/hatchet/clients/grpc/admin.rbs +1 -0
  27. data/sig/hatchet/context.rbs +1 -0
  28. data/sig/hatchet/features/rate_limits.rbs +1 -0
  29. metadata +12 -2
@@ -0,0 +1,343 @@
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 V1StreamTopic
18
+ # The topic's namespace, empty for the default namespace
19
+ attr_accessor :namespace
20
+
21
+ attr_accessor :topic
22
+
23
+ attr_accessor :created_at
24
+
25
+ attr_accessor :last_published_at
26
+
27
+ # The number of messages within the tenant's retention
28
+ attr_accessor :message_count
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'namespace' => :'namespace',
34
+ :'topic' => :'topic',
35
+ :'created_at' => :'createdAt',
36
+ :'last_published_at' => :'lastPublishedAt',
37
+ :'message_count' => :'messageCount'
38
+ }
39
+ end
40
+
41
+ # Returns attribute mapping this model knows about
42
+ def self.acceptable_attribute_map
43
+ attribute_map
44
+ end
45
+
46
+ # Returns all the JSON keys this model knows about
47
+ def self.acceptable_attributes
48
+ acceptable_attribute_map.values
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.openapi_types
53
+ {
54
+ :'namespace' => :'String',
55
+ :'topic' => :'String',
56
+ :'created_at' => :'Time',
57
+ :'last_published_at' => :'Time',
58
+ :'message_count' => :'Integer'
59
+ }
60
+ end
61
+
62
+ # List of attributes with nullable: true
63
+ def self.openapi_nullable
64
+ Set.new([
65
+ ])
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ if (!attributes.is_a?(Hash))
72
+ fail ArgumentError, "The input argument (attributes) must be a hash in `HatchetSdkRest::V1StreamTopic` initialize method"
73
+ end
74
+
75
+ # check to see if the attribute exists and convert string to symbol for hash key
76
+ acceptable_attribute_map = self.class.acceptable_attribute_map
77
+ attributes = attributes.each_with_object({}) { |(k, v), h|
78
+ if (!acceptable_attribute_map.key?(k.to_sym))
79
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HatchetSdkRest::V1StreamTopic`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
80
+ end
81
+ h[k.to_sym] = v
82
+ }
83
+
84
+ if attributes.key?(:'namespace')
85
+ self.namespace = attributes[:'namespace']
86
+ else
87
+ self.namespace = nil
88
+ end
89
+
90
+ if attributes.key?(:'topic')
91
+ self.topic = attributes[:'topic']
92
+ else
93
+ self.topic = nil
94
+ end
95
+
96
+ if attributes.key?(:'created_at')
97
+ self.created_at = attributes[:'created_at']
98
+ else
99
+ self.created_at = nil
100
+ end
101
+
102
+ if attributes.key?(:'last_published_at')
103
+ self.last_published_at = attributes[:'last_published_at']
104
+ else
105
+ self.last_published_at = nil
106
+ end
107
+
108
+ if attributes.key?(:'message_count')
109
+ self.message_count = attributes[:'message_count']
110
+ else
111
+ self.message_count = nil
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
119
+ invalid_properties = Array.new
120
+ if @namespace.nil?
121
+ invalid_properties.push('invalid value for "namespace", namespace cannot be nil.')
122
+ end
123
+
124
+ if @topic.nil?
125
+ invalid_properties.push('invalid value for "topic", topic cannot be nil.')
126
+ end
127
+
128
+ if @created_at.nil?
129
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
130
+ end
131
+
132
+ if @last_published_at.nil?
133
+ invalid_properties.push('invalid value for "last_published_at", last_published_at cannot be nil.')
134
+ end
135
+
136
+ if @message_count.nil?
137
+ invalid_properties.push('invalid value for "message_count", message_count 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
+ warn '[DEPRECATED] the `valid?` method is obsolete'
147
+ return false if @namespace.nil?
148
+ return false if @topic.nil?
149
+ return false if @created_at.nil?
150
+ return false if @last_published_at.nil?
151
+ return false if @message_count.nil?
152
+ true
153
+ end
154
+
155
+ # Custom attribute writer method with validation
156
+ # @param [Object] namespace Value to be assigned
157
+ def namespace=(namespace)
158
+ if namespace.nil?
159
+ fail ArgumentError, 'namespace cannot be nil'
160
+ end
161
+
162
+ @namespace = namespace
163
+ end
164
+
165
+ # Custom attribute writer method with validation
166
+ # @param [Object] topic Value to be assigned
167
+ def topic=(topic)
168
+ if topic.nil?
169
+ fail ArgumentError, 'topic cannot be nil'
170
+ end
171
+
172
+ @topic = topic
173
+ end
174
+
175
+ # Custom attribute writer method with validation
176
+ # @param [Object] created_at Value to be assigned
177
+ def created_at=(created_at)
178
+ if created_at.nil?
179
+ fail ArgumentError, 'created_at cannot be nil'
180
+ end
181
+
182
+ @created_at = created_at
183
+ end
184
+
185
+ # Custom attribute writer method with validation
186
+ # @param [Object] last_published_at Value to be assigned
187
+ def last_published_at=(last_published_at)
188
+ if last_published_at.nil?
189
+ fail ArgumentError, 'last_published_at cannot be nil'
190
+ end
191
+
192
+ @last_published_at = last_published_at
193
+ end
194
+
195
+ # Custom attribute writer method with validation
196
+ # @param [Object] message_count Value to be assigned
197
+ def message_count=(message_count)
198
+ if message_count.nil?
199
+ fail ArgumentError, 'message_count cannot be nil'
200
+ end
201
+
202
+ @message_count = message_count
203
+ end
204
+
205
+ # Checks equality by comparing each attribute.
206
+ # @param [Object] Object to be compared
207
+ def ==(o)
208
+ return true if self.equal?(o)
209
+ self.class == o.class &&
210
+ namespace == o.namespace &&
211
+ topic == o.topic &&
212
+ created_at == o.created_at &&
213
+ last_published_at == o.last_published_at &&
214
+ message_count == o.message_count
215
+ end
216
+
217
+ # @see the `==` method
218
+ # @param [Object] Object to be compared
219
+ def eql?(o)
220
+ self == o
221
+ end
222
+
223
+ # Calculates hash code according to all attributes.
224
+ # @return [Integer] Hash code
225
+ def hash
226
+ [namespace, topic, created_at, last_published_at, message_count].hash
227
+ end
228
+
229
+ # Builds the object from hash
230
+ # @param [Hash] attributes Model attributes in the form of hash
231
+ # @return [Object] Returns the model itself
232
+ def self.build_from_hash(attributes)
233
+ return nil unless attributes.is_a?(Hash)
234
+ attributes = attributes.transform_keys(&:to_sym)
235
+ transformed_hash = {}
236
+ openapi_types.each_pair do |key, type|
237
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
238
+ transformed_hash["#{key}"] = nil
239
+ elsif type =~ /\AArray<(.*)>/i
240
+ # check to ensure the input is an array given that the attribute
241
+ # is documented as an array but the input is not
242
+ if attributes[attribute_map[key]].is_a?(Array)
243
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
244
+ end
245
+ elsif !attributes[attribute_map[key]].nil?
246
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
247
+ end
248
+ end
249
+ new(transformed_hash)
250
+ end
251
+
252
+ # Deserializes the data based on type
253
+ # @param string type Data type
254
+ # @param string value Value to be deserialized
255
+ # @return [Object] Deserialized data
256
+ def self._deserialize(type, value)
257
+ case type.to_sym
258
+ when :Time
259
+ Time.parse(value)
260
+ when :Date
261
+ Date.parse(value)
262
+ when :String
263
+ value.to_s
264
+ when :Integer
265
+ value.to_i
266
+ when :Float
267
+ value.to_f
268
+ when :Boolean
269
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
270
+ true
271
+ else
272
+ false
273
+ end
274
+ when :Object
275
+ # generic object (usually a Hash), return directly
276
+ value
277
+ when /\AArray<(?<inner_type>.+)>\z/
278
+ inner_type = Regexp.last_match[:inner_type]
279
+ value.map { |v| _deserialize(inner_type, v) }
280
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
281
+ k_type = Regexp.last_match[:k_type]
282
+ v_type = Regexp.last_match[:v_type]
283
+ {}.tap do |hash|
284
+ value.each do |k, v|
285
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
286
+ end
287
+ end
288
+ else # model
289
+ # models (e.g. Pet) or oneOf
290
+ klass = HatchetSdkRest.const_get(type)
291
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
292
+ end
293
+ end
294
+
295
+ # Returns the string representation of the object
296
+ # @return [String] String presentation of the object
297
+ def to_s
298
+ to_hash.to_s
299
+ end
300
+
301
+ # to_body is an alias to to_hash (backward compatibility)
302
+ # @return [Hash] Returns the object in the form of hash
303
+ def to_body
304
+ to_hash
305
+ end
306
+
307
+ # Returns the object in the form of hash
308
+ # @return [Hash] Returns the object in the form of hash
309
+ def to_hash
310
+ hash = {}
311
+ self.class.attribute_map.each_pair do |attr, param|
312
+ value = self.send(attr)
313
+ if value.nil?
314
+ is_nullable = self.class.openapi_nullable.include?(attr)
315
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
316
+ end
317
+
318
+ hash[param] = _to_hash(value)
319
+ end
320
+ hash
321
+ end
322
+
323
+ # Outputs non-array value in the form of hash
324
+ # For object, use to_hash. Otherwise, just return the value
325
+ # @param [Object] value Any valid value
326
+ # @return [Hash] Returns the value in the form of hash
327
+ def _to_hash(value)
328
+ if value.is_a?(Array)
329
+ value.compact.map { |v| _to_hash(v) }
330
+ elsif value.is_a?(Hash)
331
+ {}.tap do |hash|
332
+ value.each { |k, v| hash[k] = _to_hash(v) }
333
+ end
334
+ elsif value.respond_to? :to_hash
335
+ value.to_hash
336
+ else
337
+ value
338
+ end
339
+ end
340
+
341
+ end
342
+
343
+ end
@@ -0,0 +1,292 @@
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 V1StreamTopicList
18
+ attr_accessor :pagination
19
+
20
+ # How long messages are kept, and how long a topic is kept after its last publish
21
+ attr_accessor :retention_hours
22
+
23
+ attr_accessor :rows
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'pagination' => :'pagination',
29
+ :'retention_hours' => :'retentionHours',
30
+ :'rows' => :'rows'
31
+ }
32
+ end
33
+
34
+ # Returns attribute mapping this model knows about
35
+ def self.acceptable_attribute_map
36
+ attribute_map
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ acceptable_attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'pagination' => :'PaginationResponse',
48
+ :'retention_hours' => :'Integer',
49
+ :'rows' => :'Array<V1StreamTopic>'
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 `HatchetSdkRest::V1StreamTopicList` initialize method"
64
+ end
65
+
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ acceptable_attribute_map = self.class.acceptable_attribute_map
68
+ attributes = attributes.each_with_object({}) { |(k, v), h|
69
+ if (!acceptable_attribute_map.key?(k.to_sym))
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HatchetSdkRest::V1StreamTopicList`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
71
+ end
72
+ h[k.to_sym] = v
73
+ }
74
+
75
+ if attributes.key?(:'pagination')
76
+ self.pagination = attributes[:'pagination']
77
+ else
78
+ self.pagination = nil
79
+ end
80
+
81
+ if attributes.key?(:'retention_hours')
82
+ self.retention_hours = attributes[:'retention_hours']
83
+ else
84
+ self.retention_hours = nil
85
+ end
86
+
87
+ if attributes.key?(:'rows')
88
+ if (value = attributes[:'rows']).is_a?(Array)
89
+ self.rows = value
90
+ end
91
+ else
92
+ self.rows = nil
93
+ end
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properties with the reasons
98
+ def list_invalid_properties
99
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
100
+ invalid_properties = Array.new
101
+ if @pagination.nil?
102
+ invalid_properties.push('invalid value for "pagination", pagination cannot be nil.')
103
+ end
104
+
105
+ if @retention_hours.nil?
106
+ invalid_properties.push('invalid value for "retention_hours", retention_hours cannot be nil.')
107
+ end
108
+
109
+ if @rows.nil?
110
+ invalid_properties.push('invalid value for "rows", rows cannot be nil.')
111
+ end
112
+
113
+ invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ warn '[DEPRECATED] the `valid?` method is obsolete'
120
+ return false if @pagination.nil?
121
+ return false if @retention_hours.nil?
122
+ return false if @rows.nil?
123
+ true
124
+ end
125
+
126
+ # Custom attribute writer method with validation
127
+ # @param [Object] pagination Value to be assigned
128
+ def pagination=(pagination)
129
+ if pagination.nil?
130
+ fail ArgumentError, 'pagination cannot be nil'
131
+ end
132
+
133
+ @pagination = pagination
134
+ end
135
+
136
+ # Custom attribute writer method with validation
137
+ # @param [Object] retention_hours Value to be assigned
138
+ def retention_hours=(retention_hours)
139
+ if retention_hours.nil?
140
+ fail ArgumentError, 'retention_hours cannot be nil'
141
+ end
142
+
143
+ @retention_hours = retention_hours
144
+ end
145
+
146
+ # Custom attribute writer method with validation
147
+ # @param [Object] rows Value to be assigned
148
+ def rows=(rows)
149
+ if rows.nil?
150
+ fail ArgumentError, 'rows cannot be nil'
151
+ end
152
+
153
+ @rows = rows
154
+ end
155
+
156
+ # Checks equality by comparing each attribute.
157
+ # @param [Object] Object to be compared
158
+ def ==(o)
159
+ return true if self.equal?(o)
160
+ self.class == o.class &&
161
+ pagination == o.pagination &&
162
+ retention_hours == o.retention_hours &&
163
+ rows == o.rows
164
+ end
165
+
166
+ # @see the `==` method
167
+ # @param [Object] Object to be compared
168
+ def eql?(o)
169
+ self == o
170
+ end
171
+
172
+ # Calculates hash code according to all attributes.
173
+ # @return [Integer] Hash code
174
+ def hash
175
+ [pagination, retention_hours, rows].hash
176
+ end
177
+
178
+ # Builds the object from hash
179
+ # @param [Hash] attributes Model attributes in the form of hash
180
+ # @return [Object] Returns the model itself
181
+ def self.build_from_hash(attributes)
182
+ return nil unless attributes.is_a?(Hash)
183
+ attributes = attributes.transform_keys(&:to_sym)
184
+ transformed_hash = {}
185
+ openapi_types.each_pair do |key, type|
186
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
187
+ transformed_hash["#{key}"] = nil
188
+ elsif type =~ /\AArray<(.*)>/i
189
+ # check to ensure the input is an array given that the attribute
190
+ # is documented as an array but the input is not
191
+ if attributes[attribute_map[key]].is_a?(Array)
192
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
193
+ end
194
+ elsif !attributes[attribute_map[key]].nil?
195
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
196
+ end
197
+ end
198
+ new(transformed_hash)
199
+ end
200
+
201
+ # Deserializes the data based on type
202
+ # @param string type Data type
203
+ # @param string value Value to be deserialized
204
+ # @return [Object] Deserialized data
205
+ def self._deserialize(type, value)
206
+ case type.to_sym
207
+ when :Time
208
+ Time.parse(value)
209
+ when :Date
210
+ Date.parse(value)
211
+ when :String
212
+ value.to_s
213
+ when :Integer
214
+ value.to_i
215
+ when :Float
216
+ value.to_f
217
+ when :Boolean
218
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
219
+ true
220
+ else
221
+ false
222
+ end
223
+ when :Object
224
+ # generic object (usually a Hash), return directly
225
+ value
226
+ when /\AArray<(?<inner_type>.+)>\z/
227
+ inner_type = Regexp.last_match[:inner_type]
228
+ value.map { |v| _deserialize(inner_type, v) }
229
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
230
+ k_type = Regexp.last_match[:k_type]
231
+ v_type = Regexp.last_match[:v_type]
232
+ {}.tap do |hash|
233
+ value.each do |k, v|
234
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
235
+ end
236
+ end
237
+ else # model
238
+ # models (e.g. Pet) or oneOf
239
+ klass = HatchetSdkRest.const_get(type)
240
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
241
+ end
242
+ end
243
+
244
+ # Returns the string representation of the object
245
+ # @return [String] String presentation of the object
246
+ def to_s
247
+ to_hash.to_s
248
+ end
249
+
250
+ # to_body is an alias to to_hash (backward compatibility)
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_body
253
+ to_hash
254
+ end
255
+
256
+ # Returns the object in the form of hash
257
+ # @return [Hash] Returns the object in the form of hash
258
+ def to_hash
259
+ hash = {}
260
+ self.class.attribute_map.each_pair do |attr, param|
261
+ value = self.send(attr)
262
+ if value.nil?
263
+ is_nullable = self.class.openapi_nullable.include?(attr)
264
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
265
+ end
266
+
267
+ hash[param] = _to_hash(value)
268
+ end
269
+ hash
270
+ end
271
+
272
+ # Outputs non-array value in the form of hash
273
+ # For object, use to_hash. Otherwise, just return the value
274
+ # @param [Object] value Any valid value
275
+ # @return [Hash] Returns the value in the form of hash
276
+ def _to_hash(value)
277
+ if value.is_a?(Array)
278
+ value.compact.map { |v| _to_hash(v) }
279
+ elsif value.is_a?(Hash)
280
+ {}.tap do |hash|
281
+ value.each { |k, v| hash[k] = _to_hash(v) }
282
+ end
283
+ elsif value.respond_to? :to_hash
284
+ value.to_hash
285
+ else
286
+ value
287
+ end
288
+ end
289
+
290
+ end
291
+
292
+ end