ragie_ruby_sdk 1.0.12 → 1.0.14

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 (86) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -4
  3. data/docs/AgentHoppsModelsModelsUsage.md +18 -0
  4. data/docs/Answer.md +20 -0
  5. data/docs/AnswerStep.md +26 -0
  6. data/docs/CodeInterpreterEvidence.md +26 -0
  7. data/docs/CodeStep.md +28 -0
  8. data/docs/EvaluatedAnswerStep.md +30 -0
  9. data/docs/FinalAnswer.md +24 -0
  10. data/docs/FinalAnswerEvidenceInner.md +40 -0
  11. data/docs/FinalAnswerStepsInner.md +42 -0
  12. data/docs/InputTokenDetails.md +18 -0
  13. data/docs/IntercomData.md +3 -1
  14. data/docs/ModelUsage.md +22 -0
  15. data/docs/OutputTokenDetails.md +18 -0
  16. data/docs/PlanStep.md +24 -0
  17. data/docs/RagieApiSchemaResponseUsage.md +26 -0
  18. data/docs/RagieEvidence.md +34 -0
  19. data/docs/Reasoning.md +20 -0
  20. data/docs/Request.md +28 -0
  21. data/docs/Response.md +62 -0
  22. data/docs/ResponseContent.md +22 -0
  23. data/docs/ResponseOutput.md +24 -0
  24. data/docs/ResponsesApi.md +147 -0
  25. data/docs/Search.md +18 -0
  26. data/docs/SearchResultLink.md +20 -0
  27. data/docs/SearchStep.md +24 -0
  28. data/docs/SurrenderStep.md +24 -0
  29. data/docs/Tool.md +20 -0
  30. data/lib/ragie_ruby_sdk/api/responses_api.rb +153 -0
  31. data/lib/ragie_ruby_sdk/models/agent_hopps_models_models_usage.rb +222 -0
  32. data/lib/ragie_ruby_sdk/models/answer.rb +250 -0
  33. data/lib/ragie_ruby_sdk/models/answer_step.rb +346 -0
  34. data/lib/ragie_ruby_sdk/models/code_interpreter_evidence.rb +363 -0
  35. data/lib/ragie_ruby_sdk/models/code_step.rb +359 -0
  36. data/lib/ragie_ruby_sdk/models/evaluated_answer_step.rb +398 -0
  37. data/lib/ragie_ruby_sdk/models/final_answer.rb +272 -0
  38. data/lib/ragie_ruby_sdk/models/final_answer_evidence_inner.rb +103 -0
  39. data/lib/ragie_ruby_sdk/models/final_answer_steps_inner.rb +107 -0
  40. data/lib/ragie_ruby_sdk/models/input_token_details.rb +222 -0
  41. data/lib/ragie_ruby_sdk/models/intercom_data.rb +14 -4
  42. data/lib/ragie_ruby_sdk/models/model_usage.rb +289 -0
  43. data/lib/ragie_ruby_sdk/models/output_token_details.rb +222 -0
  44. data/lib/ragie_ruby_sdk/models/plan_step.rb +320 -0
  45. data/lib/ragie_ruby_sdk/models/ragie_api_schema_response_usage.rb +307 -0
  46. data/lib/ragie_ruby_sdk/models/ragie_evidence.rb +426 -0
  47. data/lib/ragie_ruby_sdk/models/reasoning.rb +271 -0
  48. data/lib/ragie_ruby_sdk/models/request.rb +328 -0
  49. data/lib/ragie_ruby_sdk/models/response.rb +638 -0
  50. data/lib/ragie_ruby_sdk/models/response_content.rb +293 -0
  51. data/lib/ragie_ruby_sdk/models/response_output.rb +333 -0
  52. data/lib/ragie_ruby_sdk/models/search.rb +239 -0
  53. data/lib/ragie_ruby_sdk/models/search_result_link.rb +263 -0
  54. data/lib/ragie_ruby_sdk/models/search_step.rb +335 -0
  55. data/lib/ragie_ruby_sdk/models/surrender_step.rb +335 -0
  56. data/lib/ragie_ruby_sdk/models/tool.rb +289 -0
  57. data/lib/ragie_ruby_sdk/version.rb +1 -1
  58. data/lib/ragie_ruby_sdk.rb +26 -0
  59. data/spec/api/responses_api_spec.rb +59 -0
  60. data/spec/models/agent_hopps_models_models_usage_spec.rb +36 -0
  61. data/spec/models/answer_spec.rb +42 -0
  62. data/spec/models/answer_step_spec.rb +64 -0
  63. data/spec/models/code_interpreter_evidence_spec.rb +64 -0
  64. data/spec/models/code_step_spec.rb +70 -0
  65. data/spec/models/evaluated_answer_step_spec.rb +76 -0
  66. data/spec/models/final_answer_evidence_inner_spec.rb +21 -0
  67. data/spec/models/final_answer_spec.rb +54 -0
  68. data/spec/models/final_answer_steps_inner_spec.rb +21 -0
  69. data/spec/models/input_token_details_spec.rb +36 -0
  70. data/spec/models/intercom_data_spec.rb +6 -0
  71. data/spec/models/model_usage_spec.rb +48 -0
  72. data/spec/models/output_token_details_spec.rb +36 -0
  73. data/spec/models/plan_step_spec.rb +58 -0
  74. data/spec/models/ragie_api_schema_response_usage_spec.rb +60 -0
  75. data/spec/models/ragie_evidence_spec.rb +88 -0
  76. data/spec/models/reasoning_spec.rb +46 -0
  77. data/spec/models/request_spec.rb +70 -0
  78. data/spec/models/response_content_spec.rb +52 -0
  79. data/spec/models/response_output_spec.rb +62 -0
  80. data/spec/models/response_spec.rb +188 -0
  81. data/spec/models/search_result_link_spec.rb +42 -0
  82. data/spec/models/search_spec.rb +36 -0
  83. data/spec/models/search_step_spec.rb +58 -0
  84. data/spec/models/surrender_step_spec.rb +58 -0
  85. data/spec/models/tool_spec.rb +46 -0
  86. metadata +105 -1
@@ -0,0 +1,398 @@
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.16.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module RagieRubySdk
17
+ class EvaluatedAnswerStep
18
+ attr_accessor :type
19
+
20
+ attr_accessor :think
21
+
22
+ attr_accessor :current_question
23
+
24
+ attr_accessor :answer
25
+
26
+ # A list of questions ids that are no longer relevant to the current answer referenced by their IDs.
27
+ attr_accessor :other_resolved_question_ids
28
+
29
+ attr_accessor :eval_passed
30
+
31
+ attr_accessor :eval_reason
32
+
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'type' => :'type',
59
+ :'think' => :'think',
60
+ :'current_question' => :'current_question',
61
+ :'answer' => :'answer',
62
+ :'other_resolved_question_ids' => :'other_resolved_question_ids',
63
+ :'eval_passed' => :'eval_passed',
64
+ :'eval_reason' => :'eval_reason'
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
+ :'type' => :'String',
82
+ :'think' => :'String',
83
+ :'current_question' => :'String',
84
+ :'answer' => :'Answer',
85
+ :'other_resolved_question_ids' => :'Array<String>',
86
+ :'eval_passed' => :'Boolean',
87
+ :'eval_reason' => :'String'
88
+ }
89
+ end
90
+
91
+ # List of attributes with nullable: true
92
+ def self.openapi_nullable
93
+ Set.new([
94
+ ])
95
+ end
96
+
97
+ # Initializes the object
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ def initialize(attributes = {})
100
+ if (!attributes.is_a?(Hash))
101
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RagieRubySdk::EvaluatedAnswerStep` initialize method"
102
+ end
103
+
104
+ # check to see if the attribute exists and convert string to symbol for hash key
105
+ acceptable_attribute_map = self.class.acceptable_attribute_map
106
+ attributes = attributes.each_with_object({}) { |(k, v), h|
107
+ if (!acceptable_attribute_map.key?(k.to_sym))
108
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RagieRubySdk::EvaluatedAnswerStep`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
109
+ end
110
+ h[k.to_sym] = v
111
+ }
112
+
113
+ if attributes.key?(:'type')
114
+ self.type = attributes[:'type']
115
+ else
116
+ self.type = 'evaluated_answer'
117
+ end
118
+
119
+ if attributes.key?(:'think')
120
+ self.think = attributes[:'think']
121
+ else
122
+ self.think = nil
123
+ end
124
+
125
+ if attributes.key?(:'current_question')
126
+ self.current_question = attributes[:'current_question']
127
+ else
128
+ self.current_question = nil
129
+ end
130
+
131
+ if attributes.key?(:'answer')
132
+ self.answer = attributes[:'answer']
133
+ else
134
+ self.answer = nil
135
+ end
136
+
137
+ if attributes.key?(:'other_resolved_question_ids')
138
+ if (value = attributes[:'other_resolved_question_ids']).is_a?(Array)
139
+ self.other_resolved_question_ids = value
140
+ end
141
+ end
142
+
143
+ if attributes.key?(:'eval_passed')
144
+ self.eval_passed = attributes[:'eval_passed']
145
+ else
146
+ self.eval_passed = nil
147
+ end
148
+
149
+ if attributes.key?(:'eval_reason')
150
+ self.eval_reason = attributes[:'eval_reason']
151
+ else
152
+ self.eval_reason = nil
153
+ end
154
+ end
155
+
156
+ # Show invalid properties with the reasons. Usually used together with valid?
157
+ # @return Array for valid properties with the reasons
158
+ def list_invalid_properties
159
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
160
+ invalid_properties = Array.new
161
+ if @think.nil?
162
+ invalid_properties.push('invalid value for "think", think cannot be nil.')
163
+ end
164
+
165
+ if @current_question.nil?
166
+ invalid_properties.push('invalid value for "current_question", current_question cannot be nil.')
167
+ end
168
+
169
+ if @answer.nil?
170
+ invalid_properties.push('invalid value for "answer", answer cannot be nil.')
171
+ end
172
+
173
+ if @eval_passed.nil?
174
+ invalid_properties.push('invalid value for "eval_passed", eval_passed cannot be nil.')
175
+ end
176
+
177
+ if @eval_reason.nil?
178
+ invalid_properties.push('invalid value for "eval_reason", eval_reason cannot be nil.')
179
+ end
180
+
181
+ invalid_properties
182
+ end
183
+
184
+ # Check to see if the all the properties in the model are valid
185
+ # @return true if the model is valid
186
+ def valid?
187
+ warn '[DEPRECATED] the `valid?` method is obsolete'
188
+ type_validator = EnumAttributeValidator.new('String', ["evaluated_answer"])
189
+ return false unless type_validator.valid?(@type)
190
+ return false if @think.nil?
191
+ return false if @current_question.nil?
192
+ return false if @answer.nil?
193
+ return false if @eval_passed.nil?
194
+ return false if @eval_reason.nil?
195
+ true
196
+ end
197
+
198
+ # Custom attribute writer method checking allowed values (enum).
199
+ # @param [Object] type Object to be assigned
200
+ def type=(type)
201
+ validator = EnumAttributeValidator.new('String', ["evaluated_answer"])
202
+ unless validator.valid?(type)
203
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
204
+ end
205
+ @type = type
206
+ end
207
+
208
+ # Custom attribute writer method with validation
209
+ # @param [Object] think Value to be assigned
210
+ def think=(think)
211
+ if think.nil?
212
+ fail ArgumentError, 'think cannot be nil'
213
+ end
214
+
215
+ @think = think
216
+ end
217
+
218
+ # Custom attribute writer method with validation
219
+ # @param [Object] current_question Value to be assigned
220
+ def current_question=(current_question)
221
+ if current_question.nil?
222
+ fail ArgumentError, 'current_question cannot be nil'
223
+ end
224
+
225
+ @current_question = current_question
226
+ end
227
+
228
+ # Custom attribute writer method with validation
229
+ # @param [Object] answer Value to be assigned
230
+ def answer=(answer)
231
+ if answer.nil?
232
+ fail ArgumentError, 'answer cannot be nil'
233
+ end
234
+
235
+ @answer = answer
236
+ end
237
+
238
+ # Custom attribute writer method with validation
239
+ # @param [Object] eval_passed Value to be assigned
240
+ def eval_passed=(eval_passed)
241
+ if eval_passed.nil?
242
+ fail ArgumentError, 'eval_passed cannot be nil'
243
+ end
244
+
245
+ @eval_passed = eval_passed
246
+ end
247
+
248
+ # Custom attribute writer method with validation
249
+ # @param [Object] eval_reason Value to be assigned
250
+ def eval_reason=(eval_reason)
251
+ if eval_reason.nil?
252
+ fail ArgumentError, 'eval_reason cannot be nil'
253
+ end
254
+
255
+ @eval_reason = eval_reason
256
+ end
257
+
258
+ # Checks equality by comparing each attribute.
259
+ # @param [Object] Object to be compared
260
+ def ==(o)
261
+ return true if self.equal?(o)
262
+ self.class == o.class &&
263
+ type == o.type &&
264
+ think == o.think &&
265
+ current_question == o.current_question &&
266
+ answer == o.answer &&
267
+ other_resolved_question_ids == o.other_resolved_question_ids &&
268
+ eval_passed == o.eval_passed &&
269
+ eval_reason == o.eval_reason
270
+ end
271
+
272
+ # @see the `==` method
273
+ # @param [Object] Object to be compared
274
+ def eql?(o)
275
+ self == o
276
+ end
277
+
278
+ # Calculates hash code according to all attributes.
279
+ # @return [Integer] Hash code
280
+ def hash
281
+ [type, think, current_question, answer, other_resolved_question_ids, eval_passed, eval_reason].hash
282
+ end
283
+
284
+ # Builds the object from hash
285
+ # @param [Hash] attributes Model attributes in the form of hash
286
+ # @return [Object] Returns the model itself
287
+ def self.build_from_hash(attributes)
288
+ return nil unless attributes.is_a?(Hash)
289
+ attributes = attributes.transform_keys(&:to_sym)
290
+ transformed_hash = {}
291
+ openapi_types.each_pair do |key, type|
292
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
293
+ transformed_hash["#{key}"] = nil
294
+ elsif type =~ /\AArray<(.*)>/i
295
+ # check to ensure the input is an array given that the attribute
296
+ # is documented as an array but the input is not
297
+ if attributes[attribute_map[key]].is_a?(Array)
298
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
299
+ end
300
+ elsif !attributes[attribute_map[key]].nil?
301
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
302
+ end
303
+ end
304
+ new(transformed_hash)
305
+ end
306
+
307
+ # Deserializes the data based on type
308
+ # @param string type Data type
309
+ # @param string value Value to be deserialized
310
+ # @return [Object] Deserialized data
311
+ def self._deserialize(type, value)
312
+ case type.to_sym
313
+ when :Time
314
+ Time.parse(value)
315
+ when :Date
316
+ Date.parse(value)
317
+ when :String
318
+ value.to_s
319
+ when :Integer
320
+ value.to_i
321
+ when :Float
322
+ value.to_f
323
+ when :Boolean
324
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
325
+ true
326
+ else
327
+ false
328
+ end
329
+ when :Object
330
+ # generic object (usually a Hash), return directly
331
+ value
332
+ when /\AArray<(?<inner_type>.+)>\z/
333
+ inner_type = Regexp.last_match[:inner_type]
334
+ value.map { |v| _deserialize(inner_type, v) }
335
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
336
+ k_type = Regexp.last_match[:k_type]
337
+ v_type = Regexp.last_match[:v_type]
338
+ {}.tap do |hash|
339
+ value.each do |k, v|
340
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
341
+ end
342
+ end
343
+ else # model
344
+ # models (e.g. Pet) or oneOf
345
+ klass = RagieRubySdk.const_get(type)
346
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
347
+ end
348
+ end
349
+
350
+ # Returns the string representation of the object
351
+ # @return [String] String presentation of the object
352
+ def to_s
353
+ to_hash.to_s
354
+ end
355
+
356
+ # to_body is an alias to to_hash (backward compatibility)
357
+ # @return [Hash] Returns the object in the form of hash
358
+ def to_body
359
+ to_hash
360
+ end
361
+
362
+ # Returns the object in the form of hash
363
+ # @return [Hash] Returns the object in the form of hash
364
+ def to_hash
365
+ hash = {}
366
+ self.class.attribute_map.each_pair do |attr, param|
367
+ value = self.send(attr)
368
+ if value.nil?
369
+ is_nullable = self.class.openapi_nullable.include?(attr)
370
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
371
+ end
372
+
373
+ hash[param] = _to_hash(value)
374
+ end
375
+ hash
376
+ end
377
+
378
+ # Outputs non-array value in the form of hash
379
+ # For object, use to_hash. Otherwise, just return the value
380
+ # @param [Object] value Any valid value
381
+ # @return [Hash] Returns the value in the form of hash
382
+ def _to_hash(value)
383
+ if value.is_a?(Array)
384
+ value.compact.map { |v| _to_hash(v) }
385
+ elsif value.is_a?(Hash)
386
+ {}.tap do |hash|
387
+ value.each { |k, v| hash[k] = _to_hash(v) }
388
+ end
389
+ elsif value.respond_to? :to_hash
390
+ value.to_hash
391
+ else
392
+ value
393
+ end
394
+ end
395
+
396
+ end
397
+
398
+ end
@@ -0,0 +1,272 @@
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.16.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module RagieRubySdk
17
+ class FinalAnswer
18
+ # The final answer to the question.
19
+ attr_accessor :text
20
+
21
+ # The evidence used to derive the answer.
22
+ attr_accessor :evidence
23
+
24
+ # The steps that led to the answer.
25
+ attr_accessor :steps
26
+
27
+ # The usage of the models.
28
+ attr_accessor :usage
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'text' => :'text',
34
+ :'evidence' => :'evidence',
35
+ :'steps' => :'steps',
36
+ :'usage' => :'usage'
37
+ }
38
+ end
39
+
40
+ # Returns attribute mapping this model knows about
41
+ def self.acceptable_attribute_map
42
+ attribute_map
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ acceptable_attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'text' => :'String',
54
+ :'evidence' => :'Array<FinalAnswerEvidenceInner>',
55
+ :'steps' => :'Array<FinalAnswerStepsInner>',
56
+ :'usage' => :'AgentHoppsModelsModelsUsage'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RagieRubySdk::FinalAnswer` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RagieRubySdk::FinalAnswer`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'text')
83
+ self.text = attributes[:'text']
84
+ else
85
+ self.text = nil
86
+ end
87
+
88
+ if attributes.key?(:'evidence')
89
+ if (value = attributes[:'evidence']).is_a?(Array)
90
+ self.evidence = value
91
+ end
92
+ end
93
+
94
+ if attributes.key?(:'steps')
95
+ if (value = attributes[:'steps']).is_a?(Array)
96
+ self.steps = value
97
+ end
98
+ end
99
+
100
+ if attributes.key?(:'usage')
101
+ self.usage = attributes[:'usage']
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
109
+ invalid_properties = Array.new
110
+ if @text.nil?
111
+ invalid_properties.push('invalid value for "text", text cannot be nil.')
112
+ end
113
+
114
+ invalid_properties
115
+ end
116
+
117
+ # Check to see if the all the properties in the model are valid
118
+ # @return true if the model is valid
119
+ def valid?
120
+ warn '[DEPRECATED] the `valid?` method is obsolete'
121
+ return false if @text.nil?
122
+ true
123
+ end
124
+
125
+ # Custom attribute writer method with validation
126
+ # @param [Object] text Value to be assigned
127
+ def text=(text)
128
+ if text.nil?
129
+ fail ArgumentError, 'text cannot be nil'
130
+ end
131
+
132
+ @text = text
133
+ end
134
+
135
+ # Checks equality by comparing each attribute.
136
+ # @param [Object] Object to be compared
137
+ def ==(o)
138
+ return true if self.equal?(o)
139
+ self.class == o.class &&
140
+ text == o.text &&
141
+ evidence == o.evidence &&
142
+ steps == o.steps &&
143
+ usage == o.usage
144
+ end
145
+
146
+ # @see the `==` method
147
+ # @param [Object] Object to be compared
148
+ def eql?(o)
149
+ self == o
150
+ end
151
+
152
+ # Calculates hash code according to all attributes.
153
+ # @return [Integer] Hash code
154
+ def hash
155
+ [text, evidence, steps, usage].hash
156
+ end
157
+
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def self.build_from_hash(attributes)
162
+ return nil unless attributes.is_a?(Hash)
163
+ attributes = attributes.transform_keys(&:to_sym)
164
+ transformed_hash = {}
165
+ openapi_types.each_pair do |key, type|
166
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
167
+ transformed_hash["#{key}"] = nil
168
+ elsif type =~ /\AArray<(.*)>/i
169
+ # check to ensure the input is an array given that the attribute
170
+ # is documented as an array but the input is not
171
+ if attributes[attribute_map[key]].is_a?(Array)
172
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
173
+ end
174
+ elsif !attributes[attribute_map[key]].nil?
175
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
176
+ end
177
+ end
178
+ new(transformed_hash)
179
+ end
180
+
181
+ # Deserializes the data based on type
182
+ # @param string type Data type
183
+ # @param string value Value to be deserialized
184
+ # @return [Object] Deserialized data
185
+ def self._deserialize(type, value)
186
+ case type.to_sym
187
+ when :Time
188
+ Time.parse(value)
189
+ when :Date
190
+ Date.parse(value)
191
+ when :String
192
+ value.to_s
193
+ when :Integer
194
+ value.to_i
195
+ when :Float
196
+ value.to_f
197
+ when :Boolean
198
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
199
+ true
200
+ else
201
+ false
202
+ end
203
+ when :Object
204
+ # generic object (usually a Hash), return directly
205
+ value
206
+ when /\AArray<(?<inner_type>.+)>\z/
207
+ inner_type = Regexp.last_match[:inner_type]
208
+ value.map { |v| _deserialize(inner_type, v) }
209
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
210
+ k_type = Regexp.last_match[:k_type]
211
+ v_type = Regexp.last_match[:v_type]
212
+ {}.tap do |hash|
213
+ value.each do |k, v|
214
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
215
+ end
216
+ end
217
+ else # model
218
+ # models (e.g. Pet) or oneOf
219
+ klass = RagieRubySdk.const_get(type)
220
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
221
+ end
222
+ end
223
+
224
+ # Returns the string representation of the object
225
+ # @return [String] String presentation of the object
226
+ def to_s
227
+ to_hash.to_s
228
+ end
229
+
230
+ # to_body is an alias to to_hash (backward compatibility)
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_body
233
+ to_hash
234
+ end
235
+
236
+ # Returns the object in the form of hash
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_hash
239
+ hash = {}
240
+ self.class.attribute_map.each_pair do |attr, param|
241
+ value = self.send(attr)
242
+ if value.nil?
243
+ is_nullable = self.class.openapi_nullable.include?(attr)
244
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
245
+ end
246
+
247
+ hash[param] = _to_hash(value)
248
+ end
249
+ hash
250
+ end
251
+
252
+ # Outputs non-array value in the form of hash
253
+ # For object, use to_hash. Otherwise, just return the value
254
+ # @param [Object] value Any valid value
255
+ # @return [Hash] Returns the value in the form of hash
256
+ def _to_hash(value)
257
+ if value.is_a?(Array)
258
+ value.compact.map { |v| _to_hash(v) }
259
+ elsif value.is_a?(Hash)
260
+ {}.tap do |hash|
261
+ value.each { |k, v| hash[k] = _to_hash(v) }
262
+ end
263
+ elsif value.respond_to? :to_hash
264
+ value.to_hash
265
+ else
266
+ value
267
+ end
268
+ end
269
+
270
+ end
271
+
272
+ end