lingara 0.2.0.pre.alpha.7 → 0.3.0.pre.alpha.1

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 (149) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -0
  3. data/lib/lingara/client.rb +17 -2
  4. data/lib/lingara/models/activate_canvas_request.rb +1 -1
  5. data/lib/lingara/models/activate_dialogue_request.rb +1 -1
  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 +1 -1
  9. data/lib/lingara/models/app_enabled_data.rb +1 -1
  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/atom_kind.rb +44 -0
  13. data/lib/lingara/models/beat.rb +389 -0
  14. data/lib/lingara/models/canvas.rb +1 -1
  15. data/lib/lingara/models/canvas_activation_outcome.rb +1 -1
  16. data/lib/lingara/models/canvas_active.rb +1 -1
  17. data/lib/lingara/models/canvas_definition.rb +1 -1
  18. data/lib/lingara/models/canvas_draft.rb +1 -1
  19. data/lib/lingara/models/canvas_dry_run.rb +1 -1
  20. data/lib/lingara/models/canvas_edge.rb +1 -1
  21. data/lib/lingara/models/canvas_made_object.rb +1 -1
  22. data/lib/lingara/models/canvas_node.rb +1 -1
  23. data/lib/lingara/models/canvas_node_kind.rb +1 -1
  24. data/lib/lingara/models/canvas_object_ref.rb +1 -1
  25. data/lib/lingara/models/canvas_page.rb +1 -1
  26. data/lib/lingara/models/canvas_param.rb +1 -1
  27. data/lib/lingara/models/canvas_plan.rb +1 -1
  28. data/lib/lingara/models/canvas_recipe.rb +1 -1
  29. data/lib/lingara/models/canvas_summary.rb +1 -1
  30. data/lib/lingara/models/canvas_verdict.rb +1 -1
  31. data/lib/lingara/models/canvas_verdict_kind.rb +1 -1
  32. data/lib/lingara/models/create_canvas_request.rb +1 -1
  33. data/lib/lingara/models/create_dialogue_request.rb +2 -2
  34. data/lib/lingara/models/create_lesson_plan_event_error.rb +1 -1
  35. data/lib/lingara/models/create_lesson_plan_event_phase.rb +1 -1
  36. data/lib/lingara/models/create_lesson_plan_event_result.rb +1 -1
  37. data/lib/lingara/models/create_lesson_plan_event_started.rb +1 -1
  38. data/lib/lingara/models/dialogue.rb +1 -1
  39. data/lib/lingara/models/dialogue_active.rb +2 -2
  40. data/lib/lingara/models/dialogue_draft.rb +2 -2
  41. data/lib/lingara/models/dialogue_entry.rb +1 -1
  42. data/lib/lingara/models/dialogue_npc.rb +17 -6
  43. data/lib/lingara/models/dialogue_page.rb +1 -1
  44. data/lib/lingara/models/dialogue_plan_request.rb +620 -0
  45. data/lib/lingara/models/dialogue_plan_response.rb +105 -0
  46. data/lib/lingara/models/dialogue_plan_response_one_of.rb +287 -0
  47. data/lib/lingara/models/dialogue_plan_response_one_of1.rb +287 -0
  48. data/lib/lingara/models/dialogue_rule.rb +6 -2
  49. data/lib/lingara/models/dialogue_summary.rb +1 -1
  50. data/lib/lingara/models/dialogue_transition.rb +1 -1
  51. data/lib/lingara/models/dialogue_turn_request.rb +1 -1
  52. data/lib/lingara/models/dialogue_warning.rb +1 -1
  53. data/lib/lingara/models/dialogue_warning_code.rb +5 -2
  54. data/lib/lingara/models/embed_player_link.rb +1 -1
  55. data/lib/lingara/models/embed_token.rb +1 -1
  56. data/lib/lingara/models/embed_token_request.rb +1 -1
  57. data/lib/lingara/models/error_envelope.rb +1 -1
  58. data/lib/lingara/models/event_envelope.rb +1 -1
  59. data/lib/lingara/models/event_page.rb +1 -1
  60. data/lib/lingara/models/exit.rb +247 -0
  61. data/lib/lingara/models/fact_value.rb +1 -1
  62. data/lib/lingara/models/generate_vocabulary_event_done.rb +1 -1
  63. data/lib/lingara/models/generate_vocabulary_event_error.rb +1 -1
  64. data/lib/lingara/models/generate_vocabulary_event_item.rb +1 -1
  65. data/lib/lingara/models/generate_vocabulary_event_started.rb +1 -1
  66. data/lib/lingara/models/graph_checkpoint.rb +40 -5
  67. data/lib/lingara/models/graph_edge.rb +1 -1
  68. data/lib/lingara/models/inbound_event_accepted.rb +1 -1
  69. data/lib/lingara/models/kept_reason.rb +43 -0
  70. data/lib/lingara/models/lesson_plan.rb +1 -1
  71. data/lib/lingara/models/lesson_plan_content.rb +1 -1
  72. data/lib/lingara/models/lesson_plan_create_request.rb +1 -1
  73. data/lib/lingara/models/lesson_plan_failed_data.rb +1 -1
  74. data/lib/lingara/models/lesson_plan_ready_data.rb +1 -1
  75. data/lib/lingara/models/link_status.rb +1 -1
  76. data/lib/lingara/models/notice.rb +1 -1
  77. data/lib/lingara/models/npc.rb +1 -1
  78. data/lib/lingara/models/npc_disposition.rb +299 -0
  79. data/lib/lingara/models/npc_language.rb +1 -1
  80. data/lib/lingara/models/pedagogy.rb +1 -1
  81. data/lib/lingara/models/plan_fail_reason.rb +1 -1
  82. data/lib/lingara/models/plan_fragment.rb +265 -0
  83. data/lib/lingara/models/plan_pending.rb +1 -1
  84. data/lib/lingara/models/plan_phase.rb +1 -1
  85. data/lib/lingara/models/plan_question.rb +1 -1
  86. data/lib/lingara/models/plan_ready_status.rb +1 -1
  87. data/lib/lingara/models/plan_reason.rb +42 -0
  88. data/lib/lingara/models/plan_result.rb +1 -1
  89. data/lib/lingara/models/plan_set.rb +1 -1
  90. data/lib/lingara/models/plan_started.rb +1 -1
  91. data/lib/lingara/models/plan_status.rb +1 -1
  92. data/lib/lingara/models/plan_word.rb +1 -1
  93. data/lib/lingara/models/practice_completed_data.rb +1 -1
  94. data/lib/lingara/models/practice_item.rb +1 -1
  95. data/lib/lingara/models/practice_outcome.rb +1 -1
  96. data/lib/lingara/models/reaction_report.rb +1 -1
  97. data/lib/lingara/models/reaction_status.rb +1 -1
  98. data/lib/lingara/models/rename_canvas_request.rb +1 -1
  99. data/lib/lingara/models/rename_dialogue_request.rb +1 -1
  100. data/lib/lingara/models/save_canvas_draft_request.rb +1 -1
  101. data/lib/lingara/models/save_dialogue_draft_request.rb +2 -2
  102. data/lib/lingara/models/send_dialogue_turn_event_delta.rb +1 -1
  103. data/lib/lingara/models/send_dialogue_turn_event_done.rb +1 -1
  104. data/lib/lingara/models/send_dialogue_turn_event_error.rb +1 -1
  105. data/lib/lingara/models/send_dialogue_turn_event_notice.rb +1 -1
  106. data/lib/lingara/models/send_dialogue_turn_event_transition.rb +1 -1
  107. data/lib/lingara/models/send_tutor_message_event_delta.rb +1 -1
  108. data/lib/lingara/models/send_tutor_message_event_done.rb +1 -1
  109. data/lib/lingara/models/send_tutor_message_event_error.rb +1 -1
  110. data/lib/lingara/models/send_tutor_message_event_notice.rb +1 -1
  111. data/lib/lingara/models/speaker.rb +1 -1
  112. data/lib/lingara/models/stream_error.rb +1 -1
  113. data/lib/lingara/models/stream_events_event_done.rb +1 -1
  114. data/lib/lingara/models/stream_events_event_error.rb +1 -1
  115. data/lib/lingara/models/stream_events_event_event.rb +1 -1
  116. data/lib/lingara/models/stream_lesson_plan_event_error.rb +1 -1
  117. data/lib/lingara/models/stream_lesson_plan_event_pending.rb +1 -1
  118. data/lib/lingara/models/stream_lesson_plan_event_phase.rb +1 -1
  119. data/lib/lingara/models/stream_lesson_plan_event_result.rb +1 -1
  120. data/lib/lingara/models/stream_lesson_plan_event_started.rb +1 -1
  121. data/lib/lingara/models/threshold_scope.rb +1 -1
  122. data/lib/lingara/models/turn_delta.rb +1 -1
  123. data/lib/lingara/models/turn_entry.rb +1 -1
  124. data/lib/lingara/models/turn_role.rb +1 -1
  125. data/lib/lingara/models/tutor_turn_request.rb +1 -1
  126. data/lib/lingara/models/update_available.rb +1 -1
  127. data/lib/lingara/models/usage.rb +1 -1
  128. data/lib/lingara/models/usage_ledger.rb +1 -1
  129. data/lib/lingara/models/usage_threshold_reached_data.rb +1 -1
  130. data/lib/lingara/models/version_detail.rb +1 -1
  131. data/lib/lingara/models/version_history_entry.rb +1 -1
  132. data/lib/lingara/models/version_list.rb +1 -1
  133. data/lib/lingara/models/version_spec.rb +1 -1
  134. data/lib/lingara/models/version_state.rb +1 -1
  135. data/lib/lingara/models/version_summary.rb +1 -1
  136. data/lib/lingara/models/visited_beat.rb +269 -0
  137. data/lib/lingara/models/vocab_example.rb +1 -1
  138. data/lib/lingara/models/vocab_item.rb +1 -1
  139. data/lib/lingara/models/vocab_meta.rb +1 -1
  140. data/lib/lingara/models/vocab_request.rb +1 -1
  141. data/lib/lingara/models/vocab_started.rb +1 -1
  142. data/lib/lingara/models/world_context_changed.rb +1 -1
  143. data/lib/lingara/models/world_practice_completed.rb +1 -1
  144. data/lib/lingara/models/world_practice_requested.rb +1 -1
  145. data/lib/lingara/operations.rb +9 -0
  146. data/lib/lingara/response.rb +6 -1
  147. data/lib/lingara/version.rb +3 -3
  148. data/sig/lingara.rbs +3 -0
  149. metadata +14 -2
@@ -0,0 +1,620 @@
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-dauntless-hoopoe
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 DialoguePlanRequest
18
+ # A dialogue.v1 or dialogue.v2 document.
19
+ attr_accessor :document
20
+
21
+ attr_accessor :npc
22
+
23
+ attr_accessor :reason
24
+
25
+ attr_accessor :current
26
+
27
+ attr_accessor :frontier
28
+
29
+ attr_accessor :id_prefix
30
+
31
+ # Topics whose game condition holds now, as your game evaluated them. Fact values are never sent.
32
+ attr_accessor :open_topics
33
+
34
+ attr_accessor :goals_met
35
+
36
+ attr_accessor :visited
37
+
38
+ attr_accessor :turns
39
+
40
+ attr_accessor :beats
41
+
42
+ attr_accessor :history
43
+
44
+ class EnumAttributeValidator
45
+ attr_reader :datatype
46
+ attr_reader :allowable_values
47
+
48
+ def initialize(datatype, allowable_values)
49
+ @allowable_values = allowable_values.map do |value|
50
+ case datatype.to_s
51
+ when /Integer/i
52
+ value.to_i
53
+ when /Float/i
54
+ value.to_f
55
+ else
56
+ value
57
+ end
58
+ end
59
+ end
60
+
61
+ def valid?(value)
62
+ !value || allowable_values.include?(value)
63
+ end
64
+ end
65
+
66
+ # Attribute mapping from ruby-style variable name to JSON key.
67
+ def self.attribute_map
68
+ {
69
+ :'document' => :'document',
70
+ :'npc' => :'npc',
71
+ :'reason' => :'reason',
72
+ :'current' => :'current',
73
+ :'frontier' => :'frontier',
74
+ :'id_prefix' => :'id_prefix',
75
+ :'open_topics' => :'open_topics',
76
+ :'goals_met' => :'goals_met',
77
+ :'visited' => :'visited',
78
+ :'turns' => :'turns',
79
+ :'beats' => :'beats',
80
+ :'history' => :'history'
81
+ }
82
+ end
83
+
84
+ # Returns attribute mapping this model knows about
85
+ def self.acceptable_attribute_map
86
+ attribute_map
87
+ end
88
+
89
+ # Returns all the JSON keys this model knows about
90
+ def self.acceptable_attributes
91
+ acceptable_attribute_map.values
92
+ end
93
+
94
+ # Attribute type mapping.
95
+ def self.openapi_types
96
+ {
97
+ :'document' => :'Object',
98
+ :'npc' => :'String',
99
+ :'reason' => :'PlanReason',
100
+ :'current' => :'String',
101
+ :'frontier' => :'PlanFragment',
102
+ :'id_prefix' => :'String',
103
+ :'open_topics' => :'Array<String>',
104
+ :'goals_met' => :'Array<String>',
105
+ :'visited' => :'Array<VisitedBeat>',
106
+ :'turns' => :'Integer',
107
+ :'beats' => :'Integer',
108
+ :'history' => :'Array<DialogueEntry>'
109
+ }
110
+ end
111
+
112
+ # List of attributes with nullable: true
113
+ def self.openapi_nullable
114
+ Set.new([
115
+ :'current',
116
+ :'frontier',
117
+ ])
118
+ end
119
+
120
+ # Initializes the object
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ def initialize(attributes = {})
123
+ if (!attributes.is_a?(Hash))
124
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Lingara::DialoguePlanRequest` initialize method"
125
+ end
126
+
127
+ # check to see if the attribute exists and convert string to symbol for hash key
128
+ acceptable_attribute_map = self.class.acceptable_attribute_map
129
+ attributes = attributes.each_with_object({}) { |(k, v), h|
130
+ if (!acceptable_attribute_map.key?(k.to_sym))
131
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Lingara::DialoguePlanRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
132
+ end
133
+ h[k.to_sym] = v
134
+ }
135
+
136
+ if attributes.key?(:'document')
137
+ self.document = attributes[:'document']
138
+ else
139
+ self.document = nil
140
+ end
141
+
142
+ if attributes.key?(:'npc')
143
+ self.npc = attributes[:'npc']
144
+ else
145
+ self.npc = nil
146
+ end
147
+
148
+ if attributes.key?(:'reason')
149
+ self.reason = attributes[:'reason']
150
+ else
151
+ self.reason = nil
152
+ end
153
+
154
+ if attributes.key?(:'current')
155
+ self.current = attributes[:'current']
156
+ end
157
+
158
+ if attributes.key?(:'frontier')
159
+ self.frontier = attributes[:'frontier']
160
+ end
161
+
162
+ if attributes.key?(:'id_prefix')
163
+ self.id_prefix = attributes[:'id_prefix']
164
+ else
165
+ self.id_prefix = nil
166
+ end
167
+
168
+ if attributes.key?(:'open_topics')
169
+ if (value = attributes[:'open_topics']).is_a?(Array)
170
+ self.open_topics = value
171
+ end
172
+ end
173
+
174
+ if attributes.key?(:'goals_met')
175
+ if (value = attributes[:'goals_met']).is_a?(Array)
176
+ self.goals_met = value
177
+ end
178
+ end
179
+
180
+ if attributes.key?(:'visited')
181
+ if (value = attributes[:'visited']).is_a?(Array)
182
+ self.visited = value
183
+ end
184
+ end
185
+
186
+ if attributes.key?(:'turns')
187
+ self.turns = attributes[:'turns']
188
+ else
189
+ self.turns = nil
190
+ end
191
+
192
+ if attributes.key?(:'beats')
193
+ self.beats = attributes[:'beats']
194
+ else
195
+ self.beats = nil
196
+ end
197
+
198
+ if attributes.key?(:'history')
199
+ if (value = attributes[:'history']).is_a?(Array)
200
+ self.history = value
201
+ end
202
+ end
203
+ end
204
+
205
+ # Show invalid properties with the reasons. Usually used together with valid?
206
+ # @return Array for valid properties with the reasons
207
+ def list_invalid_properties
208
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
209
+ invalid_properties = Array.new
210
+ if @document.nil?
211
+ invalid_properties.push('invalid value for "document", document cannot be nil.')
212
+ end
213
+
214
+ if @npc.nil?
215
+ invalid_properties.push('invalid value for "npc", npc cannot be nil.')
216
+ end
217
+
218
+ if @npc.to_s.length > 48
219
+ invalid_properties.push('invalid value for "npc", the character length must be smaller than or equal to 48.')
220
+ end
221
+
222
+ if @npc.to_s.length < 1
223
+ invalid_properties.push('invalid value for "npc", the character length must be greater than or equal to 1.')
224
+ end
225
+
226
+ if @reason.nil?
227
+ invalid_properties.push('invalid value for "reason", reason cannot be nil.')
228
+ end
229
+
230
+ if !@current.nil? && @current.to_s.length > 24
231
+ invalid_properties.push('invalid value for "current", the character length must be smaller than or equal to 24.')
232
+ end
233
+
234
+ if !@current.nil? && @current.to_s.length < 1
235
+ invalid_properties.push('invalid value for "current", the character length must be greater than or equal to 1.')
236
+ end
237
+
238
+ if @id_prefix.nil?
239
+ invalid_properties.push('invalid value for "id_prefix", id_prefix cannot be nil.')
240
+ end
241
+
242
+ pattern = Regexp.new(/^[a-z][a-z0-9]{0,7}$/)
243
+ if @id_prefix !~ pattern
244
+ invalid_properties.push("invalid value for \"id_prefix\", must conform to the pattern #{pattern}.")
245
+ end
246
+
247
+ if !@open_topics.nil? && @open_topics.length > 16
248
+ invalid_properties.push('invalid value for "open_topics", number of items must be less than or equal to 16.')
249
+ end
250
+
251
+ if !@goals_met.nil? && @goals_met.length > 8
252
+ invalid_properties.push('invalid value for "goals_met", number of items must be less than or equal to 8.')
253
+ end
254
+
255
+ if !@visited.nil? && @visited.length > 16
256
+ invalid_properties.push('invalid value for "visited", number of items must be less than or equal to 16.')
257
+ end
258
+
259
+ if @turns.nil?
260
+ invalid_properties.push('invalid value for "turns", turns cannot be nil.')
261
+ end
262
+
263
+ if @turns > 65535
264
+ invalid_properties.push('invalid value for "turns", must be smaller than or equal to 65535.')
265
+ end
266
+
267
+ if @turns < 0
268
+ invalid_properties.push('invalid value for "turns", must be greater than or equal to 0.')
269
+ end
270
+
271
+ if @beats.nil?
272
+ invalid_properties.push('invalid value for "beats", beats cannot be nil.')
273
+ end
274
+
275
+ if @beats > 65535
276
+ invalid_properties.push('invalid value for "beats", must be smaller than or equal to 65535.')
277
+ end
278
+
279
+ if @beats < 0
280
+ invalid_properties.push('invalid value for "beats", must be greater than or equal to 0.')
281
+ end
282
+
283
+ if !@history.nil? && @history.length > 12
284
+ invalid_properties.push('invalid value for "history", number of items must be less than or equal to 12.')
285
+ end
286
+
287
+ invalid_properties
288
+ end
289
+
290
+ # Check to see if the all the properties in the model are valid
291
+ # @return true if the model is valid
292
+ def valid?
293
+ warn '[DEPRECATED] the `valid?` method is obsolete'
294
+ return false if @document.nil?
295
+ return false if @npc.nil?
296
+ return false if @npc.to_s.length > 48
297
+ return false if @npc.to_s.length < 1
298
+ return false if @reason.nil?
299
+ return false if !@current.nil? && @current.to_s.length > 24
300
+ return false if !@current.nil? && @current.to_s.length < 1
301
+ return false if @id_prefix.nil?
302
+ return false if @id_prefix !~ Regexp.new(/^[a-z][a-z0-9]{0,7}$/)
303
+ return false if !@open_topics.nil? && @open_topics.length > 16
304
+ return false if !@goals_met.nil? && @goals_met.length > 8
305
+ return false if !@visited.nil? && @visited.length > 16
306
+ return false if @turns.nil?
307
+ return false if @turns > 65535
308
+ return false if @turns < 0
309
+ return false if @beats.nil?
310
+ return false if @beats > 65535
311
+ return false if @beats < 0
312
+ return false if !@history.nil? && @history.length > 12
313
+ true
314
+ end
315
+
316
+ # Custom attribute writer method with validation
317
+ # @param [Object] document Value to be assigned
318
+ def document=(document)
319
+ if document.nil?
320
+ fail ArgumentError, 'document cannot be nil'
321
+ end
322
+
323
+ @document = document
324
+ end
325
+
326
+ # Custom attribute writer method with validation
327
+ # @param [Object] npc Value to be assigned
328
+ def npc=(npc)
329
+ if npc.nil?
330
+ fail ArgumentError, 'npc cannot be nil'
331
+ end
332
+
333
+ if npc.to_s.length > 48
334
+ fail ArgumentError, 'invalid value for "npc", the character length must be smaller than or equal to 48.'
335
+ end
336
+
337
+ if npc.to_s.length < 1
338
+ fail ArgumentError, 'invalid value for "npc", the character length must be greater than or equal to 1.'
339
+ end
340
+
341
+ @npc = npc
342
+ end
343
+
344
+ # Custom attribute writer method with validation
345
+ # @param [Object] reason Value to be assigned
346
+ def reason=(reason)
347
+ if reason.nil?
348
+ fail ArgumentError, 'reason cannot be nil'
349
+ end
350
+
351
+ @reason = reason
352
+ end
353
+
354
+ # Custom attribute writer method with validation
355
+ # @param [Object] current Value to be assigned
356
+ def current=(current)
357
+ if !current.nil? && current.to_s.length > 24
358
+ fail ArgumentError, 'invalid value for "current", the character length must be smaller than or equal to 24.'
359
+ end
360
+
361
+ if !current.nil? && current.to_s.length < 1
362
+ fail ArgumentError, 'invalid value for "current", the character length must be greater than or equal to 1.'
363
+ end
364
+
365
+ @current = current
366
+ end
367
+
368
+ # Custom attribute writer method with validation
369
+ # @param [Object] id_prefix Value to be assigned
370
+ def id_prefix=(id_prefix)
371
+ if id_prefix.nil?
372
+ fail ArgumentError, 'id_prefix cannot be nil'
373
+ end
374
+
375
+ pattern = Regexp.new(/^[a-z][a-z0-9]{0,7}$/)
376
+ if id_prefix !~ pattern
377
+ fail ArgumentError, "invalid value for \"id_prefix\", must conform to the pattern #{pattern}."
378
+ end
379
+
380
+ @id_prefix = id_prefix
381
+ end
382
+
383
+ # Custom attribute writer method with validation
384
+ # @param [Object] open_topics Value to be assigned
385
+ def open_topics=(open_topics)
386
+ if open_topics.nil?
387
+ fail ArgumentError, 'open_topics cannot be nil'
388
+ end
389
+
390
+ if open_topics.length > 16
391
+ fail ArgumentError, 'invalid value for "open_topics", number of items must be less than or equal to 16.'
392
+ end
393
+
394
+ @open_topics = open_topics
395
+ end
396
+
397
+ # Custom attribute writer method with validation
398
+ # @param [Object] goals_met Value to be assigned
399
+ def goals_met=(goals_met)
400
+ if goals_met.nil?
401
+ fail ArgumentError, 'goals_met cannot be nil'
402
+ end
403
+
404
+ if goals_met.length > 8
405
+ fail ArgumentError, 'invalid value for "goals_met", number of items must be less than or equal to 8.'
406
+ end
407
+
408
+ @goals_met = goals_met
409
+ end
410
+
411
+ # Custom attribute writer method with validation
412
+ # @param [Object] visited Value to be assigned
413
+ def visited=(visited)
414
+ if visited.nil?
415
+ fail ArgumentError, 'visited cannot be nil'
416
+ end
417
+
418
+ if visited.length > 16
419
+ fail ArgumentError, 'invalid value for "visited", number of items must be less than or equal to 16.'
420
+ end
421
+
422
+ @visited = visited
423
+ end
424
+
425
+ # Custom attribute writer method with validation
426
+ # @param [Object] turns Value to be assigned
427
+ def turns=(turns)
428
+ if turns.nil?
429
+ fail ArgumentError, 'turns cannot be nil'
430
+ end
431
+
432
+ if turns > 65535
433
+ fail ArgumentError, 'invalid value for "turns", must be smaller than or equal to 65535.'
434
+ end
435
+
436
+ if turns < 0
437
+ fail ArgumentError, 'invalid value for "turns", must be greater than or equal to 0.'
438
+ end
439
+
440
+ @turns = turns
441
+ end
442
+
443
+ # Custom attribute writer method with validation
444
+ # @param [Object] beats Value to be assigned
445
+ def beats=(beats)
446
+ if beats.nil?
447
+ fail ArgumentError, 'beats cannot be nil'
448
+ end
449
+
450
+ if beats > 65535
451
+ fail ArgumentError, 'invalid value for "beats", must be smaller than or equal to 65535.'
452
+ end
453
+
454
+ if beats < 0
455
+ fail ArgumentError, 'invalid value for "beats", must be greater than or equal to 0.'
456
+ end
457
+
458
+ @beats = beats
459
+ end
460
+
461
+ # Custom attribute writer method with validation
462
+ # @param [Object] history Value to be assigned
463
+ def history=(history)
464
+ if history.nil?
465
+ fail ArgumentError, 'history cannot be nil'
466
+ end
467
+
468
+ if history.length > 12
469
+ fail ArgumentError, 'invalid value for "history", number of items must be less than or equal to 12.'
470
+ end
471
+
472
+ @history = history
473
+ end
474
+
475
+ # Checks equality by comparing each attribute.
476
+ # @param [Object] Object to be compared
477
+ def ==(o)
478
+ return true if self.equal?(o)
479
+ self.class == o.class &&
480
+ document == o.document &&
481
+ npc == o.npc &&
482
+ reason == o.reason &&
483
+ current == o.current &&
484
+ frontier == o.frontier &&
485
+ id_prefix == o.id_prefix &&
486
+ open_topics == o.open_topics &&
487
+ goals_met == o.goals_met &&
488
+ visited == o.visited &&
489
+ turns == o.turns &&
490
+ beats == o.beats &&
491
+ history == o.history
492
+ end
493
+
494
+ # @see the `==` method
495
+ # @param [Object] Object to be compared
496
+ def eql?(o)
497
+ self == o
498
+ end
499
+
500
+ # Calculates hash code according to all attributes.
501
+ # @return [Integer] Hash code
502
+ def hash
503
+ [document, npc, reason, current, frontier, id_prefix, open_topics, goals_met, visited, turns, beats, history].hash
504
+ end
505
+
506
+ # Builds the object from hash
507
+ # @param [Hash] attributes Model attributes in the form of hash
508
+ # @return [Object] Returns the model itself
509
+ def self.build_from_hash(attributes)
510
+ return nil unless attributes.is_a?(Hash)
511
+ attributes = attributes.transform_keys(&:to_sym)
512
+ transformed_hash = {}
513
+ openapi_types.each_pair do |key, type|
514
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
515
+ transformed_hash["#{key}"] = nil
516
+ elsif type =~ /\AArray<(.*)>/i
517
+ # check to ensure the input is an array given that the attribute
518
+ # is documented as an array but the input is not
519
+ if attributes[attribute_map[key]].is_a?(Array)
520
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
521
+ end
522
+ elsif !attributes[attribute_map[key]].nil?
523
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
524
+ end
525
+ end
526
+ new(transformed_hash)
527
+ end
528
+
529
+ # Deserializes the data based on type
530
+ # @param string type Data type
531
+ # @param string value Value to be deserialized
532
+ # @return [Object] Deserialized data
533
+ def self._deserialize(type, value)
534
+ case type.to_sym
535
+ when :Time
536
+ Time.parse(value)
537
+ when :Date
538
+ Date.parse(value)
539
+ when :String
540
+ value.to_s
541
+ when :Integer
542
+ value.to_i
543
+ when :Float
544
+ value.to_f
545
+ when :Boolean
546
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
547
+ true
548
+ else
549
+ false
550
+ end
551
+ when :Object
552
+ # generic object (usually a Hash), return directly
553
+ value
554
+ when /\AArray<(?<inner_type>.+)>\z/
555
+ inner_type = Regexp.last_match[:inner_type]
556
+ value.map { |v| _deserialize(inner_type, v) }
557
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
558
+ k_type = Regexp.last_match[:k_type]
559
+ v_type = Regexp.last_match[:v_type]
560
+ {}.tap do |hash|
561
+ value.each do |k, v|
562
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
563
+ end
564
+ end
565
+ else # model
566
+ # models (e.g. Pet) or oneOf
567
+ klass = Lingara.const_get(type)
568
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
569
+ end
570
+ end
571
+
572
+ # Returns the string representation of the object
573
+ # @return [String] String presentation of the object
574
+ def to_s
575
+ to_hash.to_s
576
+ end
577
+
578
+ # to_body is an alias to to_hash (backward compatibility)
579
+ # @return [Hash] Returns the object in the form of hash
580
+ def to_body
581
+ to_hash
582
+ end
583
+
584
+ # Returns the object in the form of hash
585
+ # @return [Hash] Returns the object in the form of hash
586
+ def to_hash
587
+ hash = {}
588
+ self.class.attribute_map.each_pair do |attr, param|
589
+ value = self.send(attr)
590
+ if value.nil?
591
+ is_nullable = self.class.openapi_nullable.include?(attr)
592
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
593
+ end
594
+
595
+ hash[param] = _to_hash(value)
596
+ end
597
+ hash
598
+ end
599
+
600
+ # Outputs non-array value in the form of hash
601
+ # For object, use to_hash. Otherwise, just return the value
602
+ # @param [Object] value Any valid value
603
+ # @return [Hash] Returns the value in the form of hash
604
+ def _to_hash(value)
605
+ if value.is_a?(Array)
606
+ value.compact.map { |v| _to_hash(v) }
607
+ elsif value.is_a?(Hash)
608
+ {}.tap do |hash|
609
+ value.each { |k, v| hash[k] = _to_hash(v) }
610
+ end
611
+ elsif value.respond_to? :to_hash
612
+ value.to_hash
613
+ else
614
+ value
615
+ end
616
+ end
617
+
618
+ end
619
+
620
+ end