carbon_ruby_sdk 0.2.38 → 0.2.40

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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +310 -2
  4. data/lib/carbon_ruby_sdk/api/github_api.rb +825 -0
  5. data/lib/carbon_ruby_sdk/models/comments_input.rb +330 -0
  6. data/lib/carbon_ruby_sdk/models/comments_order_by.rb +36 -0
  7. data/lib/carbon_ruby_sdk/models/comments_response.rb +232 -0
  8. data/lib/carbon_ruby_sdk/models/commit.rb +282 -0
  9. data/lib/carbon_ruby_sdk/models/commit_user.rb +234 -0
  10. data/lib/carbon_ruby_sdk/models/commit_user_nullable.rb +234 -0
  11. data/lib/carbon_ruby_sdk/models/commits_input.rb +307 -0
  12. data/lib/carbon_ruby_sdk/models/commits_response.rb +232 -0
  13. data/lib/carbon_ruby_sdk/models/file_status.rb +41 -0
  14. data/lib/carbon_ruby_sdk/models/files_input.rb +307 -0
  15. data/lib/carbon_ruby_sdk/models/files_response.rb +232 -0
  16. data/lib/carbon_ruby_sdk/models/head_or_base.rb +248 -0
  17. data/lib/carbon_ruby_sdk/models/issue.rb +434 -0
  18. data/lib/carbon_ruby_sdk/models/issue_pr.rb +230 -0
  19. data/lib/carbon_ruby_sdk/models/issue_pr_nullable.rb +230 -0
  20. data/lib/carbon_ruby_sdk/models/issues_filter.rb +217 -0
  21. data/lib/carbon_ruby_sdk/models/issues_input.rb +325 -0
  22. data/lib/carbon_ruby_sdk/models/issues_order_by.rb +37 -0
  23. data/lib/carbon_ruby_sdk/models/issues_response.rb +232 -0
  24. data/lib/carbon_ruby_sdk/models/label.rb +234 -0
  25. data/lib/carbon_ruby_sdk/models/organization_user_files_to_sync_filters.rb +29 -1
  26. data/lib/carbon_ruby_sdk/models/pr_comment.rb +358 -0
  27. data/lib/carbon_ruby_sdk/models/pr_commit.rb +264 -0
  28. data/lib/carbon_ruby_sdk/models/pr_file.rb +342 -0
  29. data/lib/carbon_ruby_sdk/models/pr_order_by.rb +37 -0
  30. data/lib/carbon_ruby_sdk/models/pr_state.rb +36 -0
  31. data/lib/carbon_ruby_sdk/models/pr_state_input.rb +37 -0
  32. data/lib/carbon_ruby_sdk/models/pull_request.rb +438 -0
  33. data/lib/carbon_ruby_sdk/models/pull_request_extended.rb +536 -0
  34. data/lib/carbon_ruby_sdk/models/pull_request_filters.rb +239 -0
  35. data/lib/carbon_ruby_sdk/models/pull_request_response.rb +232 -0
  36. data/lib/carbon_ruby_sdk/models/pull_requests_input.rb +325 -0
  37. data/lib/carbon_ruby_sdk/models/sent_webhook_payload.rb +2 -2
  38. data/lib/carbon_ruby_sdk/models/team.rb +234 -0
  39. data/lib/carbon_ruby_sdk/models/tree.rb +234 -0
  40. data/lib/carbon_ruby_sdk/models/user.rb +234 -0
  41. data/lib/carbon_ruby_sdk/models/user_file.rb +11 -1
  42. data/lib/carbon_ruby_sdk/models/user_nullable.rb +234 -0
  43. data/lib/carbon_ruby_sdk/version.rb +1 -1
  44. data/lib/carbon_ruby_sdk.rb +38 -0
  45. data/spec/api/github_api_spec.rb +112 -0
  46. data/spec/models/comments_input_spec.rb +76 -0
  47. data/spec/models/comments_order_by_spec.rb +22 -0
  48. data/spec/models/comments_response_spec.rb +34 -0
  49. data/spec/models/commit_spec.rb +58 -0
  50. data/spec/models/commit_user_nullable_spec.rb +34 -0
  51. data/spec/models/commit_user_spec.rb +34 -0
  52. data/spec/models/commits_input_spec.rb +64 -0
  53. data/spec/models/commits_response_spec.rb +34 -0
  54. data/spec/models/file_status_spec.rb +22 -0
  55. data/spec/models/files_input_spec.rb +64 -0
  56. data/spec/models/files_response_spec.rb +34 -0
  57. data/spec/models/head_or_base_spec.rb +40 -0
  58. data/spec/models/issue_pr_nullable_spec.rb +34 -0
  59. data/spec/models/issue_pr_spec.rb +34 -0
  60. data/spec/models/issue_spec.rb +124 -0
  61. data/spec/models/issues_filter_spec.rb +28 -0
  62. data/spec/models/issues_input_spec.rb +76 -0
  63. data/spec/models/issues_order_by_spec.rb +22 -0
  64. data/spec/models/issues_response_spec.rb +34 -0
  65. data/spec/models/label_spec.rb +34 -0
  66. data/spec/models/organization_user_files_to_sync_filters_spec.rb +6 -0
  67. data/spec/models/pr_comment_spec.rb +94 -0
  68. data/spec/models/pr_commit_spec.rb +52 -0
  69. data/spec/models/pr_file_spec.rb +82 -0
  70. data/spec/models/pr_order_by_spec.rb +22 -0
  71. data/spec/models/pr_state_input_spec.rb +22 -0
  72. data/spec/models/pr_state_spec.rb +22 -0
  73. data/spec/models/pull_request_extended_spec.rb +166 -0
  74. data/spec/models/pull_request_filters_spec.rb +40 -0
  75. data/spec/models/pull_request_response_spec.rb +34 -0
  76. data/spec/models/pull_request_spec.rb +124 -0
  77. data/spec/models/pull_requests_input_spec.rb +76 -0
  78. data/spec/models/sent_webhook_payload_spec.rb +1 -1
  79. data/spec/models/team_spec.rb +34 -0
  80. data/spec/models/tree_spec.rb +34 -0
  81. data/spec/models/user_file_spec.rb +6 -0
  82. data/spec/models/user_nullable_spec.rb +34 -0
  83. data/spec/models/user_spec.rb +34 -0
  84. metadata +301 -193
@@ -0,0 +1,234 @@
1
+ =begin
2
+ #Carbon
3
+
4
+ #Connect external data to LLMs, no matter the source.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ =end
8
+
9
+ require 'date'
10
+ require 'time'
11
+
12
+ module Carbon
13
+ class CommitUserNullable
14
+ attr_accessor :name
15
+
16
+ attr_accessor :email
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :'name' => :'name',
22
+ :'email' => :'email'
23
+ }
24
+ end
25
+
26
+ # Returns all the JSON keys this model knows about
27
+ def self.acceptable_attributes
28
+ attribute_map.values
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'name' => :'String',
35
+ :'email' => :'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 `Carbon::CommitUserNullable` 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 `Carbon::CommitUserNullable`. 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?(:'name')
61
+ self.name = attributes[:'name']
62
+ end
63
+
64
+ if attributes.key?(:'email')
65
+ self.email = attributes[:'email']
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
+ if @name.nil?
74
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
75
+ end
76
+
77
+ if @email.nil?
78
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
79
+ end
80
+
81
+ invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ return false if @name.nil?
88
+ return false if @email.nil?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ name == o.name &&
98
+ email == o.email
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Integer] Hash code
109
+ def hash
110
+ [name, email].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def self.build_from_hash(attributes)
117
+ new.build_from_hash(attributes)
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ attributes = attributes.transform_keys(&:to_sym)
126
+ self.class.openapi_types.each_pair do |key, type|
127
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
128
+ self.send("#{key}=", nil)
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
133
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
137
+ end
138
+ end
139
+
140
+ self
141
+ end
142
+
143
+ # Deserializes the data based on type
144
+ # @param string type Data type
145
+ # @param string value Value to be deserialized
146
+ # @return [Object] Deserialized data
147
+ def _deserialize(type, value)
148
+ case type.to_sym
149
+ when :Time
150
+ Time.parse(value)
151
+ when :Date
152
+ Date.parse(value)
153
+ when :String
154
+ value.to_s
155
+ when :Integer
156
+ value.to_i
157
+ when :Float
158
+ value.to_f
159
+ when :Boolean
160
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
+ true
162
+ else
163
+ false
164
+ end
165
+ when :Object
166
+ # generic object (usually a Hash), return directly
167
+ value
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ # models (e.g. Pet) or oneOf
181
+ klass = Carbon.const_get(type)
182
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map { |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+
232
+ end
233
+
234
+ end
@@ -0,0 +1,307 @@
1
+ =begin
2
+ #Carbon
3
+
4
+ #Connect external data to LLMs, no matter the source.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ =end
8
+
9
+ require 'date'
10
+ require 'time'
11
+
12
+ module Carbon
13
+ class CommitsInput
14
+ attr_accessor :data_source_id
15
+
16
+ attr_accessor :include_remote_data
17
+
18
+ # Full name of the repository, denoted as {owner}/{repo}
19
+ attr_accessor :repository
20
+
21
+ attr_accessor :page
22
+
23
+ attr_accessor :page_size
24
+
25
+ attr_accessor :next_cursor
26
+
27
+ attr_accessor :pull_number
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'data_source_id' => :'data_source_id',
33
+ :'include_remote_data' => :'include_remote_data',
34
+ :'repository' => :'repository',
35
+ :'page' => :'page',
36
+ :'page_size' => :'page_size',
37
+ :'next_cursor' => :'next_cursor',
38
+ :'pull_number' => :'pull_number'
39
+ }
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'data_source_id' => :'Integer',
51
+ :'include_remote_data' => :'Boolean',
52
+ :'repository' => :'String',
53
+ :'page' => :'Integer',
54
+ :'page_size' => :'Integer',
55
+ :'next_cursor' => :'String',
56
+ :'pull_number' => :'Integer'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ :'next_cursor',
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 `Carbon::CommitsInput` 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 `Carbon::CommitsInput`. 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?(:'data_source_id')
83
+ self.data_source_id = attributes[:'data_source_id']
84
+ end
85
+
86
+ if attributes.key?(:'include_remote_data')
87
+ self.include_remote_data = attributes[:'include_remote_data']
88
+ else
89
+ self.include_remote_data = false
90
+ end
91
+
92
+ if attributes.key?(:'repository')
93
+ self.repository = attributes[:'repository']
94
+ end
95
+
96
+ if attributes.key?(:'page')
97
+ self.page = attributes[:'page']
98
+ else
99
+ self.page = 1
100
+ end
101
+
102
+ if attributes.key?(:'page_size')
103
+ self.page_size = attributes[:'page_size']
104
+ else
105
+ self.page_size = 30
106
+ end
107
+
108
+ if attributes.key?(:'next_cursor')
109
+ self.next_cursor = attributes[:'next_cursor']
110
+ end
111
+
112
+ if attributes.key?(:'pull_number')
113
+ self.pull_number = attributes[:'pull_number']
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ invalid_properties = Array.new
121
+ if @data_source_id.nil?
122
+ invalid_properties.push('invalid value for "data_source_id", data_source_id cannot be nil.')
123
+ end
124
+
125
+ if @repository.nil?
126
+ invalid_properties.push('invalid value for "repository", repository cannot be nil.')
127
+ end
128
+
129
+ if !@page_size.nil? && @page_size > 100
130
+ invalid_properties.push('invalid value for "page_size", must be smaller than or equal to 100.')
131
+ end
132
+
133
+ if @pull_number.nil?
134
+ invalid_properties.push('invalid value for "pull_number", pull_number cannot be nil.')
135
+ end
136
+
137
+ invalid_properties
138
+ end
139
+
140
+ # Check to see if the all the properties in the model are valid
141
+ # @return true if the model is valid
142
+ def valid?
143
+ return false if @data_source_id.nil?
144
+ return false if @repository.nil?
145
+ return false if !@page_size.nil? && @page_size > 100
146
+ return false if @pull_number.nil?
147
+ true
148
+ end
149
+
150
+ # Custom attribute writer method with validation
151
+ # @param [Object] page_size Value to be assigned
152
+ def page_size=(page_size)
153
+ if !page_size.nil? && page_size > 100
154
+ fail ArgumentError, 'invalid value for "page_size", must be smaller than or equal to 100.'
155
+ end
156
+
157
+ @page_size = page_size
158
+ end
159
+
160
+ # Checks equality by comparing each attribute.
161
+ # @param [Object] Object to be compared
162
+ def ==(o)
163
+ return true if self.equal?(o)
164
+ self.class == o.class &&
165
+ data_source_id == o.data_source_id &&
166
+ include_remote_data == o.include_remote_data &&
167
+ repository == o.repository &&
168
+ page == o.page &&
169
+ page_size == o.page_size &&
170
+ next_cursor == o.next_cursor &&
171
+ pull_number == o.pull_number
172
+ end
173
+
174
+ # @see the `==` method
175
+ # @param [Object] Object to be compared
176
+ def eql?(o)
177
+ self == o
178
+ end
179
+
180
+ # Calculates hash code according to all attributes.
181
+ # @return [Integer] Hash code
182
+ def hash
183
+ [data_source_id, include_remote_data, repository, page, page_size, next_cursor, pull_number].hash
184
+ end
185
+
186
+ # Builds the object from hash
187
+ # @param [Hash] attributes Model attributes in the form of hash
188
+ # @return [Object] Returns the model itself
189
+ def self.build_from_hash(attributes)
190
+ new.build_from_hash(attributes)
191
+ end
192
+
193
+ # Builds the object from hash
194
+ # @param [Hash] attributes Model attributes in the form of hash
195
+ # @return [Object] Returns the model itself
196
+ def build_from_hash(attributes)
197
+ return nil unless attributes.is_a?(Hash)
198
+ attributes = attributes.transform_keys(&:to_sym)
199
+ self.class.openapi_types.each_pair do |key, type|
200
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
201
+ self.send("#{key}=", nil)
202
+ elsif type =~ /\AArray<(.*)>/i
203
+ # check to ensure the input is an array given that the attribute
204
+ # is documented as an array but the input is not
205
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
206
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
207
+ end
208
+ elsif !attributes[self.class.attribute_map[key]].nil?
209
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
210
+ end
211
+ end
212
+
213
+ self
214
+ end
215
+
216
+ # Deserializes the data based on type
217
+ # @param string type Data type
218
+ # @param string value Value to be deserialized
219
+ # @return [Object] Deserialized data
220
+ def _deserialize(type, value)
221
+ case type.to_sym
222
+ when :Time
223
+ Time.parse(value)
224
+ when :Date
225
+ Date.parse(value)
226
+ when :String
227
+ value.to_s
228
+ when :Integer
229
+ value.to_i
230
+ when :Float
231
+ value.to_f
232
+ when :Boolean
233
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
234
+ true
235
+ else
236
+ false
237
+ end
238
+ when :Object
239
+ # generic object (usually a Hash), return directly
240
+ value
241
+ when /\AArray<(?<inner_type>.+)>\z/
242
+ inner_type = Regexp.last_match[:inner_type]
243
+ value.map { |v| _deserialize(inner_type, v) }
244
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
245
+ k_type = Regexp.last_match[:k_type]
246
+ v_type = Regexp.last_match[:v_type]
247
+ {}.tap do |hash|
248
+ value.each do |k, v|
249
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
250
+ end
251
+ end
252
+ else # model
253
+ # models (e.g. Pet) or oneOf
254
+ klass = Carbon.const_get(type)
255
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
256
+ end
257
+ end
258
+
259
+ # Returns the string representation of the object
260
+ # @return [String] String presentation of the object
261
+ def to_s
262
+ to_hash.to_s
263
+ end
264
+
265
+ # to_body is an alias to to_hash (backward compatibility)
266
+ # @return [Hash] Returns the object in the form of hash
267
+ def to_body
268
+ to_hash
269
+ end
270
+
271
+ # Returns the object in the form of hash
272
+ # @return [Hash] Returns the object in the form of hash
273
+ def to_hash
274
+ hash = {}
275
+ self.class.attribute_map.each_pair do |attr, param|
276
+ value = self.send(attr)
277
+ if value.nil?
278
+ is_nullable = self.class.openapi_nullable.include?(attr)
279
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
280
+ end
281
+
282
+ hash[param] = _to_hash(value)
283
+ end
284
+ hash
285
+ end
286
+
287
+ # Outputs non-array value in the form of hash
288
+ # For object, use to_hash. Otherwise, just return the value
289
+ # @param [Object] value Any valid value
290
+ # @return [Hash] Returns the value in the form of hash
291
+ def _to_hash(value)
292
+ if value.is_a?(Array)
293
+ value.compact.map { |v| _to_hash(v) }
294
+ elsif value.is_a?(Hash)
295
+ {}.tap do |hash|
296
+ value.each { |k, v| hash[k] = _to_hash(v) }
297
+ end
298
+ elsif value.respond_to? :to_hash
299
+ value.to_hash
300
+ else
301
+ value
302
+ end
303
+ end
304
+
305
+ end
306
+
307
+ end