lingara 0.1.0.pre.alpha.13 → 0.2.0.pre.alpha.3

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 (97) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +74 -2
  3. data/lib/lingara/client.rb +78 -10
  4. data/lib/lingara/events/catalogue.rb +20 -2
  5. data/lib/lingara/minted_token.rb +73 -0
  6. data/lib/lingara/models/allowance_row.rb +1 -1
  7. data/lib/lingara/models/app_context_slice.rb +1 -1
  8. data/lib/lingara/models/app_disabled_data.rb +263 -0
  9. data/lib/lingara/models/app_enabled_data.rb +263 -0
  10. data/lib/lingara/models/app_installed_data.rb +1 -1
  11. data/lib/lingara/models/app_uninstalled_data.rb +1 -1
  12. data/lib/lingara/models/create_lesson_plan_event_error.rb +1 -1
  13. data/lib/lingara/models/create_lesson_plan_event_phase.rb +1 -1
  14. data/lib/lingara/models/create_lesson_plan_event_result.rb +1 -1
  15. data/lib/lingara/models/create_lesson_plan_event_started.rb +1 -1
  16. data/lib/lingara/models/dialogue_entry.rb +303 -0
  17. data/lib/lingara/models/dialogue_turn_request.rb +442 -0
  18. data/lib/lingara/models/embed_player_link.rb +427 -0
  19. data/lib/lingara/models/embed_token.rb +379 -0
  20. data/lib/lingara/models/embed_token_request.rb +331 -0
  21. data/lib/lingara/models/error_envelope.rb +1 -1
  22. data/lib/lingara/models/event_envelope.rb +1 -1
  23. data/lib/lingara/models/event_page.rb +1 -1
  24. data/lib/lingara/models/generate_vocabulary_event_done.rb +1 -1
  25. data/lib/lingara/models/generate_vocabulary_event_error.rb +1 -1
  26. data/lib/lingara/models/generate_vocabulary_event_item.rb +1 -1
  27. data/lib/lingara/models/generate_vocabulary_event_started.rb +1 -1
  28. data/lib/lingara/models/inbound_event_accepted.rb +1 -1
  29. data/lib/lingara/models/lesson_plan.rb +1 -1
  30. data/lib/lingara/models/lesson_plan_content.rb +1 -1
  31. data/lib/lingara/models/lesson_plan_create_request.rb +1 -1
  32. data/lib/lingara/models/lesson_plan_failed_data.rb +1 -1
  33. data/lib/lingara/models/lesson_plan_ready_data.rb +1 -1
  34. data/lib/lingara/models/link_status.rb +41 -0
  35. data/lib/lingara/models/notice.rb +1 -1
  36. data/lib/lingara/models/npc.rb +1 -1
  37. data/lib/lingara/models/plan_fail_reason.rb +1 -1
  38. data/lib/lingara/models/plan_pending.rb +1 -1
  39. data/lib/lingara/models/plan_phase.rb +1 -1
  40. data/lib/lingara/models/plan_question.rb +1 -1
  41. data/lib/lingara/models/plan_ready_status.rb +1 -1
  42. data/lib/lingara/models/plan_result.rb +1 -1
  43. data/lib/lingara/models/plan_set.rb +1 -1
  44. data/lib/lingara/models/plan_started.rb +1 -1
  45. data/lib/lingara/models/plan_status.rb +1 -1
  46. data/lib/lingara/models/plan_word.rb +1 -1
  47. data/lib/lingara/models/practice_completed_data.rb +291 -0
  48. data/lib/lingara/models/practice_item.rb +347 -0
  49. data/lib/lingara/models/practice_outcome.rb +45 -0
  50. data/lib/lingara/models/reaction_report.rb +1 -1
  51. data/lib/lingara/models/reaction_status.rb +1 -1
  52. data/lib/lingara/models/send_dialogue_turn_event_delta.rb +287 -0
  53. data/lib/lingara/models/send_dialogue_turn_event_done.rb +287 -0
  54. data/lib/lingara/models/send_dialogue_turn_event_error.rb +287 -0
  55. data/lib/lingara/models/send_dialogue_turn_event_notice.rb +287 -0
  56. data/lib/lingara/models/send_tutor_message_event_delta.rb +1 -1
  57. data/lib/lingara/models/send_tutor_message_event_done.rb +1 -1
  58. data/lib/lingara/models/send_tutor_message_event_error.rb +1 -1
  59. data/lib/lingara/models/send_tutor_message_event_notice.rb +1 -1
  60. data/lib/lingara/models/speaker.rb +41 -0
  61. data/lib/lingara/models/stream_error.rb +1 -1
  62. data/lib/lingara/models/stream_events_event_done.rb +1 -1
  63. data/lib/lingara/models/stream_events_event_error.rb +1 -1
  64. data/lib/lingara/models/stream_events_event_event.rb +1 -1
  65. data/lib/lingara/models/stream_lesson_plan_event_error.rb +1 -1
  66. data/lib/lingara/models/stream_lesson_plan_event_pending.rb +1 -1
  67. data/lib/lingara/models/stream_lesson_plan_event_phase.rb +1 -1
  68. data/lib/lingara/models/stream_lesson_plan_event_result.rb +1 -1
  69. data/lib/lingara/models/stream_lesson_plan_event_started.rb +1 -1
  70. data/lib/lingara/models/threshold_scope.rb +1 -1
  71. data/lib/lingara/models/turn_delta.rb +1 -1
  72. data/lib/lingara/models/turn_entry.rb +1 -1
  73. data/lib/lingara/models/turn_role.rb +1 -1
  74. data/lib/lingara/models/tutor_turn_request.rb +1 -1
  75. data/lib/lingara/models/usage.rb +1 -1
  76. data/lib/lingara/models/usage_ledger.rb +1 -1
  77. data/lib/lingara/models/usage_threshold_reached_data.rb +1 -1
  78. data/lib/lingara/models/version_detail.rb +1 -1
  79. data/lib/lingara/models/version_history_entry.rb +1 -1
  80. data/lib/lingara/models/version_list.rb +1 -1
  81. data/lib/lingara/models/version_spec.rb +1 -1
  82. data/lib/lingara/models/version_state.rb +1 -1
  83. data/lib/lingara/models/version_summary.rb +1 -1
  84. data/lib/lingara/models/vocab_example.rb +1 -1
  85. data/lib/lingara/models/vocab_item.rb +1 -1
  86. data/lib/lingara/models/vocab_meta.rb +1 -1
  87. data/lib/lingara/models/vocab_request.rb +1 -1
  88. data/lib/lingara/models/vocab_started.rb +1 -1
  89. data/lib/lingara/models/world_context_changed.rb +1 -1
  90. data/lib/lingara/models/world_practice_completed.rb +294 -0
  91. data/lib/lingara/models/world_practice_requested.rb +1 -1
  92. data/lib/lingara/operations.rb +45 -0
  93. data/lib/lingara/streams.rb +25 -0
  94. data/lib/lingara/version.rb +3 -3
  95. data/lib/lingara.rb +1 -0
  96. data/sig/lingara.rbs +36 -0
  97. metadata +20 -2
@@ -0,0 +1,347 @@
1
+ =begin
2
+ #Lingara API
3
+
4
+ #Generate vocabulary lists and lesson plans, and hold tutor conversations, in the languages Lingara teaches. Each call is paid for by the client that makes it: an `allowance` client spends its owner's allowance, and a `metered` client is billed for its usage.
5
+
6
+ The version of the OpenAPI document: 2026-10-virile-dragon
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Lingara
17
+ class PracticeItem
18
+ attr_accessor :set_number
19
+
20
+ attr_accessor :question
21
+
22
+ attr_accessor :outcome
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'set_number' => :'set_number',
50
+ :'question' => :'question',
51
+ :'outcome' => :'outcome'
52
+ }
53
+ end
54
+
55
+ # Returns attribute mapping this model knows about
56
+ def self.acceptable_attribute_map
57
+ attribute_map
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ acceptable_attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'set_number' => :'Integer',
69
+ :'question' => :'Integer',
70
+ :'outcome' => :'PracticeOutcome'
71
+ }
72
+ end
73
+
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ ])
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ if (!attributes.is_a?(Hash))
84
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Lingara::PracticeItem` initialize method"
85
+ end
86
+
87
+ # check to see if the attribute exists and convert string to symbol for hash key
88
+ acceptable_attribute_map = self.class.acceptable_attribute_map
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!acceptable_attribute_map.key?(k.to_sym))
91
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Lingara::PracticeItem`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
92
+ end
93
+ h[k.to_sym] = v
94
+ }
95
+
96
+ if attributes.key?(:'set_number')
97
+ self.set_number = attributes[:'set_number']
98
+ else
99
+ self.set_number = nil
100
+ end
101
+
102
+ if attributes.key?(:'question')
103
+ self.question = attributes[:'question']
104
+ else
105
+ self.question = nil
106
+ end
107
+
108
+ if attributes.key?(:'outcome')
109
+ self.outcome = attributes[:'outcome']
110
+ else
111
+ self.outcome = nil
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
119
+ invalid_properties = Array.new
120
+ if @set_number.nil?
121
+ invalid_properties.push('invalid value for "set_number", set_number cannot be nil.')
122
+ end
123
+
124
+ if @set_number > 255
125
+ invalid_properties.push('invalid value for "set_number", must be smaller than or equal to 255.')
126
+ end
127
+
128
+ if @set_number < 1
129
+ invalid_properties.push('invalid value for "set_number", must be greater than or equal to 1.')
130
+ end
131
+
132
+ if @question.nil?
133
+ invalid_properties.push('invalid value for "question", question cannot be nil.')
134
+ end
135
+
136
+ if @question > 255
137
+ invalid_properties.push('invalid value for "question", must be smaller than or equal to 255.')
138
+ end
139
+
140
+ if @question < 0
141
+ invalid_properties.push('invalid value for "question", must be greater than or equal to 0.')
142
+ end
143
+
144
+ if @outcome.nil?
145
+ invalid_properties.push('invalid value for "outcome", outcome cannot be nil.')
146
+ end
147
+
148
+ invalid_properties
149
+ end
150
+
151
+ # Check to see if the all the properties in the model are valid
152
+ # @return true if the model is valid
153
+ def valid?
154
+ warn '[DEPRECATED] the `valid?` method is obsolete'
155
+ return false if @set_number.nil?
156
+ return false if @set_number > 255
157
+ return false if @set_number < 1
158
+ return false if @question.nil?
159
+ return false if @question > 255
160
+ return false if @question < 0
161
+ return false if @outcome.nil?
162
+ true
163
+ end
164
+
165
+ # Custom attribute writer method with validation
166
+ # @param [Object] set_number Value to be assigned
167
+ def set_number=(set_number)
168
+ if set_number.nil?
169
+ fail ArgumentError, 'set_number cannot be nil'
170
+ end
171
+
172
+ if set_number > 255
173
+ fail ArgumentError, 'invalid value for "set_number", must be smaller than or equal to 255.'
174
+ end
175
+
176
+ if set_number < 1
177
+ fail ArgumentError, 'invalid value for "set_number", must be greater than or equal to 1.'
178
+ end
179
+
180
+ @set_number = set_number
181
+ end
182
+
183
+ # Custom attribute writer method with validation
184
+ # @param [Object] question Value to be assigned
185
+ def question=(question)
186
+ if question.nil?
187
+ fail ArgumentError, 'question cannot be nil'
188
+ end
189
+
190
+ if question > 255
191
+ fail ArgumentError, 'invalid value for "question", must be smaller than or equal to 255.'
192
+ end
193
+
194
+ if question < 0
195
+ fail ArgumentError, 'invalid value for "question", must be greater than or equal to 0.'
196
+ end
197
+
198
+ @question = question
199
+ end
200
+
201
+ # Custom attribute writer method with validation
202
+ # @param [Object] outcome Value to be assigned
203
+ def outcome=(outcome)
204
+ if outcome.nil?
205
+ fail ArgumentError, 'outcome cannot be nil'
206
+ end
207
+
208
+ @outcome = outcome
209
+ end
210
+
211
+ # Checks equality by comparing each attribute.
212
+ # @param [Object] Object to be compared
213
+ def ==(o)
214
+ return true if self.equal?(o)
215
+ self.class == o.class &&
216
+ set_number == o.set_number &&
217
+ question == o.question &&
218
+ outcome == o.outcome
219
+ end
220
+
221
+ # @see the `==` method
222
+ # @param [Object] Object to be compared
223
+ def eql?(o)
224
+ self == o
225
+ end
226
+
227
+ # Calculates hash code according to all attributes.
228
+ # @return [Integer] Hash code
229
+ def hash
230
+ [set_number, question, outcome].hash
231
+ end
232
+
233
+ # Builds the object from hash
234
+ # @param [Hash] attributes Model attributes in the form of hash
235
+ # @return [Object] Returns the model itself
236
+ def self.build_from_hash(attributes)
237
+ return nil unless attributes.is_a?(Hash)
238
+ attributes = attributes.transform_keys(&:to_sym)
239
+ transformed_hash = {}
240
+ openapi_types.each_pair do |key, type|
241
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
242
+ transformed_hash["#{key}"] = nil
243
+ elsif type =~ /\AArray<(.*)>/i
244
+ # check to ensure the input is an array given that the attribute
245
+ # is documented as an array but the input is not
246
+ if attributes[attribute_map[key]].is_a?(Array)
247
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
248
+ end
249
+ elsif !attributes[attribute_map[key]].nil?
250
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
251
+ end
252
+ end
253
+ new(transformed_hash)
254
+ end
255
+
256
+ # Deserializes the data based on type
257
+ # @param string type Data type
258
+ # @param string value Value to be deserialized
259
+ # @return [Object] Deserialized data
260
+ def self._deserialize(type, value)
261
+ case type.to_sym
262
+ when :Time
263
+ Time.parse(value)
264
+ when :Date
265
+ Date.parse(value)
266
+ when :String
267
+ value.to_s
268
+ when :Integer
269
+ value.to_i
270
+ when :Float
271
+ value.to_f
272
+ when :Boolean
273
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
274
+ true
275
+ else
276
+ false
277
+ end
278
+ when :Object
279
+ # generic object (usually a Hash), return directly
280
+ value
281
+ when /\AArray<(?<inner_type>.+)>\z/
282
+ inner_type = Regexp.last_match[:inner_type]
283
+ value.map { |v| _deserialize(inner_type, v) }
284
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
285
+ k_type = Regexp.last_match[:k_type]
286
+ v_type = Regexp.last_match[:v_type]
287
+ {}.tap do |hash|
288
+ value.each do |k, v|
289
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
290
+ end
291
+ end
292
+ else # model
293
+ # models (e.g. Pet) or oneOf
294
+ klass = Lingara.const_get(type)
295
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
296
+ end
297
+ end
298
+
299
+ # Returns the string representation of the object
300
+ # @return [String] String presentation of the object
301
+ def to_s
302
+ to_hash.to_s
303
+ end
304
+
305
+ # to_body is an alias to to_hash (backward compatibility)
306
+ # @return [Hash] Returns the object in the form of hash
307
+ def to_body
308
+ to_hash
309
+ end
310
+
311
+ # Returns the object in the form of hash
312
+ # @return [Hash] Returns the object in the form of hash
313
+ def to_hash
314
+ hash = {}
315
+ self.class.attribute_map.each_pair do |attr, param|
316
+ value = self.send(attr)
317
+ if value.nil?
318
+ is_nullable = self.class.openapi_nullable.include?(attr)
319
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
320
+ end
321
+
322
+ hash[param] = _to_hash(value)
323
+ end
324
+ hash
325
+ end
326
+
327
+ # Outputs non-array value in the form of hash
328
+ # For object, use to_hash. Otherwise, just return the value
329
+ # @param [Object] value Any valid value
330
+ # @return [Hash] Returns the value in the form of hash
331
+ def _to_hash(value)
332
+ if value.is_a?(Array)
333
+ value.compact.map { |v| _to_hash(v) }
334
+ elsif value.is_a?(Hash)
335
+ {}.tap do |hash|
336
+ value.each { |k, v| hash[k] = _to_hash(v) }
337
+ end
338
+ elsif value.respond_to? :to_hash
339
+ value.to_hash
340
+ else
341
+ value
342
+ end
343
+ end
344
+
345
+ end
346
+
347
+ end
@@ -0,0 +1,45 @@
1
+ =begin
2
+ #Lingara API
3
+
4
+ #Generate vocabulary lists and lesson plans, and hold tutor conversations, in the languages Lingara teaches. Each call is paid for by the client that makes it: an `allowance` client spends its owner's allowance, and a `metered` client is billed for its usage.
5
+
6
+ The version of the OpenAPI document: 2026-10-virile-dragon
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Lingara
17
+ class PracticeOutcome
18
+ CORRECT = "correct".freeze
19
+ INCORRECT = "incorrect".freeze
20
+ REVEALED = "revealed".freeze
21
+ SELF_CORRECT = "self_correct".freeze
22
+ SELF_INCORRECT = "self_incorrect".freeze
23
+ SKIPPED = "skipped".freeze
24
+ UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze
25
+
26
+ def self.all_vars
27
+ @all_vars ||= [CORRECT, INCORRECT, REVEALED, SELF_CORRECT, SELF_INCORRECT, SKIPPED, UNKNOWN_DEFAULT_OPEN_API].freeze
28
+ end
29
+
30
+ # Builds the enum from string
31
+ # @param [String] The enum value in the form of the string
32
+ # @return [String] The enum value
33
+ def self.build_from_hash(value)
34
+ new.build_from_hash(value)
35
+ end
36
+
37
+ # Builds the enum from string
38
+ # @param [String] The enum value in the form of the string
39
+ # @return [String] The enum value
40
+ def build_from_hash(value)
41
+ return value if PracticeOutcome.all_vars.include?(value)
42
+ raise "Invalid ENUM value #{value} for class #PracticeOutcome"
43
+ end
44
+ end
45
+ end
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Generate vocabulary lists and lesson plans, and hold tutor conversations, in the languages Lingara teaches. Each call is paid for by the client that makes it: an `allowance` client spends its owner's allowance, and a `metered` client is billed for its usage.
5
5
 
6
- The version of the OpenAPI document: 2026-10-affable-towhee
6
+ The version of the OpenAPI document: 2026-10-virile-dragon
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.14.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Generate vocabulary lists and lesson plans, and hold tutor conversations, in the languages Lingara teaches. Each call is paid for by the client that makes it: an `allowance` client spends its owner's allowance, and a `metered` client is billed for its usage.
5
5
 
6
- The version of the OpenAPI document: 2026-10-affable-towhee
6
+ The version of the OpenAPI document: 2026-10-virile-dragon
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.14.0
@@ -0,0 +1,287 @@
1
+ =begin
2
+ #Lingara API
3
+
4
+ #Generate vocabulary lists and lesson plans, and hold tutor conversations, in the languages Lingara teaches. Each call is paid for by the client that makes it: an `allowance` client spends its owner's allowance, and a `metered` client is billed for its usage.
5
+
6
+ The version of the OpenAPI document: 2026-10-virile-dragon
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Lingara
17
+ class SendDialogueTurnEventDelta
18
+ attr_accessor :event
19
+
20
+ attr_accessor :data
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
+ :'event' => :'event',
48
+ :'data' => :'data'
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
+ :'event' => :'String',
66
+ :'data' => :'TurnDelta'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Lingara::SendDialogueTurnEventDelta` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Lingara::SendDialogueTurnEventDelta`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'event')
93
+ self.event = attributes[:'event']
94
+ else
95
+ self.event = nil
96
+ end
97
+
98
+ if attributes.key?(:'data')
99
+ self.data = attributes[:'data']
100
+ else
101
+ self.data = nil
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 @event.nil?
111
+ invalid_properties.push('invalid value for "event", event cannot be nil.')
112
+ end
113
+
114
+ if @data.nil?
115
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
116
+ end
117
+
118
+ invalid_properties
119
+ end
120
+
121
+ # Check to see if the all the properties in the model are valid
122
+ # @return true if the model is valid
123
+ def valid?
124
+ warn '[DEPRECATED] the `valid?` method is obsolete'
125
+ return false if @event.nil?
126
+ event_validator = EnumAttributeValidator.new('String', ["delta", "unknown_default_open_api"])
127
+ return false unless event_validator.valid?(@event)
128
+ return false if @data.nil?
129
+ true
130
+ end
131
+
132
+ # Custom attribute writer method checking allowed values (enum).
133
+ # @param [Object] event Object to be assigned
134
+ def event=(event)
135
+ validator = EnumAttributeValidator.new('String', ["delta", "unknown_default_open_api"])
136
+ unless validator.valid?(event)
137
+ fail ArgumentError, "invalid value for \"event\", must be one of #{validator.allowable_values}."
138
+ end
139
+ @event = event
140
+ end
141
+
142
+ # Custom attribute writer method with validation
143
+ # @param [Object] data Value to be assigned
144
+ def data=(data)
145
+ if data.nil?
146
+ fail ArgumentError, 'data cannot be nil'
147
+ end
148
+
149
+ @data = data
150
+ end
151
+
152
+ # Checks equality by comparing each attribute.
153
+ # @param [Object] Object to be compared
154
+ def ==(o)
155
+ return true if self.equal?(o)
156
+ self.class == o.class &&
157
+ event == o.event &&
158
+ data == o.data
159
+ end
160
+
161
+ # @see the `==` method
162
+ # @param [Object] Object to be compared
163
+ def eql?(o)
164
+ self == o
165
+ end
166
+
167
+ # Calculates hash code according to all attributes.
168
+ # @return [Integer] Hash code
169
+ def hash
170
+ [event, data].hash
171
+ end
172
+
173
+ # Builds the object from hash
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ # @return [Object] Returns the model itself
176
+ def self.build_from_hash(attributes)
177
+ return nil unless attributes.is_a?(Hash)
178
+ attributes = attributes.transform_keys(&:to_sym)
179
+ transformed_hash = {}
180
+ openapi_types.each_pair do |key, type|
181
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
182
+ transformed_hash["#{key}"] = nil
183
+ elsif type =~ /\AArray<(.*)>/i
184
+ # check to ensure the input is an array given that the attribute
185
+ # is documented as an array but the input is not
186
+ if attributes[attribute_map[key]].is_a?(Array)
187
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
188
+ end
189
+ elsif !attributes[attribute_map[key]].nil?
190
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
191
+ end
192
+ end
193
+ new(transformed_hash)
194
+ end
195
+
196
+ # Deserializes the data based on type
197
+ # @param string type Data type
198
+ # @param string value Value to be deserialized
199
+ # @return [Object] Deserialized data
200
+ def self._deserialize(type, value)
201
+ case type.to_sym
202
+ when :Time
203
+ Time.parse(value)
204
+ when :Date
205
+ Date.parse(value)
206
+ when :String
207
+ value.to_s
208
+ when :Integer
209
+ value.to_i
210
+ when :Float
211
+ value.to_f
212
+ when :Boolean
213
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
214
+ true
215
+ else
216
+ false
217
+ end
218
+ when :Object
219
+ # generic object (usually a Hash), return directly
220
+ value
221
+ when /\AArray<(?<inner_type>.+)>\z/
222
+ inner_type = Regexp.last_match[:inner_type]
223
+ value.map { |v| _deserialize(inner_type, v) }
224
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
225
+ k_type = Regexp.last_match[:k_type]
226
+ v_type = Regexp.last_match[:v_type]
227
+ {}.tap do |hash|
228
+ value.each do |k, v|
229
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
230
+ end
231
+ end
232
+ else # model
233
+ # models (e.g. Pet) or oneOf
234
+ klass = Lingara.const_get(type)
235
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
236
+ end
237
+ end
238
+
239
+ # Returns the string representation of the object
240
+ # @return [String] String presentation of the object
241
+ def to_s
242
+ to_hash.to_s
243
+ end
244
+
245
+ # to_body is an alias to to_hash (backward compatibility)
246
+ # @return [Hash] Returns the object in the form of hash
247
+ def to_body
248
+ to_hash
249
+ end
250
+
251
+ # Returns the object in the form of hash
252
+ # @return [Hash] Returns the object in the form of hash
253
+ def to_hash
254
+ hash = {}
255
+ self.class.attribute_map.each_pair do |attr, param|
256
+ value = self.send(attr)
257
+ if value.nil?
258
+ is_nullable = self.class.openapi_nullable.include?(attr)
259
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
260
+ end
261
+
262
+ hash[param] = _to_hash(value)
263
+ end
264
+ hash
265
+ end
266
+
267
+ # Outputs non-array value in the form of hash
268
+ # For object, use to_hash. Otherwise, just return the value
269
+ # @param [Object] value Any valid value
270
+ # @return [Hash] Returns the value in the form of hash
271
+ def _to_hash(value)
272
+ if value.is_a?(Array)
273
+ value.compact.map { |v| _to_hash(v) }
274
+ elsif value.is_a?(Hash)
275
+ {}.tap do |hash|
276
+ value.each { |k, v| hash[k] = _to_hash(v) }
277
+ end
278
+ elsif value.respond_to? :to_hash
279
+ value.to_hash
280
+ else
281
+ value
282
+ end
283
+ end
284
+
285
+ end
286
+
287
+ end