daily-ruby 0.0.0

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 (59) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +79 -0
  4. data/README.md +119 -0
  5. data/Rakefile +10 -0
  6. data/daily-ruby.gemspec +40 -0
  7. data/daily.yaml +422 -0
  8. data/docs/CreateMeetingToken200Response.md +18 -0
  9. data/docs/MeetingTokenRequest.md +18 -0
  10. data/docs/MeetingTokenRequestProperties.md +56 -0
  11. data/docs/MeetingTokenRequestPropertiesPermissions.md +22 -0
  12. data/docs/MeetingTokenRequestPropertiesPermissionsCanAdmin.md +49 -0
  13. data/docs/MeetingTokenRequestPropertiesPermissionsCanSend.md +49 -0
  14. data/docs/MeetingTokensApi.md +79 -0
  15. data/docs/RoomApi.md +227 -0
  16. data/docs/RoomDeletedResponse.md +20 -0
  17. data/docs/RoomNotFoundResponse.md +20 -0
  18. data/docs/RoomRequest.md +22 -0
  19. data/docs/RoomRequestProperties.md +76 -0
  20. data/docs/RoomResponse.md +28 -0
  21. data/docs/ServerErrorResponse.md +18 -0
  22. data/git_push.sh +57 -0
  23. data/lib/daily-ruby/api/meeting_tokens_api.rb +86 -0
  24. data/lib/daily-ruby/api/room_api.rb +218 -0
  25. data/lib/daily-ruby/api_client.rb +431 -0
  26. data/lib/daily-ruby/api_error.rb +58 -0
  27. data/lib/daily-ruby/configuration.rb +382 -0
  28. data/lib/daily-ruby/models/create_meeting_token200_response.rb +214 -0
  29. data/lib/daily-ruby/models/meeting_token_request.rb +215 -0
  30. data/lib/daily-ruby/models/meeting_token_request_properties.rb +438 -0
  31. data/lib/daily-ruby/models/meeting_token_request_properties_permissions.rb +232 -0
  32. data/lib/daily-ruby/models/meeting_token_request_properties_permissions_can_admin.rb +105 -0
  33. data/lib/daily-ruby/models/meeting_token_request_properties_permissions_can_send.rb +105 -0
  34. data/lib/daily-ruby/models/room_deleted_response.rb +224 -0
  35. data/lib/daily-ruby/models/room_not_found_response.rb +224 -0
  36. data/lib/daily-ruby/models/room_request.rb +267 -0
  37. data/lib/daily-ruby/models/room_request_properties.rb +521 -0
  38. data/lib/daily-ruby/models/room_response.rb +260 -0
  39. data/lib/daily-ruby/models/server_error_response.rb +215 -0
  40. data/lib/daily-ruby/version.rb +15 -0
  41. data/lib/daily-ruby.rb +53 -0
  42. data/run.sh +16 -0
  43. data/script.rb +35 -0
  44. data/spec/api/meeting_tokens_api_spec.rb +47 -0
  45. data/spec/api/room_api_spec.rb +74 -0
  46. data/spec/models/create_meeting_token200_response_spec.rb +36 -0
  47. data/spec/models/meeting_token_request_properties_permissions_can_admin_spec.rb +32 -0
  48. data/spec/models/meeting_token_request_properties_permissions_can_send_spec.rb +32 -0
  49. data/spec/models/meeting_token_request_properties_permissions_spec.rb +48 -0
  50. data/spec/models/meeting_token_request_properties_spec.rb +158 -0
  51. data/spec/models/meeting_token_request_spec.rb +36 -0
  52. data/spec/models/room_deleted_response_spec.rb +42 -0
  53. data/spec/models/room_not_found_response_spec.rb +42 -0
  54. data/spec/models/room_request_properties_spec.rb +218 -0
  55. data/spec/models/room_request_spec.rb +52 -0
  56. data/spec/models/room_response_spec.rb +66 -0
  57. data/spec/models/server_error_response_spec.rb +36 -0
  58. data/spec/spec_helper.rb +111 -0
  59. metadata +169 -0
@@ -0,0 +1,521 @@
1
+ =begin
2
+ #Daily
3
+
4
+ #The official library for communicating with the Daily REST API.
5
+
6
+ The version of the OpenAPI document: 0.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Daily
17
+ class RoomRequestProperties
18
+ attr_accessor :nbf
19
+
20
+ attr_accessor :exp
21
+
22
+ attr_accessor :max_participants
23
+
24
+ attr_accessor :enable_people_ui
25
+
26
+ attr_accessor :enable_pip_ui
27
+
28
+ attr_accessor :enable_emoji_reactions
29
+
30
+ attr_accessor :enable_hand_raising
31
+
32
+ attr_accessor :enable_prejoin_ui
33
+
34
+ attr_accessor :enable_live_captions_ui
35
+
36
+ attr_accessor :enable_network_ui
37
+
38
+ attr_accessor :enable_noise_cancellation_ui
39
+
40
+ attr_accessor :enable_breakout_rooms
41
+
42
+ attr_accessor :enable_knocking
43
+
44
+ attr_accessor :enable_screenshare
45
+
46
+ attr_accessor :enable_video_processing_ui
47
+
48
+ attr_accessor :enable_chat
49
+
50
+ attr_accessor :start_video_off
51
+
52
+ attr_accessor :start_audio_off
53
+
54
+ attr_accessor :owner_only_broadcast
55
+
56
+ attr_accessor :enable_recording
57
+
58
+ attr_accessor :eject_at_room_exp
59
+
60
+ attr_accessor :eject_after_elapsed
61
+
62
+ attr_accessor :enable_advanced_chat
63
+
64
+ attr_accessor :enable_hidden_participants
65
+
66
+ attr_accessor :enable_mesh_sfu
67
+
68
+ attr_accessor :sfu_switchover
69
+
70
+ attr_accessor :experimental_optimize_large_calls
71
+
72
+ attr_accessor :lang
73
+
74
+ attr_accessor :meeting_join_hook
75
+
76
+ attr_accessor :geo
77
+
78
+ class EnumAttributeValidator
79
+ attr_reader :datatype
80
+ attr_reader :allowable_values
81
+
82
+ def initialize(datatype, allowable_values)
83
+ @allowable_values = allowable_values.map do |value|
84
+ case datatype.to_s
85
+ when /Integer/i
86
+ value.to_i
87
+ when /Float/i
88
+ value.to_f
89
+ else
90
+ value
91
+ end
92
+ end
93
+ end
94
+
95
+ def valid?(value)
96
+ !value || allowable_values.include?(value)
97
+ end
98
+ end
99
+
100
+ # Attribute mapping from ruby-style variable name to JSON key.
101
+ def self.attribute_map
102
+ {
103
+ :'nbf' => :'nbf',
104
+ :'exp' => :'exp',
105
+ :'max_participants' => :'max_participants',
106
+ :'enable_people_ui' => :'enable_people_ui',
107
+ :'enable_pip_ui' => :'enable_pip_ui',
108
+ :'enable_emoji_reactions' => :'enable_emoji_reactions',
109
+ :'enable_hand_raising' => :'enable_hand_raising',
110
+ :'enable_prejoin_ui' => :'enable_prejoin_ui',
111
+ :'enable_live_captions_ui' => :'enable_live_captions_ui',
112
+ :'enable_network_ui' => :'enable_network_ui',
113
+ :'enable_noise_cancellation_ui' => :'enable_noise_cancellation_ui',
114
+ :'enable_breakout_rooms' => :'enable_breakout_rooms',
115
+ :'enable_knocking' => :'enable_knocking',
116
+ :'enable_screenshare' => :'enable_screenshare',
117
+ :'enable_video_processing_ui' => :'enable_video_processing_ui',
118
+ :'enable_chat' => :'enable_chat',
119
+ :'start_video_off' => :'start_video_off',
120
+ :'start_audio_off' => :'start_audio_off',
121
+ :'owner_only_broadcast' => :'owner_only_broadcast',
122
+ :'enable_recording' => :'enable_recording',
123
+ :'eject_at_room_exp' => :'eject_at_room_exp',
124
+ :'eject_after_elapsed' => :'eject_after_elapsed',
125
+ :'enable_advanced_chat' => :'enable_advanced_chat',
126
+ :'enable_hidden_participants' => :'enable_hidden_participants',
127
+ :'enable_mesh_sfu' => :'enable_mesh_sfu',
128
+ :'sfu_switchover' => :'sfu_switchover',
129
+ :'experimental_optimize_large_calls' => :'experimental_optimize_large_calls',
130
+ :'lang' => :'lang',
131
+ :'meeting_join_hook' => :'meeting_join_hook',
132
+ :'geo' => :'geo'
133
+ }
134
+ end
135
+
136
+ # Returns all the JSON keys this model knows about
137
+ def self.acceptable_attributes
138
+ attribute_map.values
139
+ end
140
+
141
+ # Attribute type mapping.
142
+ def self.openapi_types
143
+ {
144
+ :'nbf' => :'Integer',
145
+ :'exp' => :'Integer',
146
+ :'max_participants' => :'Integer',
147
+ :'enable_people_ui' => :'Boolean',
148
+ :'enable_pip_ui' => :'Boolean',
149
+ :'enable_emoji_reactions' => :'Boolean',
150
+ :'enable_hand_raising' => :'Boolean',
151
+ :'enable_prejoin_ui' => :'Boolean',
152
+ :'enable_live_captions_ui' => :'Boolean',
153
+ :'enable_network_ui' => :'Boolean',
154
+ :'enable_noise_cancellation_ui' => :'Boolean',
155
+ :'enable_breakout_rooms' => :'Boolean',
156
+ :'enable_knocking' => :'Boolean',
157
+ :'enable_screenshare' => :'Boolean',
158
+ :'enable_video_processing_ui' => :'Boolean',
159
+ :'enable_chat' => :'Boolean',
160
+ :'start_video_off' => :'Boolean',
161
+ :'start_audio_off' => :'Boolean',
162
+ :'owner_only_broadcast' => :'Boolean',
163
+ :'enable_recording' => :'String',
164
+ :'eject_at_room_exp' => :'Boolean',
165
+ :'eject_after_elapsed' => :'Boolean',
166
+ :'enable_advanced_chat' => :'Boolean',
167
+ :'enable_hidden_participants' => :'Boolean',
168
+ :'enable_mesh_sfu' => :'Boolean',
169
+ :'sfu_switchover' => :'Float',
170
+ :'experimental_optimize_large_calls' => :'Boolean',
171
+ :'lang' => :'String',
172
+ :'meeting_join_hook' => :'String',
173
+ :'geo' => :'String'
174
+ }
175
+ end
176
+
177
+ # List of attributes with nullable: true
178
+ def self.openapi_nullable
179
+ Set.new([
180
+ ])
181
+ end
182
+
183
+ # Initializes the object
184
+ # @param [Hash] attributes Model attributes in the form of hash
185
+ def initialize(attributes = {})
186
+ if (!attributes.is_a?(Hash))
187
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Daily::RoomRequestProperties` initialize method"
188
+ end
189
+
190
+ # check to see if the attribute exists and convert string to symbol for hash key
191
+ attributes = attributes.each_with_object({}) { |(k, v), h|
192
+ if (!self.class.attribute_map.key?(k.to_sym))
193
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Daily::RoomRequestProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
194
+ end
195
+ h[k.to_sym] = v
196
+ }
197
+
198
+ if attributes.key?(:'nbf')
199
+ self.nbf = attributes[:'nbf']
200
+ end
201
+
202
+ if attributes.key?(:'exp')
203
+ self.exp = attributes[:'exp']
204
+ end
205
+
206
+ if attributes.key?(:'max_participants')
207
+ self.max_participants = attributes[:'max_participants']
208
+ end
209
+
210
+ if attributes.key?(:'enable_people_ui')
211
+ self.enable_people_ui = attributes[:'enable_people_ui']
212
+ end
213
+
214
+ if attributes.key?(:'enable_pip_ui')
215
+ self.enable_pip_ui = attributes[:'enable_pip_ui']
216
+ end
217
+
218
+ if attributes.key?(:'enable_emoji_reactions')
219
+ self.enable_emoji_reactions = attributes[:'enable_emoji_reactions']
220
+ end
221
+
222
+ if attributes.key?(:'enable_hand_raising')
223
+ self.enable_hand_raising = attributes[:'enable_hand_raising']
224
+ end
225
+
226
+ if attributes.key?(:'enable_prejoin_ui')
227
+ self.enable_prejoin_ui = attributes[:'enable_prejoin_ui']
228
+ end
229
+
230
+ if attributes.key?(:'enable_live_captions_ui')
231
+ self.enable_live_captions_ui = attributes[:'enable_live_captions_ui']
232
+ end
233
+
234
+ if attributes.key?(:'enable_network_ui')
235
+ self.enable_network_ui = attributes[:'enable_network_ui']
236
+ end
237
+
238
+ if attributes.key?(:'enable_noise_cancellation_ui')
239
+ self.enable_noise_cancellation_ui = attributes[:'enable_noise_cancellation_ui']
240
+ end
241
+
242
+ if attributes.key?(:'enable_breakout_rooms')
243
+ self.enable_breakout_rooms = attributes[:'enable_breakout_rooms']
244
+ end
245
+
246
+ if attributes.key?(:'enable_knocking')
247
+ self.enable_knocking = attributes[:'enable_knocking']
248
+ end
249
+
250
+ if attributes.key?(:'enable_screenshare')
251
+ self.enable_screenshare = attributes[:'enable_screenshare']
252
+ end
253
+
254
+ if attributes.key?(:'enable_video_processing_ui')
255
+ self.enable_video_processing_ui = attributes[:'enable_video_processing_ui']
256
+ end
257
+
258
+ if attributes.key?(:'enable_chat')
259
+ self.enable_chat = attributes[:'enable_chat']
260
+ end
261
+
262
+ if attributes.key?(:'start_video_off')
263
+ self.start_video_off = attributes[:'start_video_off']
264
+ end
265
+
266
+ if attributes.key?(:'start_audio_off')
267
+ self.start_audio_off = attributes[:'start_audio_off']
268
+ end
269
+
270
+ if attributes.key?(:'owner_only_broadcast')
271
+ self.owner_only_broadcast = attributes[:'owner_only_broadcast']
272
+ end
273
+
274
+ if attributes.key?(:'enable_recording')
275
+ self.enable_recording = attributes[:'enable_recording']
276
+ end
277
+
278
+ if attributes.key?(:'eject_at_room_exp')
279
+ self.eject_at_room_exp = attributes[:'eject_at_room_exp']
280
+ end
281
+
282
+ if attributes.key?(:'eject_after_elapsed')
283
+ self.eject_after_elapsed = attributes[:'eject_after_elapsed']
284
+ end
285
+
286
+ if attributes.key?(:'enable_advanced_chat')
287
+ self.enable_advanced_chat = attributes[:'enable_advanced_chat']
288
+ end
289
+
290
+ if attributes.key?(:'enable_hidden_participants')
291
+ self.enable_hidden_participants = attributes[:'enable_hidden_participants']
292
+ end
293
+
294
+ if attributes.key?(:'enable_mesh_sfu')
295
+ self.enable_mesh_sfu = attributes[:'enable_mesh_sfu']
296
+ end
297
+
298
+ if attributes.key?(:'sfu_switchover')
299
+ self.sfu_switchover = attributes[:'sfu_switchover']
300
+ end
301
+
302
+ if attributes.key?(:'experimental_optimize_large_calls')
303
+ self.experimental_optimize_large_calls = attributes[:'experimental_optimize_large_calls']
304
+ end
305
+
306
+ if attributes.key?(:'lang')
307
+ self.lang = attributes[:'lang']
308
+ end
309
+
310
+ if attributes.key?(:'meeting_join_hook')
311
+ self.meeting_join_hook = attributes[:'meeting_join_hook']
312
+ end
313
+
314
+ if attributes.key?(:'geo')
315
+ self.geo = attributes[:'geo']
316
+ end
317
+ end
318
+
319
+ # Show invalid properties with the reasons. Usually used together with valid?
320
+ # @return Array for valid properties with the reasons
321
+ def list_invalid_properties
322
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
323
+ invalid_properties = Array.new
324
+ invalid_properties
325
+ end
326
+
327
+ # Check to see if the all the properties in the model are valid
328
+ # @return true if the model is valid
329
+ def valid?
330
+ warn '[DEPRECATED] the `valid?` method is obsolete'
331
+ enable_recording_validator = EnumAttributeValidator.new('String', ["local", "cloud", "raw-tracks", "unknown_default_open_api"])
332
+ return false unless enable_recording_validator.valid?(@enable_recording)
333
+ lang_validator = EnumAttributeValidator.new('String', ["de", "en", "es", "fi", "fr", "it", "jp", "ka", "nl", "no", "pt", "pt-BR", "pl", "ru", "sv", "tr", "user", "unknown_default_open_api"])
334
+ return false unless lang_validator.valid?(@lang)
335
+ true
336
+ end
337
+
338
+ # Custom attribute writer method checking allowed values (enum).
339
+ # @param [Object] enable_recording Object to be assigned
340
+ def enable_recording=(enable_recording)
341
+ validator = EnumAttributeValidator.new('String', ["local", "cloud", "raw-tracks", "unknown_default_open_api"])
342
+ unless validator.valid?(enable_recording)
343
+ fail ArgumentError, "invalid value for \"enable_recording\", must be one of #{validator.allowable_values}."
344
+ end
345
+ @enable_recording = enable_recording
346
+ end
347
+
348
+ # Custom attribute writer method checking allowed values (enum).
349
+ # @param [Object] lang Object to be assigned
350
+ def lang=(lang)
351
+ validator = EnumAttributeValidator.new('String', ["de", "en", "es", "fi", "fr", "it", "jp", "ka", "nl", "no", "pt", "pt-BR", "pl", "ru", "sv", "tr", "user", "unknown_default_open_api"])
352
+ unless validator.valid?(lang)
353
+ fail ArgumentError, "invalid value for \"lang\", must be one of #{validator.allowable_values}."
354
+ end
355
+ @lang = lang
356
+ end
357
+
358
+ # Checks equality by comparing each attribute.
359
+ # @param [Object] Object to be compared
360
+ def ==(o)
361
+ return true if self.equal?(o)
362
+ self.class == o.class &&
363
+ nbf == o.nbf &&
364
+ exp == o.exp &&
365
+ max_participants == o.max_participants &&
366
+ enable_people_ui == o.enable_people_ui &&
367
+ enable_pip_ui == o.enable_pip_ui &&
368
+ enable_emoji_reactions == o.enable_emoji_reactions &&
369
+ enable_hand_raising == o.enable_hand_raising &&
370
+ enable_prejoin_ui == o.enable_prejoin_ui &&
371
+ enable_live_captions_ui == o.enable_live_captions_ui &&
372
+ enable_network_ui == o.enable_network_ui &&
373
+ enable_noise_cancellation_ui == o.enable_noise_cancellation_ui &&
374
+ enable_breakout_rooms == o.enable_breakout_rooms &&
375
+ enable_knocking == o.enable_knocking &&
376
+ enable_screenshare == o.enable_screenshare &&
377
+ enable_video_processing_ui == o.enable_video_processing_ui &&
378
+ enable_chat == o.enable_chat &&
379
+ start_video_off == o.start_video_off &&
380
+ start_audio_off == o.start_audio_off &&
381
+ owner_only_broadcast == o.owner_only_broadcast &&
382
+ enable_recording == o.enable_recording &&
383
+ eject_at_room_exp == o.eject_at_room_exp &&
384
+ eject_after_elapsed == o.eject_after_elapsed &&
385
+ enable_advanced_chat == o.enable_advanced_chat &&
386
+ enable_hidden_participants == o.enable_hidden_participants &&
387
+ enable_mesh_sfu == o.enable_mesh_sfu &&
388
+ sfu_switchover == o.sfu_switchover &&
389
+ experimental_optimize_large_calls == o.experimental_optimize_large_calls &&
390
+ lang == o.lang &&
391
+ meeting_join_hook == o.meeting_join_hook &&
392
+ geo == o.geo
393
+ end
394
+
395
+ # @see the `==` method
396
+ # @param [Object] Object to be compared
397
+ def eql?(o)
398
+ self == o
399
+ end
400
+
401
+ # Calculates hash code according to all attributes.
402
+ # @return [Integer] Hash code
403
+ def hash
404
+ [nbf, exp, max_participants, enable_people_ui, enable_pip_ui, enable_emoji_reactions, enable_hand_raising, enable_prejoin_ui, enable_live_captions_ui, enable_network_ui, enable_noise_cancellation_ui, enable_breakout_rooms, enable_knocking, enable_screenshare, enable_video_processing_ui, enable_chat, start_video_off, start_audio_off, owner_only_broadcast, enable_recording, eject_at_room_exp, eject_after_elapsed, enable_advanced_chat, enable_hidden_participants, enable_mesh_sfu, sfu_switchover, experimental_optimize_large_calls, lang, meeting_join_hook, geo].hash
405
+ end
406
+
407
+ # Builds the object from hash
408
+ # @param [Hash] attributes Model attributes in the form of hash
409
+ # @return [Object] Returns the model itself
410
+ def self.build_from_hash(attributes)
411
+ return nil unless attributes.is_a?(Hash)
412
+ attributes = attributes.transform_keys(&:to_sym)
413
+ transformed_hash = {}
414
+ openapi_types.each_pair do |key, type|
415
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
416
+ transformed_hash["#{key}"] = nil
417
+ elsif type =~ /\AArray<(.*)>/i
418
+ # check to ensure the input is an array given that the attribute
419
+ # is documented as an array but the input is not
420
+ if attributes[attribute_map[key]].is_a?(Array)
421
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
422
+ end
423
+ elsif !attributes[attribute_map[key]].nil?
424
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
425
+ end
426
+ end
427
+ new(transformed_hash)
428
+ end
429
+
430
+ # Deserializes the data based on type
431
+ # @param string type Data type
432
+ # @param string value Value to be deserialized
433
+ # @return [Object] Deserialized data
434
+ def self._deserialize(type, value)
435
+ case type.to_sym
436
+ when :Time
437
+ Time.parse(value)
438
+ when :Date
439
+ Date.parse(value)
440
+ when :String
441
+ value.to_s
442
+ when :Integer
443
+ value.to_i
444
+ when :Float
445
+ value.to_f
446
+ when :Boolean
447
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
448
+ true
449
+ else
450
+ false
451
+ end
452
+ when :Object
453
+ # generic object (usually a Hash), return directly
454
+ value
455
+ when /\AArray<(?<inner_type>.+)>\z/
456
+ inner_type = Regexp.last_match[:inner_type]
457
+ value.map { |v| _deserialize(inner_type, v) }
458
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
459
+ k_type = Regexp.last_match[:k_type]
460
+ v_type = Regexp.last_match[:v_type]
461
+ {}.tap do |hash|
462
+ value.each do |k, v|
463
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
464
+ end
465
+ end
466
+ else # model
467
+ # models (e.g. Pet) or oneOf
468
+ klass = Daily.const_get(type)
469
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
470
+ end
471
+ end
472
+
473
+ # Returns the string representation of the object
474
+ # @return [String] String presentation of the object
475
+ def to_s
476
+ to_hash.to_s
477
+ end
478
+
479
+ # to_body is an alias to to_hash (backward compatibility)
480
+ # @return [Hash] Returns the object in the form of hash
481
+ def to_body
482
+ to_hash
483
+ end
484
+
485
+ # Returns the object in the form of hash
486
+ # @return [Hash] Returns the object in the form of hash
487
+ def to_hash
488
+ hash = {}
489
+ self.class.attribute_map.each_pair do |attr, param|
490
+ value = self.send(attr)
491
+ if value.nil?
492
+ is_nullable = self.class.openapi_nullable.include?(attr)
493
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
494
+ end
495
+
496
+ hash[param] = _to_hash(value)
497
+ end
498
+ hash
499
+ end
500
+
501
+ # Outputs non-array value in the form of hash
502
+ # For object, use to_hash. Otherwise, just return the value
503
+ # @param [Object] value Any valid value
504
+ # @return [Hash] Returns the value in the form of hash
505
+ def _to_hash(value)
506
+ if value.is_a?(Array)
507
+ value.compact.map { |v| _to_hash(v) }
508
+ elsif value.is_a?(Hash)
509
+ {}.tap do |hash|
510
+ value.each { |k, v| hash[k] = _to_hash(v) }
511
+ end
512
+ elsif value.respond_to? :to_hash
513
+ value.to_hash
514
+ else
515
+ value
516
+ end
517
+ end
518
+
519
+ end
520
+
521
+ end