BmltClient 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +7 -0
  2. data/BmltClient.gemspec +38 -0
  3. data/Gemfile +9 -0
  4. data/Makefile +22 -0
  5. data/README.md +157 -0
  6. data/Rakefile +10 -0
  7. data/docs/AuthenticationError.md +18 -0
  8. data/docs/AuthorizationError.md +18 -0
  9. data/docs/ErrorTest.md +22 -0
  10. data/docs/Format.md +24 -0
  11. data/docs/FormatAllOf.md +18 -0
  12. data/docs/FormatBase.md +22 -0
  13. data/docs/FormatCreate.md +22 -0
  14. data/docs/FormatPartialUpdate.md +22 -0
  15. data/docs/FormatTranslation.md +24 -0
  16. data/docs/FormatUpdate.md +22 -0
  17. data/docs/Meeting.md +90 -0
  18. data/docs/MeetingBase.md +88 -0
  19. data/docs/MeetingCreate.md +88 -0
  20. data/docs/MeetingPartialUpdate.md +88 -0
  21. data/docs/MeetingUpdate.md +88 -0
  22. data/docs/NotFoundError.md +18 -0
  23. data/docs/RootServerApi.md +1958 -0
  24. data/docs/ServerError.md +18 -0
  25. data/docs/ServiceBody.md +38 -0
  26. data/docs/ServiceBodyBase.md +36 -0
  27. data/docs/ServiceBodyCreate.md +36 -0
  28. data/docs/ServiceBodyPartialUpdate.md +36 -0
  29. data/docs/ServiceBodyUpdate.md +36 -0
  30. data/docs/Token.md +24 -0
  31. data/docs/TokenCredentials.md +20 -0
  32. data/docs/User.md +30 -0
  33. data/docs/UserBase.md +28 -0
  34. data/docs/UserCreate.md +30 -0
  35. data/docs/UserCreateAllOf.md +18 -0
  36. data/docs/UserPartialUpdate.md +30 -0
  37. data/docs/UserUpdate.md +30 -0
  38. data/docs/ValidationError.md +20 -0
  39. data/git_push.sh +57 -0
  40. data/lib/BmltClient/api/root_server_api.rb +1880 -0
  41. data/lib/BmltClient/api_client.rb +392 -0
  42. data/lib/BmltClient/api_error.rb +57 -0
  43. data/lib/BmltClient/configuration.rb +279 -0
  44. data/lib/BmltClient/models/authentication_error.rb +224 -0
  45. data/lib/BmltClient/models/authorization_error.rb +224 -0
  46. data/lib/BmltClient/models/error_test.rb +237 -0
  47. data/lib/BmltClient/models/format.rb +276 -0
  48. data/lib/BmltClient/models/format_all_of.rb +219 -0
  49. data/lib/BmltClient/models/format_base.rb +239 -0
  50. data/lib/BmltClient/models/format_create.rb +251 -0
  51. data/lib/BmltClient/models/format_partial_update.rb +246 -0
  52. data/lib/BmltClient/models/format_translation.rb +266 -0
  53. data/lib/BmltClient/models/format_update.rb +251 -0
  54. data/lib/BmltClient/models/meeting.rb +628 -0
  55. data/lib/BmltClient/models/meeting_base.rb +536 -0
  56. data/lib/BmltClient/models/meeting_create.rb +593 -0
  57. data/lib/BmltClient/models/meeting_partial_update.rb +593 -0
  58. data/lib/BmltClient/models/meeting_update.rb +593 -0
  59. data/lib/BmltClient/models/not_found_error.rb +224 -0
  60. data/lib/BmltClient/models/server_error.rb +224 -0
  61. data/lib/BmltClient/models/service_body.rb +374 -0
  62. data/lib/BmltClient/models/service_body_base.rb +302 -0
  63. data/lib/BmltClient/models/service_body_create.rb +339 -0
  64. data/lib/BmltClient/models/service_body_partial_update.rb +309 -0
  65. data/lib/BmltClient/models/service_body_update.rb +339 -0
  66. data/lib/BmltClient/models/token.rb +266 -0
  67. data/lib/BmltClient/models/token_credentials.rb +238 -0
  68. data/lib/BmltClient/models/user.rb +316 -0
  69. data/lib/BmltClient/models/user_base.rb +264 -0
  70. data/lib/BmltClient/models/user_create.rb +301 -0
  71. data/lib/BmltClient/models/user_create_all_of.rb +219 -0
  72. data/lib/BmltClient/models/user_partial_update.rb +281 -0
  73. data/lib/BmltClient/models/user_update.rb +296 -0
  74. data/lib/BmltClient/models/validation_error.rb +240 -0
  75. data/lib/BmltClient/version.rb +15 -0
  76. data/lib/BmltClient.rb +71 -0
  77. data/openapi.json +1 -0
  78. data/spec/api/root_server_api_spec.rb +377 -0
  79. data/spec/api_client_spec.rb +226 -0
  80. data/spec/configuration_spec.rb +42 -0
  81. data/spec/models/authentication_error_spec.rb +34 -0
  82. data/spec/models/authorization_error_spec.rb +34 -0
  83. data/spec/models/error_test_spec.rb +46 -0
  84. data/spec/models/format_all_of_spec.rb +34 -0
  85. data/spec/models/format_base_spec.rb +46 -0
  86. data/spec/models/format_create_spec.rb +46 -0
  87. data/spec/models/format_partial_update_spec.rb +46 -0
  88. data/spec/models/format_spec.rb +52 -0
  89. data/spec/models/format_translation_spec.rb +52 -0
  90. data/spec/models/format_update_spec.rb +46 -0
  91. data/spec/models/meeting_base_spec.rb +244 -0
  92. data/spec/models/meeting_create_spec.rb +244 -0
  93. data/spec/models/meeting_partial_update_spec.rb +244 -0
  94. data/spec/models/meeting_spec.rb +250 -0
  95. data/spec/models/meeting_update_spec.rb +244 -0
  96. data/spec/models/not_found_error_spec.rb +34 -0
  97. data/spec/models/server_error_spec.rb +34 -0
  98. data/spec/models/service_body_base_spec.rb +88 -0
  99. data/spec/models/service_body_create_spec.rb +88 -0
  100. data/spec/models/service_body_partial_update_spec.rb +88 -0
  101. data/spec/models/service_body_spec.rb +94 -0
  102. data/spec/models/service_body_update_spec.rb +88 -0
  103. data/spec/models/token_credentials_spec.rb +40 -0
  104. data/spec/models/token_spec.rb +52 -0
  105. data/spec/models/user_base_spec.rb +64 -0
  106. data/spec/models/user_create_all_of_spec.rb +34 -0
  107. data/spec/models/user_create_spec.rb +70 -0
  108. data/spec/models/user_partial_update_spec.rb +70 -0
  109. data/spec/models/user_spec.rb +70 -0
  110. data/spec/models/user_update_spec.rb +70 -0
  111. data/spec/models/validation_error_spec.rb +40 -0
  112. data/spec/spec_helper.rb +111 -0
  113. metadata +229 -0
@@ -0,0 +1,593 @@
1
+ =begin
2
+ #BMLT
3
+
4
+ #BMLT Admin API Documentation
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.2.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module BmltClient
17
+ class MeetingUpdate
18
+ attr_accessor :service_body_id
19
+
20
+ attr_accessor :format_ids
21
+
22
+ attr_accessor :venue_type
23
+
24
+ attr_accessor :temporarily_virtual
25
+
26
+ attr_accessor :day
27
+
28
+ attr_accessor :start_time
29
+
30
+ attr_accessor :duration
31
+
32
+ attr_accessor :time_zone
33
+
34
+ attr_accessor :latitude
35
+
36
+ attr_accessor :longitude
37
+
38
+ attr_accessor :published
39
+
40
+ attr_accessor :email
41
+
42
+ attr_accessor :world_id
43
+
44
+ attr_accessor :name
45
+
46
+ attr_accessor :location_text
47
+
48
+ attr_accessor :location_info
49
+
50
+ attr_accessor :location_street
51
+
52
+ attr_accessor :location_neighborhood
53
+
54
+ attr_accessor :location_city_subsection
55
+
56
+ attr_accessor :location_municipality
57
+
58
+ attr_accessor :location_sub_province
59
+
60
+ attr_accessor :location_province
61
+
62
+ attr_accessor :location_postal_code_1
63
+
64
+ attr_accessor :location_nation
65
+
66
+ attr_accessor :phone_meeting_number
67
+
68
+ attr_accessor :virtual_meeting_link
69
+
70
+ attr_accessor :virtual_meeting_additional_info
71
+
72
+ attr_accessor :contact_name_1
73
+
74
+ attr_accessor :contact_name_2
75
+
76
+ attr_accessor :contact_phone_1
77
+
78
+ attr_accessor :contact_phone_2
79
+
80
+ attr_accessor :contact_email_1
81
+
82
+ attr_accessor :contact_email_2
83
+
84
+ attr_accessor :bus_lines
85
+
86
+ attr_accessor :train_line
87
+
88
+ attr_accessor :comments
89
+
90
+ # Attribute mapping from ruby-style variable name to JSON key.
91
+ def self.attribute_map
92
+ {
93
+ :'service_body_id' => :'serviceBodyId',
94
+ :'format_ids' => :'formatIds',
95
+ :'venue_type' => :'venueType',
96
+ :'temporarily_virtual' => :'temporarilyVirtual',
97
+ :'day' => :'day',
98
+ :'start_time' => :'startTime',
99
+ :'duration' => :'duration',
100
+ :'time_zone' => :'timeZone',
101
+ :'latitude' => :'latitude',
102
+ :'longitude' => :'longitude',
103
+ :'published' => :'published',
104
+ :'email' => :'email',
105
+ :'world_id' => :'worldId',
106
+ :'name' => :'name',
107
+ :'location_text' => :'location_text',
108
+ :'location_info' => :'location_info',
109
+ :'location_street' => :'location_street',
110
+ :'location_neighborhood' => :'location_neighborhood',
111
+ :'location_city_subsection' => :'location_city_subsection',
112
+ :'location_municipality' => :'location_municipality',
113
+ :'location_sub_province' => :'location_sub_province',
114
+ :'location_province' => :'location_province',
115
+ :'location_postal_code_1' => :'location_postal_code_1',
116
+ :'location_nation' => :'location_nation',
117
+ :'phone_meeting_number' => :'phone_meeting_number',
118
+ :'virtual_meeting_link' => :'virtual_meeting_link',
119
+ :'virtual_meeting_additional_info' => :'virtual_meeting_additional_info',
120
+ :'contact_name_1' => :'contact_name_1',
121
+ :'contact_name_2' => :'contact_name_2',
122
+ :'contact_phone_1' => :'contact_phone_1',
123
+ :'contact_phone_2' => :'contact_phone_2',
124
+ :'contact_email_1' => :'contact_email_1',
125
+ :'contact_email_2' => :'contact_email_2',
126
+ :'bus_lines' => :'bus_lines',
127
+ :'train_line' => :'train_line',
128
+ :'comments' => :'comments'
129
+ }
130
+ end
131
+
132
+ # Returns all the JSON keys this model knows about
133
+ def self.acceptable_attributes
134
+ attribute_map.values
135
+ end
136
+
137
+ # Attribute type mapping.
138
+ def self.openapi_types
139
+ {
140
+ :'service_body_id' => :'Integer',
141
+ :'format_ids' => :'Array<Integer>',
142
+ :'venue_type' => :'Integer',
143
+ :'temporarily_virtual' => :'Boolean',
144
+ :'day' => :'Integer',
145
+ :'start_time' => :'String',
146
+ :'duration' => :'String',
147
+ :'time_zone' => :'String',
148
+ :'latitude' => :'Float',
149
+ :'longitude' => :'Float',
150
+ :'published' => :'Boolean',
151
+ :'email' => :'String',
152
+ :'world_id' => :'String',
153
+ :'name' => :'String',
154
+ :'location_text' => :'String',
155
+ :'location_info' => :'String',
156
+ :'location_street' => :'String',
157
+ :'location_neighborhood' => :'String',
158
+ :'location_city_subsection' => :'String',
159
+ :'location_municipality' => :'String',
160
+ :'location_sub_province' => :'String',
161
+ :'location_province' => :'String',
162
+ :'location_postal_code_1' => :'String',
163
+ :'location_nation' => :'String',
164
+ :'phone_meeting_number' => :'String',
165
+ :'virtual_meeting_link' => :'String',
166
+ :'virtual_meeting_additional_info' => :'String',
167
+ :'contact_name_1' => :'String',
168
+ :'contact_name_2' => :'String',
169
+ :'contact_phone_1' => :'String',
170
+ :'contact_phone_2' => :'String',
171
+ :'contact_email_1' => :'String',
172
+ :'contact_email_2' => :'String',
173
+ :'bus_lines' => :'String',
174
+ :'train_line' => :'String',
175
+ :'comments' => :'String'
176
+ }
177
+ end
178
+
179
+ # List of attributes with nullable: true
180
+ def self.openapi_nullable
181
+ Set.new([
182
+ ])
183
+ end
184
+
185
+ # List of class defined in allOf (OpenAPI v3)
186
+ def self.openapi_all_of
187
+ [
188
+ :'MeetingBase'
189
+ ]
190
+ end
191
+
192
+ # Initializes the object
193
+ # @param [Hash] attributes Model attributes in the form of hash
194
+ def initialize(attributes = {})
195
+ if (!attributes.is_a?(Hash))
196
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BmltClient::MeetingUpdate` initialize method"
197
+ end
198
+
199
+ # check to see if the attribute exists and convert string to symbol for hash key
200
+ attributes = attributes.each_with_object({}) { |(k, v), h|
201
+ if (!self.class.attribute_map.key?(k.to_sym))
202
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BmltClient::MeetingUpdate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
203
+ end
204
+ h[k.to_sym] = v
205
+ }
206
+
207
+ if attributes.key?(:'service_body_id')
208
+ self.service_body_id = attributes[:'service_body_id']
209
+ end
210
+
211
+ if attributes.key?(:'format_ids')
212
+ if (value = attributes[:'format_ids']).is_a?(Array)
213
+ self.format_ids = value
214
+ end
215
+ end
216
+
217
+ if attributes.key?(:'venue_type')
218
+ self.venue_type = attributes[:'venue_type']
219
+ end
220
+
221
+ if attributes.key?(:'temporarily_virtual')
222
+ self.temporarily_virtual = attributes[:'temporarily_virtual']
223
+ end
224
+
225
+ if attributes.key?(:'day')
226
+ self.day = attributes[:'day']
227
+ end
228
+
229
+ if attributes.key?(:'start_time')
230
+ self.start_time = attributes[:'start_time']
231
+ end
232
+
233
+ if attributes.key?(:'duration')
234
+ self.duration = attributes[:'duration']
235
+ end
236
+
237
+ if attributes.key?(:'time_zone')
238
+ self.time_zone = attributes[:'time_zone']
239
+ end
240
+
241
+ if attributes.key?(:'latitude')
242
+ self.latitude = attributes[:'latitude']
243
+ end
244
+
245
+ if attributes.key?(:'longitude')
246
+ self.longitude = attributes[:'longitude']
247
+ end
248
+
249
+ if attributes.key?(:'published')
250
+ self.published = attributes[:'published']
251
+ end
252
+
253
+ if attributes.key?(:'email')
254
+ self.email = attributes[:'email']
255
+ end
256
+
257
+ if attributes.key?(:'world_id')
258
+ self.world_id = attributes[:'world_id']
259
+ end
260
+
261
+ if attributes.key?(:'name')
262
+ self.name = attributes[:'name']
263
+ end
264
+
265
+ if attributes.key?(:'location_text')
266
+ self.location_text = attributes[:'location_text']
267
+ end
268
+
269
+ if attributes.key?(:'location_info')
270
+ self.location_info = attributes[:'location_info']
271
+ end
272
+
273
+ if attributes.key?(:'location_street')
274
+ self.location_street = attributes[:'location_street']
275
+ end
276
+
277
+ if attributes.key?(:'location_neighborhood')
278
+ self.location_neighborhood = attributes[:'location_neighborhood']
279
+ end
280
+
281
+ if attributes.key?(:'location_city_subsection')
282
+ self.location_city_subsection = attributes[:'location_city_subsection']
283
+ end
284
+
285
+ if attributes.key?(:'location_municipality')
286
+ self.location_municipality = attributes[:'location_municipality']
287
+ end
288
+
289
+ if attributes.key?(:'location_sub_province')
290
+ self.location_sub_province = attributes[:'location_sub_province']
291
+ end
292
+
293
+ if attributes.key?(:'location_province')
294
+ self.location_province = attributes[:'location_province']
295
+ end
296
+
297
+ if attributes.key?(:'location_postal_code_1')
298
+ self.location_postal_code_1 = attributes[:'location_postal_code_1']
299
+ end
300
+
301
+ if attributes.key?(:'location_nation')
302
+ self.location_nation = attributes[:'location_nation']
303
+ end
304
+
305
+ if attributes.key?(:'phone_meeting_number')
306
+ self.phone_meeting_number = attributes[:'phone_meeting_number']
307
+ end
308
+
309
+ if attributes.key?(:'virtual_meeting_link')
310
+ self.virtual_meeting_link = attributes[:'virtual_meeting_link']
311
+ end
312
+
313
+ if attributes.key?(:'virtual_meeting_additional_info')
314
+ self.virtual_meeting_additional_info = attributes[:'virtual_meeting_additional_info']
315
+ end
316
+
317
+ if attributes.key?(:'contact_name_1')
318
+ self.contact_name_1 = attributes[:'contact_name_1']
319
+ end
320
+
321
+ if attributes.key?(:'contact_name_2')
322
+ self.contact_name_2 = attributes[:'contact_name_2']
323
+ end
324
+
325
+ if attributes.key?(:'contact_phone_1')
326
+ self.contact_phone_1 = attributes[:'contact_phone_1']
327
+ end
328
+
329
+ if attributes.key?(:'contact_phone_2')
330
+ self.contact_phone_2 = attributes[:'contact_phone_2']
331
+ end
332
+
333
+ if attributes.key?(:'contact_email_1')
334
+ self.contact_email_1 = attributes[:'contact_email_1']
335
+ end
336
+
337
+ if attributes.key?(:'contact_email_2')
338
+ self.contact_email_2 = attributes[:'contact_email_2']
339
+ end
340
+
341
+ if attributes.key?(:'bus_lines')
342
+ self.bus_lines = attributes[:'bus_lines']
343
+ end
344
+
345
+ if attributes.key?(:'train_line')
346
+ self.train_line = attributes[:'train_line']
347
+ end
348
+
349
+ if attributes.key?(:'comments')
350
+ self.comments = attributes[:'comments']
351
+ end
352
+ end
353
+
354
+ # Show invalid properties with the reasons. Usually used together with valid?
355
+ # @return Array for valid properties with the reasons
356
+ def list_invalid_properties
357
+ invalid_properties = Array.new
358
+ if @service_body_id.nil?
359
+ invalid_properties.push('invalid value for "service_body_id", service_body_id cannot be nil.')
360
+ end
361
+
362
+ if @format_ids.nil?
363
+ invalid_properties.push('invalid value for "format_ids", format_ids cannot be nil.')
364
+ end
365
+
366
+ if @venue_type.nil?
367
+ invalid_properties.push('invalid value for "venue_type", venue_type cannot be nil.')
368
+ end
369
+
370
+ if @day.nil?
371
+ invalid_properties.push('invalid value for "day", day cannot be nil.')
372
+ end
373
+
374
+ if @start_time.nil?
375
+ invalid_properties.push('invalid value for "start_time", start_time cannot be nil.')
376
+ end
377
+
378
+ if @duration.nil?
379
+ invalid_properties.push('invalid value for "duration", duration cannot be nil.')
380
+ end
381
+
382
+ if @latitude.nil?
383
+ invalid_properties.push('invalid value for "latitude", latitude cannot be nil.')
384
+ end
385
+
386
+ if @longitude.nil?
387
+ invalid_properties.push('invalid value for "longitude", longitude cannot be nil.')
388
+ end
389
+
390
+ if @published.nil?
391
+ invalid_properties.push('invalid value for "published", published cannot be nil.')
392
+ end
393
+
394
+ if @name.nil?
395
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
396
+ end
397
+
398
+ invalid_properties
399
+ end
400
+
401
+ # Check to see if the all the properties in the model are valid
402
+ # @return true if the model is valid
403
+ def valid?
404
+ return false if @service_body_id.nil?
405
+ return false if @format_ids.nil?
406
+ return false if @venue_type.nil?
407
+ return false if @day.nil?
408
+ return false if @start_time.nil?
409
+ return false if @duration.nil?
410
+ return false if @latitude.nil?
411
+ return false if @longitude.nil?
412
+ return false if @published.nil?
413
+ return false if @name.nil?
414
+ true
415
+ end
416
+
417
+ # Checks equality by comparing each attribute.
418
+ # @param [Object] Object to be compared
419
+ def ==(o)
420
+ return true if self.equal?(o)
421
+ self.class == o.class &&
422
+ service_body_id == o.service_body_id &&
423
+ format_ids == o.format_ids &&
424
+ venue_type == o.venue_type &&
425
+ temporarily_virtual == o.temporarily_virtual &&
426
+ day == o.day &&
427
+ start_time == o.start_time &&
428
+ duration == o.duration &&
429
+ time_zone == o.time_zone &&
430
+ latitude == o.latitude &&
431
+ longitude == o.longitude &&
432
+ published == o.published &&
433
+ email == o.email &&
434
+ world_id == o.world_id &&
435
+ name == o.name &&
436
+ location_text == o.location_text &&
437
+ location_info == o.location_info &&
438
+ location_street == o.location_street &&
439
+ location_neighborhood == o.location_neighborhood &&
440
+ location_city_subsection == o.location_city_subsection &&
441
+ location_municipality == o.location_municipality &&
442
+ location_sub_province == o.location_sub_province &&
443
+ location_province == o.location_province &&
444
+ location_postal_code_1 == o.location_postal_code_1 &&
445
+ location_nation == o.location_nation &&
446
+ phone_meeting_number == o.phone_meeting_number &&
447
+ virtual_meeting_link == o.virtual_meeting_link &&
448
+ virtual_meeting_additional_info == o.virtual_meeting_additional_info &&
449
+ contact_name_1 == o.contact_name_1 &&
450
+ contact_name_2 == o.contact_name_2 &&
451
+ contact_phone_1 == o.contact_phone_1 &&
452
+ contact_phone_2 == o.contact_phone_2 &&
453
+ contact_email_1 == o.contact_email_1 &&
454
+ contact_email_2 == o.contact_email_2 &&
455
+ bus_lines == o.bus_lines &&
456
+ train_line == o.train_line &&
457
+ comments == o.comments
458
+ end
459
+
460
+ # @see the `==` method
461
+ # @param [Object] Object to be compared
462
+ def eql?(o)
463
+ self == o
464
+ end
465
+
466
+ # Calculates hash code according to all attributes.
467
+ # @return [Integer] Hash code
468
+ def hash
469
+ [service_body_id, format_ids, venue_type, temporarily_virtual, day, start_time, duration, time_zone, latitude, longitude, published, email, world_id, name, location_text, location_info, location_street, location_neighborhood, location_city_subsection, location_municipality, location_sub_province, location_province, location_postal_code_1, location_nation, phone_meeting_number, virtual_meeting_link, virtual_meeting_additional_info, contact_name_1, contact_name_2, contact_phone_1, contact_phone_2, contact_email_1, contact_email_2, bus_lines, train_line, comments].hash
470
+ end
471
+
472
+ # Builds the object from hash
473
+ # @param [Hash] attributes Model attributes in the form of hash
474
+ # @return [Object] Returns the model itself
475
+ def self.build_from_hash(attributes)
476
+ new.build_from_hash(attributes)
477
+ end
478
+
479
+ # Builds the object from hash
480
+ # @param [Hash] attributes Model attributes in the form of hash
481
+ # @return [Object] Returns the model itself
482
+ def build_from_hash(attributes)
483
+ return nil unless attributes.is_a?(Hash)
484
+ attributes = attributes.transform_keys(&:to_sym)
485
+ self.class.openapi_types.each_pair do |key, type|
486
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
487
+ self.send("#{key}=", nil)
488
+ elsif type =~ /\AArray<(.*)>/i
489
+ # check to ensure the input is an array given that the attribute
490
+ # is documented as an array but the input is not
491
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
492
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
493
+ end
494
+ elsif !attributes[self.class.attribute_map[key]].nil?
495
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
496
+ end
497
+ end
498
+
499
+ self
500
+ end
501
+
502
+ # Deserializes the data based on type
503
+ # @param string type Data type
504
+ # @param string value Value to be deserialized
505
+ # @return [Object] Deserialized data
506
+ def _deserialize(type, value)
507
+ case type.to_sym
508
+ when :Time
509
+ Time.parse(value)
510
+ when :Date
511
+ Date.parse(value)
512
+ when :String
513
+ value.to_s
514
+ when :Integer
515
+ value.to_i
516
+ when :Float
517
+ value.to_f
518
+ when :Boolean
519
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
520
+ true
521
+ else
522
+ false
523
+ end
524
+ when :Object
525
+ # generic object (usually a Hash), return directly
526
+ value
527
+ when /\AArray<(?<inner_type>.+)>\z/
528
+ inner_type = Regexp.last_match[:inner_type]
529
+ value.map { |v| _deserialize(inner_type, v) }
530
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
531
+ k_type = Regexp.last_match[:k_type]
532
+ v_type = Regexp.last_match[:v_type]
533
+ {}.tap do |hash|
534
+ value.each do |k, v|
535
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
536
+ end
537
+ end
538
+ else # model
539
+ # models (e.g. Pet) or oneOf
540
+ klass = BmltClient.const_get(type)
541
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
542
+ end
543
+ end
544
+
545
+ # Returns the string representation of the object
546
+ # @return [String] String presentation of the object
547
+ def to_s
548
+ to_hash.to_s
549
+ end
550
+
551
+ # to_body is an alias to to_hash (backward compatibility)
552
+ # @return [Hash] Returns the object in the form of hash
553
+ def to_body
554
+ to_hash
555
+ end
556
+
557
+ # Returns the object in the form of hash
558
+ # @return [Hash] Returns the object in the form of hash
559
+ def to_hash
560
+ hash = {}
561
+ self.class.attribute_map.each_pair do |attr, param|
562
+ value = self.send(attr)
563
+ if value.nil?
564
+ is_nullable = self.class.openapi_nullable.include?(attr)
565
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
566
+ end
567
+
568
+ hash[param] = _to_hash(value)
569
+ end
570
+ hash
571
+ end
572
+
573
+ # Outputs non-array value in the form of hash
574
+ # For object, use to_hash. Otherwise, just return the value
575
+ # @param [Object] value Any valid value
576
+ # @return [Hash] Returns the value in the form of hash
577
+ def _to_hash(value)
578
+ if value.is_a?(Array)
579
+ value.compact.map { |v| _to_hash(v) }
580
+ elsif value.is_a?(Hash)
581
+ {}.tap do |hash|
582
+ value.each { |k, v| hash[k] = _to_hash(v) }
583
+ end
584
+ elsif value.respond_to? :to_hash
585
+ value.to_hash
586
+ else
587
+ value
588
+ end
589
+ end
590
+
591
+ end
592
+
593
+ end