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