notifo-io-easierlife 1.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 (166) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +167 -0
  4. data/Rakefile +10 -0
  5. data/docs/AddAllowedTopicDto.md +18 -0
  6. data/docs/AddContributorDto.md +20 -0
  7. data/docs/AppContributorDto.md +22 -0
  8. data/docs/AppDetailsDto.md +48 -0
  9. data/docs/AppDto.md +28 -0
  10. data/docs/AppsApi.md +646 -0
  11. data/docs/ConfigsApi.md +127 -0
  12. data/docs/ConfirmMode.md +15 -0
  13. data/docs/CreateEmailTemplateDto.md +18 -0
  14. data/docs/EmailTemplateDto.md +22 -0
  15. data/docs/EmailVerificationStatus.md +15 -0
  16. data/docs/ErrorDto.md +26 -0
  17. data/docs/EventDto.md +40 -0
  18. data/docs/EventsApi.md +142 -0
  19. data/docs/IsoDayOfWeek.md +15 -0
  20. data/docs/ListResponseDtoOfEventDto.md +20 -0
  21. data/docs/ListResponseDtoOfLogEntryDto.md +20 -0
  22. data/docs/ListResponseDtoOfMediaDto.md +20 -0
  23. data/docs/ListResponseDtoOfSubscriptionDto.md +20 -0
  24. data/docs/ListResponseDtoOfTemplateDto.md +20 -0
  25. data/docs/ListResponseDtoOfTopicDto.md +20 -0
  26. data/docs/ListResponseDtoOfUserDto.md +20 -0
  27. data/docs/LogEntryDto.md +24 -0
  28. data/docs/LogsApi.md +78 -0
  29. data/docs/MediaApi.md +382 -0
  30. data/docs/MediaDto.md +30 -0
  31. data/docs/MediaType.md +15 -0
  32. data/docs/NotificationFormattingDto.md +32 -0
  33. data/docs/NotificationSend.md +15 -0
  34. data/docs/NotificationSettingDto.md +20 -0
  35. data/docs/ProfileDto.md +32 -0
  36. data/docs/PublishDto.md +36 -0
  37. data/docs/PublishManyDto.md +18 -0
  38. data/docs/ResizeMode.md +15 -0
  39. data/docs/SchedulingDto.md +24 -0
  40. data/docs/SchedulingType.md +15 -0
  41. data/docs/SubscriptionDto.md +20 -0
  42. data/docs/TemplateDto.md +22 -0
  43. data/docs/TemplatesApi.md +208 -0
  44. data/docs/TopicDto.md +22 -0
  45. data/docs/TopicsApi.md +78 -0
  46. data/docs/UpdateProfileDto.md +28 -0
  47. data/docs/UpsertAppDto.md +36 -0
  48. data/docs/UpsertTemplateDto.md +22 -0
  49. data/docs/UpsertTemplatesDto.md +18 -0
  50. data/docs/UpsertUserDto.md +32 -0
  51. data/docs/UpsertUsersDto.md +18 -0
  52. data/docs/UserApi.md +323 -0
  53. data/docs/UserDto.md +36 -0
  54. data/docs/UsersApi.md +610 -0
  55. data/git_push.sh +58 -0
  56. data/lib/notifo.rb +89 -0
  57. data/lib/notifo/api/apps_api.rb +678 -0
  58. data/lib/notifo/api/configs_api.rb +132 -0
  59. data/lib/notifo/api/events_api.rb +161 -0
  60. data/lib/notifo/api/logs_api.rb +92 -0
  61. data/lib/notifo/api/media_api.rb +419 -0
  62. data/lib/notifo/api/templates_api.rb +228 -0
  63. data/lib/notifo/api/topics_api.rb +92 -0
  64. data/lib/notifo/api/user_api.rb +331 -0
  65. data/lib/notifo/api/users_api.rb +667 -0
  66. data/lib/notifo/api_client.rb +389 -0
  67. data/lib/notifo/api_error.rb +57 -0
  68. data/lib/notifo/configuration.rb +270 -0
  69. data/lib/notifo/models/add_allowed_topic_dto.rb +243 -0
  70. data/lib/notifo/models/add_contributor_dto.rb +277 -0
  71. data/lib/notifo/models/app_contributor_dto.rb +311 -0
  72. data/lib/notifo/models/app_details_dto.rb +489 -0
  73. data/lib/notifo/models/app_dto.rb +362 -0
  74. data/lib/notifo/models/confirm_mode.rb +38 -0
  75. data/lib/notifo/models/create_email_template_dto.rb +243 -0
  76. data/lib/notifo/models/email_template_dto.rb +288 -0
  77. data/lib/notifo/models/email_verification_status.rb +39 -0
  78. data/lib/notifo/models/error_dto.rb +265 -0
  79. data/lib/notifo/models/event_dto.rb +456 -0
  80. data/lib/notifo/models/iso_day_of_week.rb +43 -0
  81. data/lib/notifo/models/list_response_dto_of_event_dto.rb +241 -0
  82. data/lib/notifo/models/list_response_dto_of_log_entry_dto.rb +241 -0
  83. data/lib/notifo/models/list_response_dto_of_media_dto.rb +241 -0
  84. data/lib/notifo/models/list_response_dto_of_subscription_dto.rb +241 -0
  85. data/lib/notifo/models/list_response_dto_of_template_dto.rb +241 -0
  86. data/lib/notifo/models/list_response_dto_of_topic_dto.rb +241 -0
  87. data/lib/notifo/models/list_response_dto_of_user_dto.rb +241 -0
  88. data/lib/notifo/models/log_entry_dto.rb +326 -0
  89. data/lib/notifo/models/media_dto.rb +390 -0
  90. data/lib/notifo/models/media_type.rb +39 -0
  91. data/lib/notifo/models/notification_formatting_dto.rb +305 -0
  92. data/lib/notifo/models/notification_send.rb +39 -0
  93. data/lib/notifo/models/notification_setting_dto.rb +234 -0
  94. data/lib/notifo/models/profile_dto.rb +361 -0
  95. data/lib/notifo/models/publish_dto.rb +338 -0
  96. data/lib/notifo/models/publish_many_dto.rb +226 -0
  97. data/lib/notifo/models/resize_mode.rb +42 -0
  98. data/lib/notifo/models/scheduling_dto.rb +248 -0
  99. data/lib/notifo/models/scheduling_type.rb +37 -0
  100. data/lib/notifo/models/subscription_dto.rb +256 -0
  101. data/lib/notifo/models/template_dto.rb +274 -0
  102. data/lib/notifo/models/topic_dto.rb +294 -0
  103. data/lib/notifo/models/update_profile_dto.rb +277 -0
  104. data/lib/notifo/models/upsert_app_dto.rb +321 -0
  105. data/lib/notifo/models/upsert_template_dto.rb +270 -0
  106. data/lib/notifo/models/upsert_templates_dto.rb +226 -0
  107. data/lib/notifo/models/upsert_user_dto.rb +299 -0
  108. data/lib/notifo/models/upsert_users_dto.rb +226 -0
  109. data/lib/notifo/models/user_dto.rb +381 -0
  110. data/lib/notifo/version.rb +15 -0
  111. data/notifo-io-1.0.0.gem +0 -0
  112. data/notifo.gemspec +38 -0
  113. data/spec/api/apps_api_spec.rb +151 -0
  114. data/spec/api/configs_api_spec.rb +55 -0
  115. data/spec/api/events_api_spec.rb +61 -0
  116. data/spec/api/logs_api_spec.rb +49 -0
  117. data/spec/api/media_api_spec.rb +117 -0
  118. data/spec/api/templates_api_spec.rb +73 -0
  119. data/spec/api/topics_api_spec.rb +49 -0
  120. data/spec/api/user_api_spec.rb +92 -0
  121. data/spec/api/users_api_spec.rb +152 -0
  122. data/spec/api_client_spec.rb +226 -0
  123. data/spec/configuration_spec.rb +42 -0
  124. data/spec/models/add_allowed_topic_dto_spec.rb +34 -0
  125. data/spec/models/add_contributor_dto_spec.rb +40 -0
  126. data/spec/models/app_contributor_dto_spec.rb +46 -0
  127. data/spec/models/app_details_dto_spec.rb +124 -0
  128. data/spec/models/app_dto_spec.rb +64 -0
  129. data/spec/models/confirm_mode_spec.rb +28 -0
  130. data/spec/models/create_email_template_dto_spec.rb +34 -0
  131. data/spec/models/email_template_dto_spec.rb +46 -0
  132. data/spec/models/email_verification_status_spec.rb +28 -0
  133. data/spec/models/error_dto_spec.rb +58 -0
  134. data/spec/models/event_dto_spec.rb +100 -0
  135. data/spec/models/iso_day_of_week_spec.rb +28 -0
  136. data/spec/models/list_response_dto_of_event_dto_spec.rb +40 -0
  137. data/spec/models/list_response_dto_of_log_entry_dto_spec.rb +40 -0
  138. data/spec/models/list_response_dto_of_media_dto_spec.rb +40 -0
  139. data/spec/models/list_response_dto_of_subscription_dto_spec.rb +40 -0
  140. data/spec/models/list_response_dto_of_template_dto_spec.rb +40 -0
  141. data/spec/models/list_response_dto_of_topic_dto_spec.rb +40 -0
  142. data/spec/models/list_response_dto_of_user_dto_spec.rb +40 -0
  143. data/spec/models/log_entry_dto_spec.rb +52 -0
  144. data/spec/models/media_dto_spec.rb +70 -0
  145. data/spec/models/media_type_spec.rb +28 -0
  146. data/spec/models/notification_formatting_dto_spec.rb +76 -0
  147. data/spec/models/notification_send_spec.rb +28 -0
  148. data/spec/models/notification_setting_dto_spec.rb +40 -0
  149. data/spec/models/profile_dto_spec.rb +76 -0
  150. data/spec/models/publish_dto_spec.rb +88 -0
  151. data/spec/models/publish_many_dto_spec.rb +34 -0
  152. data/spec/models/resize_mode_spec.rb +28 -0
  153. data/spec/models/scheduling_dto_spec.rb +52 -0
  154. data/spec/models/scheduling_type_spec.rb +28 -0
  155. data/spec/models/subscription_dto_spec.rb +40 -0
  156. data/spec/models/template_dto_spec.rb +46 -0
  157. data/spec/models/topic_dto_spec.rb +46 -0
  158. data/spec/models/update_profile_dto_spec.rb +64 -0
  159. data/spec/models/upsert_app_dto_spec.rb +88 -0
  160. data/spec/models/upsert_template_dto_spec.rb +46 -0
  161. data/spec/models/upsert_templates_dto_spec.rb +34 -0
  162. data/spec/models/upsert_user_dto_spec.rb +76 -0
  163. data/spec/models/upsert_users_dto_spec.rb +34 -0
  164. data/spec/models/user_dto_spec.rb +88 -0
  165. data/spec/spec_helper.rb +111 -0
  166. metadata +301 -0
@@ -0,0 +1,456 @@
1
+ =begin
2
+ #Notifo API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Notifo
17
+ class EventDto
18
+ # The id of the event.
19
+ attr_accessor :id
20
+
21
+ # The topic path.
22
+ attr_accessor :topic
23
+
24
+ # A custom id to identity the creator.
25
+ attr_accessor :creator_id
26
+
27
+ # The display name.
28
+ attr_accessor :display_name
29
+
30
+ # Additional user defined data.
31
+ attr_accessor :data
32
+
33
+ # The time when the event has been created.
34
+ attr_accessor :created
35
+
36
+ attr_accessor :formatting
37
+
38
+ # Notification settings per channel.
39
+ attr_accessor :settings
40
+
41
+ # User defined properties.
42
+ attr_accessor :properties
43
+
44
+ attr_accessor :scheduling
45
+
46
+ # The statistics counters.
47
+ attr_accessor :counters
48
+
49
+ # True when silent.
50
+ attr_accessor :silent
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'id' => :'id',
56
+ :'topic' => :'topic',
57
+ :'creator_id' => :'creatorId',
58
+ :'display_name' => :'displayName',
59
+ :'data' => :'data',
60
+ :'created' => :'created',
61
+ :'formatting' => :'formatting',
62
+ :'settings' => :'settings',
63
+ :'properties' => :'properties',
64
+ :'scheduling' => :'scheduling',
65
+ :'counters' => :'counters',
66
+ :'silent' => :'silent'
67
+ }
68
+ end
69
+
70
+ # Returns all the JSON keys this model knows about
71
+ def self.acceptable_attributes
72
+ attribute_map.values
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'id' => :'String',
79
+ :'topic' => :'String',
80
+ :'creator_id' => :'String',
81
+ :'display_name' => :'String',
82
+ :'data' => :'String',
83
+ :'created' => :'Time',
84
+ :'formatting' => :'NotificationFormattingDto',
85
+ :'settings' => :'Hash<String, NotificationSettingDto>',
86
+ :'properties' => :'Hash<String, String>',
87
+ :'scheduling' => :'SchedulingDto',
88
+ :'counters' => :'Hash<String, Integer>',
89
+ :'silent' => :'Boolean'
90
+ }
91
+ end
92
+
93
+ # List of attributes with nullable: true
94
+ def self.openapi_nullable
95
+ Set.new([
96
+ :'creator_id',
97
+ :'data',
98
+ ])
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Notifo::EventDto` initialize method"
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ attributes = attributes.each_with_object({}) { |(k, v), h|
110
+ if (!self.class.attribute_map.key?(k.to_sym))
111
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Notifo::EventDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
112
+ end
113
+ h[k.to_sym] = v
114
+ }
115
+
116
+ if attributes.key?(:'id')
117
+ self.id = attributes[:'id']
118
+ end
119
+
120
+ if attributes.key?(:'topic')
121
+ self.topic = attributes[:'topic']
122
+ end
123
+
124
+ if attributes.key?(:'creator_id')
125
+ self.creator_id = attributes[:'creator_id']
126
+ end
127
+
128
+ if attributes.key?(:'display_name')
129
+ self.display_name = attributes[:'display_name']
130
+ end
131
+
132
+ if attributes.key?(:'data')
133
+ self.data = attributes[:'data']
134
+ end
135
+
136
+ if attributes.key?(:'created')
137
+ self.created = attributes[:'created']
138
+ end
139
+
140
+ if attributes.key?(:'formatting')
141
+ self.formatting = attributes[:'formatting']
142
+ end
143
+
144
+ if attributes.key?(:'settings')
145
+ if (value = attributes[:'settings']).is_a?(Hash)
146
+ self.settings = value
147
+ end
148
+ end
149
+
150
+ if attributes.key?(:'properties')
151
+ if (value = attributes[:'properties']).is_a?(Hash)
152
+ self.properties = value
153
+ end
154
+ end
155
+
156
+ if attributes.key?(:'scheduling')
157
+ self.scheduling = attributes[:'scheduling']
158
+ end
159
+
160
+ if attributes.key?(:'counters')
161
+ if (value = attributes[:'counters']).is_a?(Hash)
162
+ self.counters = value
163
+ end
164
+ end
165
+
166
+ if attributes.key?(:'silent')
167
+ self.silent = attributes[:'silent']
168
+ end
169
+ end
170
+
171
+ # Show invalid properties with the reasons. Usually used together with valid?
172
+ # @return Array for valid properties with the reasons
173
+ def list_invalid_properties
174
+ invalid_properties = Array.new
175
+ if @id.nil?
176
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
177
+ end
178
+
179
+ if @id.to_s.length < 1
180
+ invalid_properties.push('invalid value for "id", the character length must be great than or equal to 1.')
181
+ end
182
+
183
+ if @topic.nil?
184
+ invalid_properties.push('invalid value for "topic", topic cannot be nil.')
185
+ end
186
+
187
+ if @topic.to_s.length < 1
188
+ invalid_properties.push('invalid value for "topic", the character length must be great than or equal to 1.')
189
+ end
190
+
191
+ if @display_name.nil?
192
+ invalid_properties.push('invalid value for "display_name", display_name cannot be nil.')
193
+ end
194
+
195
+ if @display_name.to_s.length < 1
196
+ invalid_properties.push('invalid value for "display_name", the character length must be great than or equal to 1.')
197
+ end
198
+
199
+ if @created.nil?
200
+ invalid_properties.push('invalid value for "created", created cannot be nil.')
201
+ end
202
+
203
+ if @created.to_s.length < 1
204
+ invalid_properties.push('invalid value for "created", the character length must be great than or equal to 1.')
205
+ end
206
+
207
+ if @formatting.nil?
208
+ invalid_properties.push('invalid value for "formatting", formatting cannot be nil.')
209
+ end
210
+
211
+ if @settings.nil?
212
+ invalid_properties.push('invalid value for "settings", settings cannot be nil.')
213
+ end
214
+
215
+ if @properties.nil?
216
+ invalid_properties.push('invalid value for "properties", properties cannot be nil.')
217
+ end
218
+
219
+ if @counters.nil?
220
+ invalid_properties.push('invalid value for "counters", counters cannot be nil.')
221
+ end
222
+
223
+ if @silent.nil?
224
+ invalid_properties.push('invalid value for "silent", silent cannot be nil.')
225
+ end
226
+
227
+ invalid_properties
228
+ end
229
+
230
+ # Check to see if the all the properties in the model are valid
231
+ # @return true if the model is valid
232
+ def valid?
233
+ return false if @id.nil?
234
+ return false if @id.to_s.length < 1
235
+ return false if @topic.nil?
236
+ return false if @topic.to_s.length < 1
237
+ return false if @display_name.nil?
238
+ return false if @display_name.to_s.length < 1
239
+ return false if @created.nil?
240
+ return false if @created.to_s.length < 1
241
+ return false if @formatting.nil?
242
+ return false if @settings.nil?
243
+ return false if @properties.nil?
244
+ return false if @counters.nil?
245
+ return false if @silent.nil?
246
+ true
247
+ end
248
+
249
+ # Custom attribute writer method with validation
250
+ # @param [Object] id Value to be assigned
251
+ def id=(id)
252
+ if id.nil?
253
+ fail ArgumentError, 'id cannot be nil'
254
+ end
255
+
256
+ if id.to_s.length < 1
257
+ fail ArgumentError, 'invalid value for "id", the character length must be great than or equal to 1.'
258
+ end
259
+
260
+ @id = id
261
+ end
262
+
263
+ # Custom attribute writer method with validation
264
+ # @param [Object] topic Value to be assigned
265
+ def topic=(topic)
266
+ if topic.nil?
267
+ fail ArgumentError, 'topic cannot be nil'
268
+ end
269
+
270
+ if topic.to_s.length < 1
271
+ fail ArgumentError, 'invalid value for "topic", the character length must be great than or equal to 1.'
272
+ end
273
+
274
+ @topic = topic
275
+ end
276
+
277
+ # Custom attribute writer method with validation
278
+ # @param [Object] display_name Value to be assigned
279
+ def display_name=(display_name)
280
+ if display_name.nil?
281
+ fail ArgumentError, 'display_name cannot be nil'
282
+ end
283
+
284
+ if display_name.to_s.length < 1
285
+ fail ArgumentError, 'invalid value for "display_name", the character length must be great than or equal to 1.'
286
+ end
287
+
288
+ @display_name = display_name
289
+ end
290
+
291
+ # Custom attribute writer method with validation
292
+ # @param [Object] created Value to be assigned
293
+ def created=(created)
294
+ if created.nil?
295
+ fail ArgumentError, 'created cannot be nil'
296
+ end
297
+
298
+ if created.to_s.length < 1
299
+ fail ArgumentError, 'invalid value for "created", the character length must be great than or equal to 1.'
300
+ end
301
+
302
+ @created = created
303
+ end
304
+
305
+ # Checks equality by comparing each attribute.
306
+ # @param [Object] Object to be compared
307
+ def ==(o)
308
+ return true if self.equal?(o)
309
+ self.class == o.class &&
310
+ id == o.id &&
311
+ topic == o.topic &&
312
+ creator_id == o.creator_id &&
313
+ display_name == o.display_name &&
314
+ data == o.data &&
315
+ created == o.created &&
316
+ formatting == o.formatting &&
317
+ settings == o.settings &&
318
+ properties == o.properties &&
319
+ scheduling == o.scheduling &&
320
+ counters == o.counters &&
321
+ silent == o.silent
322
+ end
323
+
324
+ # @see the `==` method
325
+ # @param [Object] Object to be compared
326
+ def eql?(o)
327
+ self == o
328
+ end
329
+
330
+ # Calculates hash code according to all attributes.
331
+ # @return [Integer] Hash code
332
+ def hash
333
+ [id, topic, creator_id, display_name, data, created, formatting, settings, properties, scheduling, counters, silent].hash
334
+ end
335
+
336
+ # Builds the object from hash
337
+ # @param [Hash] attributes Model attributes in the form of hash
338
+ # @return [Object] Returns the model itself
339
+ def self.build_from_hash(attributes)
340
+ new.build_from_hash(attributes)
341
+ end
342
+
343
+ # Builds the object from hash
344
+ # @param [Hash] attributes Model attributes in the form of hash
345
+ # @return [Object] Returns the model itself
346
+ def build_from_hash(attributes)
347
+ return nil unless attributes.is_a?(Hash)
348
+ self.class.openapi_types.each_pair do |key, type|
349
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
350
+ self.send("#{key}=", nil)
351
+ elsif type =~ /\AArray<(.*)>/i
352
+ # check to ensure the input is an array given that the attribute
353
+ # is documented as an array but the input is not
354
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
355
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
356
+ end
357
+ elsif !attributes[self.class.attribute_map[key]].nil?
358
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
359
+ end
360
+ end
361
+
362
+ self
363
+ end
364
+
365
+ # Deserializes the data based on type
366
+ # @param string type Data type
367
+ # @param string value Value to be deserialized
368
+ # @return [Object] Deserialized data
369
+ def _deserialize(type, value)
370
+ case type.to_sym
371
+ when :Time
372
+ Time.parse(value)
373
+ when :Date
374
+ Date.parse(value)
375
+ when :String
376
+ value.to_s
377
+ when :Integer
378
+ value.to_i
379
+ when :Float
380
+ value.to_f
381
+ when :Boolean
382
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
383
+ true
384
+ else
385
+ false
386
+ end
387
+ when :Object
388
+ # generic object (usually a Hash), return directly
389
+ value
390
+ when /\AArray<(?<inner_type>.+)>\z/
391
+ inner_type = Regexp.last_match[:inner_type]
392
+ value.map { |v| _deserialize(inner_type, v) }
393
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
394
+ k_type = Regexp.last_match[:k_type]
395
+ v_type = Regexp.last_match[:v_type]
396
+ {}.tap do |hash|
397
+ value.each do |k, v|
398
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
399
+ end
400
+ end
401
+ else # model
402
+ # models (e.g. Pet) or oneOf
403
+ klass = Notifo.const_get(type)
404
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
405
+ end
406
+ end
407
+
408
+ # Returns the string representation of the object
409
+ # @return [String] String presentation of the object
410
+ def to_s
411
+ to_hash.to_s
412
+ end
413
+
414
+ # to_body is an alias to to_hash (backward compatibility)
415
+ # @return [Hash] Returns the object in the form of hash
416
+ def to_body
417
+ to_hash
418
+ end
419
+
420
+ # Returns the object in the form of hash
421
+ # @return [Hash] Returns the object in the form of hash
422
+ def to_hash
423
+ hash = {}
424
+ self.class.attribute_map.each_pair do |attr, param|
425
+ value = self.send(attr)
426
+ if value.nil?
427
+ is_nullable = self.class.openapi_nullable.include?(attr)
428
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
429
+ end
430
+
431
+ hash[param] = _to_hash(value)
432
+ end
433
+ hash
434
+ end
435
+
436
+ # Outputs non-array value in the form of hash
437
+ # For object, use to_hash. Otherwise, just return the value
438
+ # @param [Object] value Any valid value
439
+ # @return [Hash] Returns the value in the form of hash
440
+ def _to_hash(value)
441
+ if value.is_a?(Array)
442
+ value.compact.map { |v| _to_hash(v) }
443
+ elsif value.is_a?(Hash)
444
+ {}.tap do |hash|
445
+ value.each { |k, v| hash[k] = _to_hash(v) }
446
+ end
447
+ elsif value.respond_to? :to_hash
448
+ value.to_hash
449
+ else
450
+ value
451
+ end
452
+ end
453
+
454
+ end
455
+
456
+ end