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,426 @@
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 RagieEvidence
18
+ attr_accessor :type
19
+
20
+ attr_accessor :text
21
+
22
+ # The chunk id of the evidence.
23
+ attr_accessor :id
24
+
25
+ # The index of the chunk in the document.
26
+ attr_accessor :index
27
+
28
+ # The document id of the document containing the chunk being used as evidence.
29
+ attr_accessor :document_id
30
+
31
+ # The name of the document that contains the chunk being used as evidence.
32
+ attr_accessor :document_name
33
+
34
+ # The metadata of the chunk being used as evidence.
35
+ attr_accessor :metadata
36
+
37
+ # The metadata of the document that contains the evidence.
38
+ attr_accessor :document_metadata
39
+
40
+ # The links to the evidence.
41
+ attr_accessor :links
42
+
43
+ class EnumAttributeValidator
44
+ attr_reader :datatype
45
+ attr_reader :allowable_values
46
+
47
+ def initialize(datatype, allowable_values)
48
+ @allowable_values = allowable_values.map do |value|
49
+ case datatype.to_s
50
+ when /Integer/i
51
+ value.to_i
52
+ when /Float/i
53
+ value.to_f
54
+ else
55
+ value
56
+ end
57
+ end
58
+ end
59
+
60
+ def valid?(value)
61
+ !value || allowable_values.include?(value)
62
+ end
63
+ end
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+ :'type' => :'type',
69
+ :'text' => :'text',
70
+ :'id' => :'id',
71
+ :'index' => :'index',
72
+ :'document_id' => :'document_id',
73
+ :'document_name' => :'document_name',
74
+ :'metadata' => :'metadata',
75
+ :'document_metadata' => :'document_metadata',
76
+ :'links' => :'links'
77
+ }
78
+ end
79
+
80
+ # Returns attribute mapping this model knows about
81
+ def self.acceptable_attribute_map
82
+ attribute_map
83
+ end
84
+
85
+ # Returns all the JSON keys this model knows about
86
+ def self.acceptable_attributes
87
+ acceptable_attribute_map.values
88
+ end
89
+
90
+ # Attribute type mapping.
91
+ def self.openapi_types
92
+ {
93
+ :'type' => :'String',
94
+ :'text' => :'String',
95
+ :'id' => :'String',
96
+ :'index' => :'Integer',
97
+ :'document_id' => :'String',
98
+ :'document_name' => :'String',
99
+ :'metadata' => :'Hash<String, Object>',
100
+ :'document_metadata' => :'Hash<String, Object>',
101
+ :'links' => :'Hash<String, SearchResultLink>'
102
+ }
103
+ end
104
+
105
+ # List of attributes with nullable: true
106
+ def self.openapi_nullable
107
+ Set.new([
108
+ ])
109
+ end
110
+
111
+ # Initializes the object
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ def initialize(attributes = {})
114
+ if (!attributes.is_a?(Hash))
115
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RagieRubySdk::RagieEvidence` initialize method"
116
+ end
117
+
118
+ # check to see if the attribute exists and convert string to symbol for hash key
119
+ acceptable_attribute_map = self.class.acceptable_attribute_map
120
+ attributes = attributes.each_with_object({}) { |(k, v), h|
121
+ if (!acceptable_attribute_map.key?(k.to_sym))
122
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RagieRubySdk::RagieEvidence`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
123
+ end
124
+ h[k.to_sym] = v
125
+ }
126
+
127
+ if attributes.key?(:'type')
128
+ self.type = attributes[:'type']
129
+ else
130
+ self.type = 'ragie'
131
+ end
132
+
133
+ if attributes.key?(:'text')
134
+ self.text = attributes[:'text']
135
+ else
136
+ self.text = nil
137
+ end
138
+
139
+ if attributes.key?(:'id')
140
+ self.id = attributes[:'id']
141
+ else
142
+ self.id = nil
143
+ end
144
+
145
+ if attributes.key?(:'index')
146
+ self.index = attributes[:'index']
147
+ else
148
+ self.index = nil
149
+ end
150
+
151
+ if attributes.key?(:'document_id')
152
+ self.document_id = attributes[:'document_id']
153
+ else
154
+ self.document_id = nil
155
+ end
156
+
157
+ if attributes.key?(:'document_name')
158
+ self.document_name = attributes[:'document_name']
159
+ else
160
+ self.document_name = nil
161
+ end
162
+
163
+ if attributes.key?(:'metadata')
164
+ if (value = attributes[:'metadata']).is_a?(Hash)
165
+ self.metadata = value
166
+ end
167
+ end
168
+
169
+ if attributes.key?(:'document_metadata')
170
+ if (value = attributes[:'document_metadata']).is_a?(Hash)
171
+ self.document_metadata = value
172
+ end
173
+ end
174
+
175
+ if attributes.key?(:'links')
176
+ if (value = attributes[:'links']).is_a?(Hash)
177
+ self.links = value
178
+ end
179
+ end
180
+ end
181
+
182
+ # Show invalid properties with the reasons. Usually used together with valid?
183
+ # @return Array for valid properties with the reasons
184
+ def list_invalid_properties
185
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
186
+ invalid_properties = Array.new
187
+ if @text.nil?
188
+ invalid_properties.push('invalid value for "text", text cannot be nil.')
189
+ end
190
+
191
+ if @id.nil?
192
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
193
+ end
194
+
195
+ if @index.nil?
196
+ invalid_properties.push('invalid value for "index", index cannot be nil.')
197
+ end
198
+
199
+ if @document_id.nil?
200
+ invalid_properties.push('invalid value for "document_id", document_id cannot be nil.')
201
+ end
202
+
203
+ if @document_name.nil?
204
+ invalid_properties.push('invalid value for "document_name", document_name cannot be nil.')
205
+ end
206
+
207
+ invalid_properties
208
+ end
209
+
210
+ # Check to see if the all the properties in the model are valid
211
+ # @return true if the model is valid
212
+ def valid?
213
+ warn '[DEPRECATED] the `valid?` method is obsolete'
214
+ type_validator = EnumAttributeValidator.new('String', ["ragie"])
215
+ return false unless type_validator.valid?(@type)
216
+ return false if @text.nil?
217
+ return false if @id.nil?
218
+ return false if @index.nil?
219
+ return false if @document_id.nil?
220
+ return false if @document_name.nil?
221
+ true
222
+ end
223
+
224
+ # Custom attribute writer method checking allowed values (enum).
225
+ # @param [Object] type Object to be assigned
226
+ def type=(type)
227
+ validator = EnumAttributeValidator.new('String', ["ragie"])
228
+ unless validator.valid?(type)
229
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
230
+ end
231
+ @type = type
232
+ end
233
+
234
+ # Custom attribute writer method with validation
235
+ # @param [Object] text Value to be assigned
236
+ def text=(text)
237
+ if text.nil?
238
+ fail ArgumentError, 'text cannot be nil'
239
+ end
240
+
241
+ @text = text
242
+ end
243
+
244
+ # Custom attribute writer method with validation
245
+ # @param [Object] id Value to be assigned
246
+ def id=(id)
247
+ if id.nil?
248
+ fail ArgumentError, 'id cannot be nil'
249
+ end
250
+
251
+ @id = id
252
+ end
253
+
254
+ # Custom attribute writer method with validation
255
+ # @param [Object] index Value to be assigned
256
+ def index=(index)
257
+ if index.nil?
258
+ fail ArgumentError, 'index cannot be nil'
259
+ end
260
+
261
+ @index = index
262
+ end
263
+
264
+ # Custom attribute writer method with validation
265
+ # @param [Object] document_id Value to be assigned
266
+ def document_id=(document_id)
267
+ if document_id.nil?
268
+ fail ArgumentError, 'document_id cannot be nil'
269
+ end
270
+
271
+ @document_id = document_id
272
+ end
273
+
274
+ # Custom attribute writer method with validation
275
+ # @param [Object] document_name Value to be assigned
276
+ def document_name=(document_name)
277
+ if document_name.nil?
278
+ fail ArgumentError, 'document_name cannot be nil'
279
+ end
280
+
281
+ @document_name = document_name
282
+ end
283
+
284
+ # Checks equality by comparing each attribute.
285
+ # @param [Object] Object to be compared
286
+ def ==(o)
287
+ return true if self.equal?(o)
288
+ self.class == o.class &&
289
+ type == o.type &&
290
+ text == o.text &&
291
+ id == o.id &&
292
+ index == o.index &&
293
+ document_id == o.document_id &&
294
+ document_name == o.document_name &&
295
+ metadata == o.metadata &&
296
+ document_metadata == o.document_metadata &&
297
+ links == o.links
298
+ end
299
+
300
+ # @see the `==` method
301
+ # @param [Object] Object to be compared
302
+ def eql?(o)
303
+ self == o
304
+ end
305
+
306
+ # Calculates hash code according to all attributes.
307
+ # @return [Integer] Hash code
308
+ def hash
309
+ [type, text, id, index, document_id, document_name, metadata, document_metadata, links].hash
310
+ end
311
+
312
+ # Builds the object from hash
313
+ # @param [Hash] attributes Model attributes in the form of hash
314
+ # @return [Object] Returns the model itself
315
+ def self.build_from_hash(attributes)
316
+ return nil unless attributes.is_a?(Hash)
317
+ attributes = attributes.transform_keys(&:to_sym)
318
+ transformed_hash = {}
319
+ openapi_types.each_pair do |key, type|
320
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
321
+ transformed_hash["#{key}"] = nil
322
+ elsif type =~ /\AArray<(.*)>/i
323
+ # check to ensure the input is an array given that the attribute
324
+ # is documented as an array but the input is not
325
+ if attributes[attribute_map[key]].is_a?(Array)
326
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
327
+ end
328
+ elsif !attributes[attribute_map[key]].nil?
329
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
330
+ end
331
+ end
332
+ new(transformed_hash)
333
+ end
334
+
335
+ # Deserializes the data based on type
336
+ # @param string type Data type
337
+ # @param string value Value to be deserialized
338
+ # @return [Object] Deserialized data
339
+ def self._deserialize(type, value)
340
+ case type.to_sym
341
+ when :Time
342
+ Time.parse(value)
343
+ when :Date
344
+ Date.parse(value)
345
+ when :String
346
+ value.to_s
347
+ when :Integer
348
+ value.to_i
349
+ when :Float
350
+ value.to_f
351
+ when :Boolean
352
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
353
+ true
354
+ else
355
+ false
356
+ end
357
+ when :Object
358
+ # generic object (usually a Hash), return directly
359
+ value
360
+ when /\AArray<(?<inner_type>.+)>\z/
361
+ inner_type = Regexp.last_match[:inner_type]
362
+ value.map { |v| _deserialize(inner_type, v) }
363
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
364
+ k_type = Regexp.last_match[:k_type]
365
+ v_type = Regexp.last_match[:v_type]
366
+ {}.tap do |hash|
367
+ value.each do |k, v|
368
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
369
+ end
370
+ end
371
+ else # model
372
+ # models (e.g. Pet) or oneOf
373
+ klass = RagieRubySdk.const_get(type)
374
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
375
+ end
376
+ end
377
+
378
+ # Returns the string representation of the object
379
+ # @return [String] String presentation of the object
380
+ def to_s
381
+ to_hash.to_s
382
+ end
383
+
384
+ # to_body is an alias to to_hash (backward compatibility)
385
+ # @return [Hash] Returns the object in the form of hash
386
+ def to_body
387
+ to_hash
388
+ end
389
+
390
+ # Returns the object in the form of hash
391
+ # @return [Hash] Returns the object in the form of hash
392
+ def to_hash
393
+ hash = {}
394
+ self.class.attribute_map.each_pair do |attr, param|
395
+ value = self.send(attr)
396
+ if value.nil?
397
+ is_nullable = self.class.openapi_nullable.include?(attr)
398
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
399
+ end
400
+
401
+ hash[param] = _to_hash(value)
402
+ end
403
+ hash
404
+ end
405
+
406
+ # Outputs non-array value in the form of hash
407
+ # For object, use to_hash. Otherwise, just return the value
408
+ # @param [Object] value Any valid value
409
+ # @return [Hash] Returns the value in the form of hash
410
+ def _to_hash(value)
411
+ if value.is_a?(Array)
412
+ value.compact.map { |v| _to_hash(v) }
413
+ elsif value.is_a?(Hash)
414
+ {}.tap do |hash|
415
+ value.each { |k, v| hash[k] = _to_hash(v) }
416
+ end
417
+ elsif value.respond_to? :to_hash
418
+ value.to_hash
419
+ else
420
+ value
421
+ end
422
+ end
423
+
424
+ end
425
+
426
+ end
@@ -0,0 +1,271 @@
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 Reasoning
18
+ attr_accessor :effort
19
+
20
+ attr_accessor :summary
21
+
22
+ class EnumAttributeValidator
23
+ attr_reader :datatype
24
+ attr_reader :allowable_values
25
+
26
+ def initialize(datatype, allowable_values)
27
+ @allowable_values = allowable_values.map do |value|
28
+ case datatype.to_s
29
+ when /Integer/i
30
+ value.to_i
31
+ when /Float/i
32
+ value.to_f
33
+ else
34
+ value
35
+ end
36
+ end
37
+ end
38
+
39
+ def valid?(value)
40
+ !value || allowable_values.include?(value)
41
+ end
42
+ end
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'effort' => :'effort',
48
+ :'summary' => :'summary'
49
+ }
50
+ end
51
+
52
+ # Returns attribute mapping this model knows about
53
+ def self.acceptable_attribute_map
54
+ attribute_map
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ acceptable_attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'effort' => :'String',
66
+ :'summary' => :'Object'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ :'summary'
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::Reasoning` 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::Reasoning`. 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?(:'effort')
94
+ self.effort = attributes[:'effort']
95
+ else
96
+ self.effort = nil
97
+ end
98
+
99
+ if attributes.key?(:'summary')
100
+ self.summary = attributes[:'summary']
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
108
+ invalid_properties = Array.new
109
+ if @effort.nil?
110
+ invalid_properties.push('invalid value for "effort", effort cannot be nil.')
111
+ end
112
+
113
+ invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ warn '[DEPRECATED] the `valid?` method is obsolete'
120
+ return false if @effort.nil?
121
+ effort_validator = EnumAttributeValidator.new('String', ["low", "medium", "high"])
122
+ return false unless effort_validator.valid?(@effort)
123
+ true
124
+ end
125
+
126
+ # Custom attribute writer method checking allowed values (enum).
127
+ # @param [Object] effort Object to be assigned
128
+ def effort=(effort)
129
+ validator = EnumAttributeValidator.new('String', ["low", "medium", "high"])
130
+ unless validator.valid?(effort)
131
+ fail ArgumentError, "invalid value for \"effort\", must be one of #{validator.allowable_values}."
132
+ end
133
+ @effort = effort
134
+ end
135
+
136
+ # Checks equality by comparing each attribute.
137
+ # @param [Object] Object to be compared
138
+ def ==(o)
139
+ return true if self.equal?(o)
140
+ self.class == o.class &&
141
+ effort == o.effort &&
142
+ summary == o.summary
143
+ end
144
+
145
+ # @see the `==` method
146
+ # @param [Object] Object to be compared
147
+ def eql?(o)
148
+ self == o
149
+ end
150
+
151
+ # Calculates hash code according to all attributes.
152
+ # @return [Integer] Hash code
153
+ def hash
154
+ [effort, summary].hash
155
+ end
156
+
157
+ # Builds the object from hash
158
+ # @param [Hash] attributes Model attributes in the form of hash
159
+ # @return [Object] Returns the model itself
160
+ def self.build_from_hash(attributes)
161
+ return nil unless attributes.is_a?(Hash)
162
+ attributes = attributes.transform_keys(&:to_sym)
163
+ transformed_hash = {}
164
+ openapi_types.each_pair do |key, type|
165
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
166
+ transformed_hash["#{key}"] = nil
167
+ elsif type =~ /\AArray<(.*)>/i
168
+ # check to ensure the input is an array given that the attribute
169
+ # is documented as an array but the input is not
170
+ if attributes[attribute_map[key]].is_a?(Array)
171
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
172
+ end
173
+ elsif !attributes[attribute_map[key]].nil?
174
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
175
+ end
176
+ end
177
+ new(transformed_hash)
178
+ end
179
+
180
+ # Deserializes the data based on type
181
+ # @param string type Data type
182
+ # @param string value Value to be deserialized
183
+ # @return [Object] Deserialized data
184
+ def self._deserialize(type, value)
185
+ case type.to_sym
186
+ when :Time
187
+ Time.parse(value)
188
+ when :Date
189
+ Date.parse(value)
190
+ when :String
191
+ value.to_s
192
+ when :Integer
193
+ value.to_i
194
+ when :Float
195
+ value.to_f
196
+ when :Boolean
197
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
198
+ true
199
+ else
200
+ false
201
+ end
202
+ when :Object
203
+ # generic object (usually a Hash), return directly
204
+ value
205
+ when /\AArray<(?<inner_type>.+)>\z/
206
+ inner_type = Regexp.last_match[:inner_type]
207
+ value.map { |v| _deserialize(inner_type, v) }
208
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
209
+ k_type = Regexp.last_match[:k_type]
210
+ v_type = Regexp.last_match[:v_type]
211
+ {}.tap do |hash|
212
+ value.each do |k, v|
213
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
214
+ end
215
+ end
216
+ else # model
217
+ # models (e.g. Pet) or oneOf
218
+ klass = RagieRubySdk.const_get(type)
219
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
220
+ end
221
+ end
222
+
223
+ # Returns the string representation of the object
224
+ # @return [String] String presentation of the object
225
+ def to_s
226
+ to_hash.to_s
227
+ end
228
+
229
+ # to_body is an alias to to_hash (backward compatibility)
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_body
232
+ to_hash
233
+ end
234
+
235
+ # Returns the object in the form of hash
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_hash
238
+ hash = {}
239
+ self.class.attribute_map.each_pair do |attr, param|
240
+ value = self.send(attr)
241
+ if value.nil?
242
+ is_nullable = self.class.openapi_nullable.include?(attr)
243
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
244
+ end
245
+
246
+ hash[param] = _to_hash(value)
247
+ end
248
+ hash
249
+ end
250
+
251
+ # Outputs non-array value in the form of hash
252
+ # For object, use to_hash. Otherwise, just return the value
253
+ # @param [Object] value Any valid value
254
+ # @return [Hash] Returns the value in the form of hash
255
+ def _to_hash(value)
256
+ if value.is_a?(Array)
257
+ value.compact.map { |v| _to_hash(v) }
258
+ elsif value.is_a?(Hash)
259
+ {}.tap do |hash|
260
+ value.each { |k, v| hash[k] = _to_hash(v) }
261
+ end
262
+ elsif value.respond_to? :to_hash
263
+ value.to_hash
264
+ else
265
+ value
266
+ end
267
+ end
268
+
269
+ end
270
+
271
+ end