ragie_ruby_sdk 1.0.15 → 1.0.17

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