ragie_ruby_sdk 1.0.16 → 1.0.18

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 (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -5
  3. data/docs/CodeInterpreterOutput.md +28 -0
  4. data/docs/CodeInterpreterOutputLogs.md +20 -0
  5. data/docs/FileSearchOutput.md +26 -0
  6. data/docs/FileSearchResult.md +26 -0
  7. data/docs/FinalAnswerStepsInner.md +4 -0
  8. data/docs/QueryDetails.md +24 -0
  9. data/docs/Reasoning.md +1 -1
  10. data/docs/ReasoningOutput.md +28 -0
  11. data/docs/ReasoningSummary.md +20 -0
  12. data/docs/ReasoningText.md +20 -0
  13. data/docs/Response.md +4 -4
  14. data/docs/ResponseOutputInner.md +40 -0
  15. data/docs/{ResponseOutput.md → ResponseOutputMessage.md} +2 -2
  16. data/docs/SearchEffort.md +15 -0
  17. data/docs/SearchStep.md +1 -1
  18. data/docs/SearchStepWithQueryDetails.md +28 -0
  19. data/lib/ragie_ruby_sdk/models/code_interpreter_output.rb +389 -0
  20. data/lib/ragie_ruby_sdk/models/code_interpreter_output_logs.rb +283 -0
  21. data/lib/ragie_ruby_sdk/models/file_search_output.rb +368 -0
  22. data/lib/ragie_ruby_sdk/models/file_search_result.rb +348 -0
  23. data/lib/ragie_ruby_sdk/models/final_answer_steps_inner.rb +1 -0
  24. data/lib/ragie_ruby_sdk/models/query_details.rb +341 -0
  25. data/lib/ragie_ruby_sdk/models/reasoning.rb +1 -2
  26. data/lib/ragie_ruby_sdk/models/reasoning_output.rb +391 -0
  27. data/lib/ragie_ruby_sdk/models/reasoning_summary.rb +283 -0
  28. data/lib/ragie_ruby_sdk/models/reasoning_text.rb +283 -0
  29. data/lib/ragie_ruby_sdk/models/response.rb +4 -7
  30. data/lib/ragie_ruby_sdk/models/response_output_inner.rb +105 -0
  31. data/lib/ragie_ruby_sdk/models/{response_output.rb → response_output_message.rb} +3 -3
  32. data/lib/ragie_ruby_sdk/models/search_effort.rb +41 -0
  33. data/lib/ragie_ruby_sdk/models/search_step.rb +3 -3
  34. data/lib/ragie_ruby_sdk/models/search_step_with_query_details.rb +358 -0
  35. data/lib/ragie_ruby_sdk/version.rb +1 -1
  36. data/lib/ragie_ruby_sdk.rb +12 -1
  37. data/spec/models/code_interpreter_output_logs_spec.rb +46 -0
  38. data/spec/models/code_interpreter_output_spec.rb +74 -0
  39. data/spec/models/file_search_output_spec.rb +68 -0
  40. data/spec/models/file_search_result_spec.rb +60 -0
  41. data/spec/models/query_details_spec.rb +54 -0
  42. data/spec/models/reasoning_output_spec.rb +74 -0
  43. data/spec/models/reasoning_summary_spec.rb +46 -0
  44. data/spec/models/reasoning_text_spec.rb +46 -0
  45. data/spec/models/response_output_inner_spec.rb +21 -0
  46. data/spec/models/{response_output_spec.rb → response_output_message_spec.rb} +6 -6
  47. data/spec/models/search_effort_spec.rb +30 -0
  48. data/spec/models/search_step_spec.rb +1 -1
  49. data/spec/models/search_step_with_query_details_spec.rb +70 -0
  50. metadata +49 -5
@@ -0,0 +1,391 @@
1
+ =begin
2
+ #Ragie API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.17.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module RagieRubySdk
17
+ class ReasoningOutput
18
+ # The unique ID of the reasoning output.
19
+ attr_accessor :id
20
+
21
+ # The summary of the reasoning.
22
+ attr_accessor :summary
23
+
24
+ attr_accessor :type
25
+
26
+ # The content of the reasoning.
27
+ attr_accessor :content
28
+
29
+ # The encrypted content of the reasoning output.
30
+ attr_accessor :encrypted_content
31
+
32
+ attr_accessor :status
33
+
34
+ class EnumAttributeValidator
35
+ attr_reader :datatype
36
+ attr_reader :allowable_values
37
+
38
+ def initialize(datatype, allowable_values)
39
+ @allowable_values = allowable_values.map do |value|
40
+ case datatype.to_s
41
+ when /Integer/i
42
+ value.to_i
43
+ when /Float/i
44
+ value.to_f
45
+ else
46
+ value
47
+ end
48
+ end
49
+ end
50
+
51
+ def valid?(value)
52
+ !value || allowable_values.include?(value)
53
+ end
54
+ end
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'id' => :'id',
60
+ :'summary' => :'summary',
61
+ :'type' => :'type',
62
+ :'content' => :'content',
63
+ :'encrypted_content' => :'encrypted_content',
64
+ :'status' => :'status'
65
+ }
66
+ end
67
+
68
+ # Returns attribute mapping this model knows about
69
+ def self.acceptable_attribute_map
70
+ attribute_map
71
+ end
72
+
73
+ # Returns all the JSON keys this model knows about
74
+ def self.acceptable_attributes
75
+ acceptable_attribute_map.values
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.openapi_types
80
+ {
81
+ :'id' => :'String',
82
+ :'summary' => :'Array<ReasoningSummary>',
83
+ :'type' => :'String',
84
+ :'content' => :'Array<ReasoningText>',
85
+ :'encrypted_content' => :'String',
86
+ :'status' => :'String'
87
+ }
88
+ end
89
+
90
+ # List of attributes with nullable: true
91
+ def self.openapi_nullable
92
+ Set.new([
93
+ ])
94
+ end
95
+
96
+ # Initializes the object
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ def initialize(attributes = {})
99
+ if (!attributes.is_a?(Hash))
100
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RagieRubySdk::ReasoningOutput` initialize method"
101
+ end
102
+
103
+ # check to see if the attribute exists and convert string to symbol for hash key
104
+ acceptable_attribute_map = self.class.acceptable_attribute_map
105
+ attributes = attributes.each_with_object({}) { |(k, v), h|
106
+ if (!acceptable_attribute_map.key?(k.to_sym))
107
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RagieRubySdk::ReasoningOutput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
108
+ end
109
+ h[k.to_sym] = v
110
+ }
111
+
112
+ if attributes.key?(:'id')
113
+ self.id = attributes[:'id']
114
+ else
115
+ self.id = nil
116
+ end
117
+
118
+ if attributes.key?(:'summary')
119
+ if (value = attributes[:'summary']).is_a?(Array)
120
+ self.summary = value
121
+ end
122
+ else
123
+ self.summary = nil
124
+ end
125
+
126
+ if attributes.key?(:'type')
127
+ self.type = attributes[:'type']
128
+ else
129
+ self.type = 'reasoning'
130
+ end
131
+
132
+ if attributes.key?(:'content')
133
+ if (value = attributes[:'content']).is_a?(Array)
134
+ self.content = value
135
+ end
136
+ else
137
+ self.content = nil
138
+ end
139
+
140
+ if attributes.key?(:'encrypted_content')
141
+ self.encrypted_content = attributes[:'encrypted_content']
142
+ else
143
+ self.encrypted_content = nil
144
+ end
145
+
146
+ if attributes.key?(:'status')
147
+ self.status = attributes[:'status']
148
+ else
149
+ self.status = 'completed'
150
+ end
151
+ end
152
+
153
+ # Show invalid properties with the reasons. Usually used together with valid?
154
+ # @return Array for valid properties with the reasons
155
+ def list_invalid_properties
156
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
157
+ invalid_properties = Array.new
158
+ if @id.nil?
159
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
160
+ end
161
+
162
+ if @summary.nil?
163
+ invalid_properties.push('invalid value for "summary", summary cannot be nil.')
164
+ end
165
+
166
+ if @content.nil?
167
+ invalid_properties.push('invalid value for "content", content cannot be nil.')
168
+ end
169
+
170
+ if @encrypted_content.nil?
171
+ invalid_properties.push('invalid value for "encrypted_content", encrypted_content cannot be nil.')
172
+ end
173
+
174
+ invalid_properties
175
+ end
176
+
177
+ # Check to see if the all the properties in the model are valid
178
+ # @return true if the model is valid
179
+ def valid?
180
+ warn '[DEPRECATED] the `valid?` method is obsolete'
181
+ return false if @id.nil?
182
+ return false if @summary.nil?
183
+ type_validator = EnumAttributeValidator.new('String', ["reasoning"])
184
+ return false unless type_validator.valid?(@type)
185
+ return false if @content.nil?
186
+ return false if @encrypted_content.nil?
187
+ status_validator = EnumAttributeValidator.new('String', ["in_progress", "completed", "incomplete"])
188
+ return false unless status_validator.valid?(@status)
189
+ true
190
+ end
191
+
192
+ # Custom attribute writer method with validation
193
+ # @param [Object] id Value to be assigned
194
+ def id=(id)
195
+ if id.nil?
196
+ fail ArgumentError, 'id cannot be nil'
197
+ end
198
+
199
+ @id = id
200
+ end
201
+
202
+ # Custom attribute writer method with validation
203
+ # @param [Object] summary Value to be assigned
204
+ def summary=(summary)
205
+ if summary.nil?
206
+ fail ArgumentError, 'summary cannot be nil'
207
+ end
208
+
209
+ @summary = summary
210
+ end
211
+
212
+ # Custom attribute writer method checking allowed values (enum).
213
+ # @param [Object] type Object to be assigned
214
+ def type=(type)
215
+ validator = EnumAttributeValidator.new('String', ["reasoning"])
216
+ unless validator.valid?(type)
217
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
218
+ end
219
+ @type = type
220
+ end
221
+
222
+ # Custom attribute writer method with validation
223
+ # @param [Object] content Value to be assigned
224
+ def content=(content)
225
+ if content.nil?
226
+ fail ArgumentError, 'content cannot be nil'
227
+ end
228
+
229
+ @content = content
230
+ end
231
+
232
+ # Custom attribute writer method with validation
233
+ # @param [Object] encrypted_content Value to be assigned
234
+ def encrypted_content=(encrypted_content)
235
+ if encrypted_content.nil?
236
+ fail ArgumentError, 'encrypted_content cannot be nil'
237
+ end
238
+
239
+ @encrypted_content = encrypted_content
240
+ end
241
+
242
+ # Custom attribute writer method checking allowed values (enum).
243
+ # @param [Object] status Object to be assigned
244
+ def status=(status)
245
+ validator = EnumAttributeValidator.new('String', ["in_progress", "completed", "incomplete"])
246
+ unless validator.valid?(status)
247
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
248
+ end
249
+ @status = status
250
+ end
251
+
252
+ # Checks equality by comparing each attribute.
253
+ # @param [Object] Object to be compared
254
+ def ==(o)
255
+ return true if self.equal?(o)
256
+ self.class == o.class &&
257
+ id == o.id &&
258
+ summary == o.summary &&
259
+ type == o.type &&
260
+ content == o.content &&
261
+ encrypted_content == o.encrypted_content &&
262
+ status == o.status
263
+ end
264
+
265
+ # @see the `==` method
266
+ # @param [Object] Object to be compared
267
+ def eql?(o)
268
+ self == o
269
+ end
270
+
271
+ # Calculates hash code according to all attributes.
272
+ # @return [Integer] Hash code
273
+ def hash
274
+ [id, summary, type, content, encrypted_content, status].hash
275
+ end
276
+
277
+ # Builds the object from hash
278
+ # @param [Hash] attributes Model attributes in the form of hash
279
+ # @return [Object] Returns the model itself
280
+ def self.build_from_hash(attributes)
281
+ return nil unless attributes.is_a?(Hash)
282
+ attributes = attributes.transform_keys(&:to_sym)
283
+ transformed_hash = {}
284
+ openapi_types.each_pair do |key, type|
285
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
286
+ transformed_hash["#{key}"] = nil
287
+ elsif type =~ /\AArray<(.*)>/i
288
+ # check to ensure the input is an array given that the attribute
289
+ # is documented as an array but the input is not
290
+ if attributes[attribute_map[key]].is_a?(Array)
291
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
292
+ end
293
+ elsif !attributes[attribute_map[key]].nil?
294
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
295
+ end
296
+ end
297
+ new(transformed_hash)
298
+ end
299
+
300
+ # Deserializes the data based on type
301
+ # @param string type Data type
302
+ # @param string value Value to be deserialized
303
+ # @return [Object] Deserialized data
304
+ def self._deserialize(type, value)
305
+ case type.to_sym
306
+ when :Time
307
+ Time.parse(value)
308
+ when :Date
309
+ Date.parse(value)
310
+ when :String
311
+ value.to_s
312
+ when :Integer
313
+ value.to_i
314
+ when :Float
315
+ value.to_f
316
+ when :Boolean
317
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
318
+ true
319
+ else
320
+ false
321
+ end
322
+ when :Object
323
+ # generic object (usually a Hash), return directly
324
+ value
325
+ when /\AArray<(?<inner_type>.+)>\z/
326
+ inner_type = Regexp.last_match[:inner_type]
327
+ value.map { |v| _deserialize(inner_type, v) }
328
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
329
+ k_type = Regexp.last_match[:k_type]
330
+ v_type = Regexp.last_match[:v_type]
331
+ {}.tap do |hash|
332
+ value.each do |k, v|
333
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
334
+ end
335
+ end
336
+ else # model
337
+ # models (e.g. Pet) or oneOf
338
+ klass = RagieRubySdk.const_get(type)
339
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
340
+ end
341
+ end
342
+
343
+ # Returns the string representation of the object
344
+ # @return [String] String presentation of the object
345
+ def to_s
346
+ to_hash.to_s
347
+ end
348
+
349
+ # to_body is an alias to to_hash (backward compatibility)
350
+ # @return [Hash] Returns the object in the form of hash
351
+ def to_body
352
+ to_hash
353
+ end
354
+
355
+ # Returns the object in the form of hash
356
+ # @return [Hash] Returns the object in the form of hash
357
+ def to_hash
358
+ hash = {}
359
+ self.class.attribute_map.each_pair do |attr, param|
360
+ value = self.send(attr)
361
+ if value.nil?
362
+ is_nullable = self.class.openapi_nullable.include?(attr)
363
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
364
+ end
365
+
366
+ hash[param] = _to_hash(value)
367
+ end
368
+ hash
369
+ end
370
+
371
+ # Outputs non-array value in the form of hash
372
+ # For object, use to_hash. Otherwise, just return the value
373
+ # @param [Object] value Any valid value
374
+ # @return [Hash] Returns the value in the form of hash
375
+ def _to_hash(value)
376
+ if value.is_a?(Array)
377
+ value.compact.map { |v| _to_hash(v) }
378
+ elsif value.is_a?(Hash)
379
+ {}.tap do |hash|
380
+ value.each { |k, v| hash[k] = _to_hash(v) }
381
+ end
382
+ elsif value.respond_to? :to_hash
383
+ value.to_hash
384
+ else
385
+ value
386
+ end
387
+ end
388
+
389
+ end
390
+
391
+ end
@@ -0,0 +1,283 @@
1
+ =begin
2
+ #Ragie API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.17.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module RagieRubySdk
17
+ class ReasoningSummary
18
+ # The summary of the reasoning.
19
+ attr_accessor :summary
20
+
21
+ attr_accessor :type
22
+
23
+ class EnumAttributeValidator
24
+ attr_reader :datatype
25
+ attr_reader :allowable_values
26
+
27
+ def initialize(datatype, allowable_values)
28
+ @allowable_values = allowable_values.map do |value|
29
+ case datatype.to_s
30
+ when /Integer/i
31
+ value.to_i
32
+ when /Float/i
33
+ value.to_f
34
+ else
35
+ value
36
+ end
37
+ end
38
+ end
39
+
40
+ def valid?(value)
41
+ !value || allowable_values.include?(value)
42
+ end
43
+ end
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'summary' => :'summary',
49
+ :'type' => :'type'
50
+ }
51
+ end
52
+
53
+ # Returns attribute mapping this model knows about
54
+ def self.acceptable_attribute_map
55
+ attribute_map
56
+ end
57
+
58
+ # Returns all the JSON keys this model knows about
59
+ def self.acceptable_attributes
60
+ acceptable_attribute_map.values
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'summary' => :'String',
67
+ :'type' => :'String'
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.openapi_nullable
73
+ Set.new([
74
+ ])
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ if (!attributes.is_a?(Hash))
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RagieRubySdk::ReasoningSummary` initialize method"
82
+ end
83
+
84
+ # check to see if the attribute exists and convert string to symbol for hash key
85
+ acceptable_attribute_map = self.class.acceptable_attribute_map
86
+ attributes = attributes.each_with_object({}) { |(k, v), h|
87
+ if (!acceptable_attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RagieRubySdk::ReasoningSummary`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
89
+ end
90
+ h[k.to_sym] = v
91
+ }
92
+
93
+ if attributes.key?(:'summary')
94
+ self.summary = attributes[:'summary']
95
+ else
96
+ self.summary = nil
97
+ end
98
+
99
+ if attributes.key?(:'type')
100
+ self.type = attributes[:'type']
101
+ else
102
+ self.type = 'summary'
103
+ end
104
+ end
105
+
106
+ # Show invalid properties with the reasons. Usually used together with valid?
107
+ # @return Array for valid properties with the reasons
108
+ def list_invalid_properties
109
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
110
+ invalid_properties = Array.new
111
+ if @summary.nil?
112
+ invalid_properties.push('invalid value for "summary", summary cannot be nil.')
113
+ end
114
+
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ warn '[DEPRECATED] the `valid?` method is obsolete'
122
+ return false if @summary.nil?
123
+ type_validator = EnumAttributeValidator.new('String', ["summary"])
124
+ return false unless type_validator.valid?(@type)
125
+ true
126
+ end
127
+
128
+ # Custom attribute writer method with validation
129
+ # @param [Object] summary Value to be assigned
130
+ def summary=(summary)
131
+ if summary.nil?
132
+ fail ArgumentError, 'summary cannot be nil'
133
+ end
134
+
135
+ @summary = summary
136
+ end
137
+
138
+ # Custom attribute writer method checking allowed values (enum).
139
+ # @param [Object] type Object to be assigned
140
+ def type=(type)
141
+ validator = EnumAttributeValidator.new('String', ["summary"])
142
+ unless validator.valid?(type)
143
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
144
+ end
145
+ @type = type
146
+ end
147
+
148
+ # Checks equality by comparing each attribute.
149
+ # @param [Object] Object to be compared
150
+ def ==(o)
151
+ return true if self.equal?(o)
152
+ self.class == o.class &&
153
+ summary == o.summary &&
154
+ type == o.type
155
+ end
156
+
157
+ # @see the `==` method
158
+ # @param [Object] Object to be compared
159
+ def eql?(o)
160
+ self == o
161
+ end
162
+
163
+ # Calculates hash code according to all attributes.
164
+ # @return [Integer] Hash code
165
+ def hash
166
+ [summary, type].hash
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def self.build_from_hash(attributes)
173
+ return nil unless attributes.is_a?(Hash)
174
+ attributes = attributes.transform_keys(&:to_sym)
175
+ transformed_hash = {}
176
+ openapi_types.each_pair do |key, type|
177
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
178
+ transformed_hash["#{key}"] = nil
179
+ elsif type =~ /\AArray<(.*)>/i
180
+ # check to ensure the input is an array given that the attribute
181
+ # is documented as an array but the input is not
182
+ if attributes[attribute_map[key]].is_a?(Array)
183
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
184
+ end
185
+ elsif !attributes[attribute_map[key]].nil?
186
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
187
+ end
188
+ end
189
+ new(transformed_hash)
190
+ end
191
+
192
+ # Deserializes the data based on type
193
+ # @param string type Data type
194
+ # @param string value Value to be deserialized
195
+ # @return [Object] Deserialized data
196
+ def self._deserialize(type, value)
197
+ case type.to_sym
198
+ when :Time
199
+ Time.parse(value)
200
+ when :Date
201
+ Date.parse(value)
202
+ when :String
203
+ value.to_s
204
+ when :Integer
205
+ value.to_i
206
+ when :Float
207
+ value.to_f
208
+ when :Boolean
209
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
210
+ true
211
+ else
212
+ false
213
+ end
214
+ when :Object
215
+ # generic object (usually a Hash), return directly
216
+ value
217
+ when /\AArray<(?<inner_type>.+)>\z/
218
+ inner_type = Regexp.last_match[:inner_type]
219
+ value.map { |v| _deserialize(inner_type, v) }
220
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
221
+ k_type = Regexp.last_match[:k_type]
222
+ v_type = Regexp.last_match[:v_type]
223
+ {}.tap do |hash|
224
+ value.each do |k, v|
225
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
226
+ end
227
+ end
228
+ else # model
229
+ # models (e.g. Pet) or oneOf
230
+ klass = RagieRubySdk.const_get(type)
231
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
232
+ end
233
+ end
234
+
235
+ # Returns the string representation of the object
236
+ # @return [String] String presentation of the object
237
+ def to_s
238
+ to_hash.to_s
239
+ end
240
+
241
+ # to_body is an alias to to_hash (backward compatibility)
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_body
244
+ to_hash
245
+ end
246
+
247
+ # Returns the object in the form of hash
248
+ # @return [Hash] Returns the object in the form of hash
249
+ def to_hash
250
+ hash = {}
251
+ self.class.attribute_map.each_pair do |attr, param|
252
+ value = self.send(attr)
253
+ if value.nil?
254
+ is_nullable = self.class.openapi_nullable.include?(attr)
255
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
256
+ end
257
+
258
+ hash[param] = _to_hash(value)
259
+ end
260
+ hash
261
+ end
262
+
263
+ # Outputs non-array value in the form of hash
264
+ # For object, use to_hash. Otherwise, just return the value
265
+ # @param [Object] value Any valid value
266
+ # @return [Hash] Returns the value in the form of hash
267
+ def _to_hash(value)
268
+ if value.is_a?(Array)
269
+ value.compact.map { |v| _to_hash(v) }
270
+ elsif value.is_a?(Hash)
271
+ {}.tap do |hash|
272
+ value.each { |k, v| hash[k] = _to_hash(v) }
273
+ end
274
+ elsif value.respond_to? :to_hash
275
+ value.to_hash
276
+ else
277
+ value
278
+ end
279
+ end
280
+
281
+ end
282
+
283
+ end