google-calendar-apimatic-sdk 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 (94) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +168 -0
  4. data/bin/console +15 -0
  5. data/lib/calendar_api/api_helper.rb +10 -0
  6. data/lib/calendar_api/apis/base_api.rb +67 -0
  7. data/lib/calendar_api/apis/calendar_list_api.rb +63 -0
  8. data/lib/calendar_api/apis/channels_api.rb +42 -0
  9. data/lib/calendar_api/apis/events_api.rb +354 -0
  10. data/lib/calendar_api/apis/free_busy_api.rb +37 -0
  11. data/lib/calendar_api/apis/oauth_authorization_api.rb +87 -0
  12. data/lib/calendar_api/client.rb +103 -0
  13. data/lib/calendar_api/configuration.rb +177 -0
  14. data/lib/calendar_api/exceptions/api_exception.rb +21 -0
  15. data/lib/calendar_api/exceptions/error_response_error1_exception.rb +46 -0
  16. data/lib/calendar_api/exceptions/oauth_provider_exception.rb +64 -0
  17. data/lib/calendar_api/http/api_response.rb +19 -0
  18. data/lib/calendar_api/http/auth/oauth_2.rb +162 -0
  19. data/lib/calendar_api/http/http_call_back.rb +10 -0
  20. data/lib/calendar_api/http/http_method_enum.rb +10 -0
  21. data/lib/calendar_api/http/http_request.rb +10 -0
  22. data/lib/calendar_api/http/http_response.rb +10 -0
  23. data/lib/calendar_api/http/proxy_settings.rb +22 -0
  24. data/lib/calendar_api/logging/configuration/api_logging_configuration.rb +186 -0
  25. data/lib/calendar_api/logging/sdk_logger.rb +17 -0
  26. data/lib/calendar_api/models/attachment.rb +115 -0
  27. data/lib/calendar_api/models/attendee.rb +167 -0
  28. data/lib/calendar_api/models/auto_decline_mode.rb +40 -0
  29. data/lib/calendar_api/models/base_model.rb +110 -0
  30. data/lib/calendar_api/models/birthday_properties.rb +96 -0
  31. data/lib/calendar_api/models/birthday_type.rb +48 -0
  32. data/lib/calendar_api/models/calendar_access_role.rb +44 -0
  33. data/lib/calendar_api/models/calendar_list_entry.rb +278 -0
  34. data/lib/calendar_api/models/calendar_list_entry_conference_properties.rb +83 -0
  35. data/lib/calendar_api/models/calendar_list_entry_notification_settings.rb +85 -0
  36. data/lib/calendar_api/models/calendar_list_response.rb +129 -0
  37. data/lib/calendar_api/models/calendar_notification.rb +86 -0
  38. data/lib/calendar_api/models/calendar_notification_method.rb +27 -0
  39. data/lib/calendar_api/models/calendar_notification_type.rb +48 -0
  40. data/lib/calendar_api/models/channel.rb +129 -0
  41. data/lib/calendar_api/models/channel_params.rb +75 -0
  42. data/lib/calendar_api/models/channel_type.rb +36 -0
  43. data/lib/calendar_api/models/chat_status.rb +36 -0
  44. data/lib/calendar_api/models/conference_create_request.rb +99 -0
  45. data/lib/calendar_api/models/conference_create_request_status.rb +76 -0
  46. data/lib/calendar_api/models/conference_data.rb +137 -0
  47. data/lib/calendar_api/models/conference_data_version.rb +43 -0
  48. data/lib/calendar_api/models/conference_entry_point.rb +126 -0
  49. data/lib/calendar_api/models/conference_request_status_code.rb +40 -0
  50. data/lib/calendar_api/models/conference_solution.rb +95 -0
  51. data/lib/calendar_api/models/conference_solution_key.rb +74 -0
  52. data/lib/calendar_api/models/conference_solution_type.rb +40 -0
  53. data/lib/calendar_api/models/custom_location.rb +75 -0
  54. data/lib/calendar_api/models/entry_point_type.rb +44 -0
  55. data/lib/calendar_api/models/error_response.rb +75 -0
  56. data/lib/calendar_api/models/error_response_error.rb +104 -0
  57. data/lib/calendar_api/models/error_response_error_errors_items.rb +95 -0
  58. data/lib/calendar_api/models/event.rb +551 -0
  59. data/lib/calendar_api/models/event_date_time.rb +107 -0
  60. data/lib/calendar_api/models/event_list.rb +208 -0
  61. data/lib/calendar_api/models/event_order_by.rb +36 -0
  62. data/lib/calendar_api/models/event_reminders.rb +95 -0
  63. data/lib/calendar_api/models/event_source.rb +86 -0
  64. data/lib/calendar_api/models/event_status.rb +40 -0
  65. data/lib/calendar_api/models/event_transparency.rb +37 -0
  66. data/lib/calendar_api/models/event_type.rb +52 -0
  67. data/lib/calendar_api/models/event_visibility.rb +44 -0
  68. data/lib/calendar_api/models/extended_properties.rb +87 -0
  69. data/lib/calendar_api/models/focus_time_properties.rb +99 -0
  70. data/lib/calendar_api/models/free_busy_calendar.rb +103 -0
  71. data/lib/calendar_api/models/free_busy_error.rb +85 -0
  72. data/lib/calendar_api/models/free_busy_group.rb +94 -0
  73. data/lib/calendar_api/models/free_busy_request.rb +150 -0
  74. data/lib/calendar_api/models/free_busy_request_item.rb +72 -0
  75. data/lib/calendar_api/models/free_busy_response.rb +135 -0
  76. data/lib/calendar_api/models/oauth_provider_error.rb +62 -0
  77. data/lib/calendar_api/models/oauth_scope.rb +41 -0
  78. data/lib/calendar_api/models/oauth_token.rb +96 -0
  79. data/lib/calendar_api/models/office_location.rb +116 -0
  80. data/lib/calendar_api/models/out_of_office_properties.rb +88 -0
  81. data/lib/calendar_api/models/person.rb +106 -0
  82. data/lib/calendar_api/models/reminder.rb +83 -0
  83. data/lib/calendar_api/models/reminder_method.rb +36 -0
  84. data/lib/calendar_api/models/response_status.rb +44 -0
  85. data/lib/calendar_api/models/send_updates.rb +40 -0
  86. data/lib/calendar_api/models/stop_channel_request.rb +85 -0
  87. data/lib/calendar_api/models/time_period.rb +102 -0
  88. data/lib/calendar_api/models/watch_request.rb +113 -0
  89. data/lib/calendar_api/models/working_location_properties.rb +107 -0
  90. data/lib/calendar_api/models/working_location_type.rb +40 -0
  91. data/lib/calendar_api/utilities/date_time_helper.rb +11 -0
  92. data/lib/calendar_api/utilities/file_wrapper.rb +28 -0
  93. data/lib/calendar_api.rb +114 -0
  94. metadata +176 -0
@@ -0,0 +1,551 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module CalendarApi
8
+ # A Google Calendar event resource.
9
+ class Event < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # Type of the resource.
14
+ # @return [String]
15
+ attr_accessor :kind
16
+
17
+ # ETag of the resource.
18
+ # @return [String]
19
+ attr_accessor :etag
20
+
21
+ # Opaque identifier of the event. When creating new single or recurring
22
+ # events, you can specify their IDs. Event IDs must be between 5 and 1024
23
+ # characters long and consist of lower-case base32hex characters (a-v, 0-9).
24
+ # @return [String]
25
+ attr_accessor :id
26
+
27
+ # Status of the event.
28
+ # @return [EventStatus]
29
+ attr_accessor :status
30
+
31
+ # Absolute link to this event in the Google Calendar Web UI.
32
+ # @return [String]
33
+ attr_accessor :html_link
34
+
35
+ # Creation time of the event (RFC3339).
36
+ # @return [DateTime]
37
+ attr_accessor :created
38
+
39
+ # Last modification time of the event (RFC3339).
40
+ # @return [DateTime]
41
+ attr_accessor :updated
42
+
43
+ # Title of the event.
44
+ # @return [String]
45
+ attr_accessor :summary
46
+
47
+ # Description of the event. Can contain HTML.
48
+ # @return [String]
49
+ attr_accessor :description
50
+
51
+ # Geographic location of the event as free-form text.
52
+ # @return [String]
53
+ attr_accessor :location
54
+
55
+ # The color of the event. This is an ID referring to an entry in the event
56
+ # section of the colors definition.
57
+ # @return [String]
58
+ attr_accessor :color_id
59
+
60
+ # Identifies a person associated with the event, such as the creator or
61
+ # organizer.
62
+ # @return [Person]
63
+ attr_accessor :creator
64
+
65
+ # Identifies a person associated with the event, such as the creator or
66
+ # organizer.
67
+ # @return [Person]
68
+ attr_accessor :organizer
69
+
70
+ # A timestamp marking the start or end of an event. For all-day events, use
71
+ # date; for timed events, use dateTime.
72
+ # @return [EventDateTime]
73
+ attr_accessor :start
74
+
75
+ # A timestamp marking the start or end of an event. For all-day events, use
76
+ # date; for timed events, use dateTime.
77
+ # @return [EventDateTime]
78
+ attr_accessor :mend
79
+
80
+ # Whether the end time is actually unspecified.
81
+ # @return [TrueClass | FalseClass]
82
+ attr_accessor :end_time_unspecified
83
+
84
+ # List of RRULE, EXRULE, RDATE, and EXDATE lines for a recurring event, as
85
+ # specified in RFC 5545. This field is omitted for single events or
86
+ # instances of recurring events.
87
+ # @return [Array[String]]
88
+ attr_accessor :recurrence
89
+
90
+ # For an instance of a recurring event, this is the ID of the recurring
91
+ # event to which this instance belongs.
92
+ # @return [String]
93
+ attr_accessor :recurring_event_id
94
+
95
+ # A timestamp marking the start or end of an event. For all-day events, use
96
+ # date; for timed events, use dateTime.
97
+ # @return [EventDateTime]
98
+ attr_accessor :original_start_time
99
+
100
+ # Whether the event blocks time on the calendar. "opaque" means the event
101
+ # does block time; "transparent" means it does not.
102
+ # @return [EventTransparency]
103
+ attr_accessor :transparency
104
+
105
+ # Visibility of the event.
106
+ # @return [EventVisibility]
107
+ attr_accessor :visibility
108
+
109
+ # Event unique identifier as defined in RFC 5545.
110
+ # @return [String]
111
+ attr_accessor :i_cal_uid
112
+
113
+ # Sequence number as per iCalendar.
114
+ # @return [Integer]
115
+ attr_accessor :sequence
116
+
117
+ # The attendees of the event.
118
+ # @return [Array[Attendee]]
119
+ attr_accessor :attendees
120
+
121
+ # Whether attendees may have been omitted from the event's representation.
122
+ # @return [TrueClass | FalseClass]
123
+ attr_accessor :attendees_omitted
124
+
125
+ # An absolute link to the Google Hangout associated with this event
126
+ # (deprecated in favor of conferenceData).
127
+ # @return [String]
128
+ attr_accessor :hangout_link
129
+
130
+ # Information about a conference (e.g. Google Meet).
131
+ # @return [ConferenceData]
132
+ attr_accessor :conference_data
133
+
134
+ # Whether attendees other than the organizer can invite others.
135
+ # @return [TrueClass | FalseClass]
136
+ attr_accessor :guests_can_invite_others
137
+
138
+ # Whether attendees other than the organizer can modify the event.
139
+ # @return [TrueClass | FalseClass]
140
+ attr_accessor :guests_can_modify
141
+
142
+ # Whether attendees other than the organizer can see who the event's
143
+ # attendees are.
144
+ # @return [TrueClass | FalseClass]
145
+ attr_accessor :guests_can_see_other_guests
146
+
147
+ # If set to true, event propagation is disabled.
148
+ # @return [TrueClass | FalseClass]
149
+ attr_accessor :private_copy
150
+
151
+ # Whether this is a locked event copy where no changes can be made.
152
+ # @return [TrueClass | FalseClass]
153
+ attr_accessor :locked
154
+
155
+ # Information about the event's reminders.
156
+ # @return [EventReminders]
157
+ attr_accessor :reminders
158
+
159
+ # Source from which the event was created — for example, a web page or an
160
+ # email message.
161
+ # @return [EventSource]
162
+ attr_accessor :source
163
+
164
+ # The specific type of event.
165
+ # @return [EventType]
166
+ attr_accessor :event_type
167
+
168
+ # Extended properties of the event.
169
+ # @return [ExtendedProperties]
170
+ attr_accessor :extended_properties
171
+
172
+ # File attachments for the event. Maximum 25 attachments per event.
173
+ # @return [Array[Attachment]]
174
+ attr_accessor :attachments
175
+
176
+ # Birthday or special event data. Used if eventType is birthday.
177
+ # @return [BirthdayProperties]
178
+ attr_accessor :birthday_properties
179
+
180
+ # Out-of-office event data. Used if eventType is outOfOffice.
181
+ # @return [OutOfOfficeProperties]
182
+ attr_accessor :out_of_office_properties
183
+
184
+ # Focus time event data. Used if eventType is focusTime.
185
+ # @return [FocusTimeProperties]
186
+ attr_accessor :focus_time_properties
187
+
188
+ # Working location event data. Used if eventType is workingLocation.
189
+ # @return [WorkingLocationProperties]
190
+ attr_accessor :working_location_properties
191
+
192
+ # A mapping from model property names to API property names.
193
+ def self.names
194
+ @_hash = {} if @_hash.nil?
195
+ @_hash['kind'] = 'kind'
196
+ @_hash['etag'] = 'etag'
197
+ @_hash['id'] = 'id'
198
+ @_hash['status'] = 'status'
199
+ @_hash['html_link'] = 'htmlLink'
200
+ @_hash['created'] = 'created'
201
+ @_hash['updated'] = 'updated'
202
+ @_hash['summary'] = 'summary'
203
+ @_hash['description'] = 'description'
204
+ @_hash['location'] = 'location'
205
+ @_hash['color_id'] = 'colorId'
206
+ @_hash['creator'] = 'creator'
207
+ @_hash['organizer'] = 'organizer'
208
+ @_hash['start'] = 'start'
209
+ @_hash['mend'] = 'end'
210
+ @_hash['end_time_unspecified'] = 'endTimeUnspecified'
211
+ @_hash['recurrence'] = 'recurrence'
212
+ @_hash['recurring_event_id'] = 'recurringEventId'
213
+ @_hash['original_start_time'] = 'originalStartTime'
214
+ @_hash['transparency'] = 'transparency'
215
+ @_hash['visibility'] = 'visibility'
216
+ @_hash['i_cal_uid'] = 'iCalUID'
217
+ @_hash['sequence'] = 'sequence'
218
+ @_hash['attendees'] = 'attendees'
219
+ @_hash['attendees_omitted'] = 'attendeesOmitted'
220
+ @_hash['hangout_link'] = 'hangoutLink'
221
+ @_hash['conference_data'] = 'conferenceData'
222
+ @_hash['guests_can_invite_others'] = 'guestsCanInviteOthers'
223
+ @_hash['guests_can_modify'] = 'guestsCanModify'
224
+ @_hash['guests_can_see_other_guests'] = 'guestsCanSeeOtherGuests'
225
+ @_hash['private_copy'] = 'privateCopy'
226
+ @_hash['locked'] = 'locked'
227
+ @_hash['reminders'] = 'reminders'
228
+ @_hash['source'] = 'source'
229
+ @_hash['event_type'] = 'eventType'
230
+ @_hash['extended_properties'] = 'extendedProperties'
231
+ @_hash['attachments'] = 'attachments'
232
+ @_hash['birthday_properties'] = 'birthdayProperties'
233
+ @_hash['out_of_office_properties'] = 'outOfOfficeProperties'
234
+ @_hash['focus_time_properties'] = 'focusTimeProperties'
235
+ @_hash['working_location_properties'] = 'workingLocationProperties'
236
+ @_hash
237
+ end
238
+
239
+ # An array for optional fields
240
+ def self.optionals
241
+ %w[
242
+ kind
243
+ etag
244
+ id
245
+ status
246
+ html_link
247
+ created
248
+ updated
249
+ summary
250
+ description
251
+ location
252
+ color_id
253
+ creator
254
+ organizer
255
+ end_time_unspecified
256
+ recurrence
257
+ recurring_event_id
258
+ original_start_time
259
+ transparency
260
+ visibility
261
+ i_cal_uid
262
+ sequence
263
+ attendees
264
+ attendees_omitted
265
+ hangout_link
266
+ conference_data
267
+ guests_can_invite_others
268
+ guests_can_modify
269
+ guests_can_see_other_guests
270
+ private_copy
271
+ locked
272
+ reminders
273
+ source
274
+ event_type
275
+ extended_properties
276
+ attachments
277
+ birthday_properties
278
+ out_of_office_properties
279
+ focus_time_properties
280
+ working_location_properties
281
+ ]
282
+ end
283
+
284
+ # An array for nullable fields
285
+ def self.nullables
286
+ []
287
+ end
288
+
289
+ def initialize(start:, mend:, kind: 'calendar#event', etag: SKIP, id: SKIP,
290
+ status: SKIP, html_link: SKIP, created: SKIP, updated: SKIP,
291
+ summary: SKIP, description: SKIP, location: SKIP,
292
+ color_id: SKIP, creator: SKIP, organizer: SKIP,
293
+ end_time_unspecified: false, recurrence: SKIP,
294
+ recurring_event_id: SKIP, original_start_time: SKIP,
295
+ transparency: EventTransparency::OPAQUE,
296
+ visibility: EventVisibility::DEFAULT, i_cal_uid: SKIP,
297
+ sequence: SKIP, attendees: SKIP, attendees_omitted: false,
298
+ hangout_link: SKIP, conference_data: SKIP,
299
+ guests_can_invite_others: true, guests_can_modify: false,
300
+ guests_can_see_other_guests: true, private_copy: false,
301
+ locked: false, reminders: SKIP, source: SKIP,
302
+ event_type: SKIP, extended_properties: SKIP,
303
+ attachments: SKIP, birthday_properties: SKIP,
304
+ out_of_office_properties: SKIP, focus_time_properties: SKIP,
305
+ working_location_properties: SKIP,
306
+ additional_properties: nil)
307
+ # Add additional model properties to the instance
308
+ additional_properties = {} if additional_properties.nil?
309
+
310
+ @kind = kind unless kind == SKIP
311
+ @etag = etag unless etag == SKIP
312
+ @id = id unless id == SKIP
313
+ @status = status unless status == SKIP
314
+ @html_link = html_link unless html_link == SKIP
315
+ @created = created unless created == SKIP
316
+ @updated = updated unless updated == SKIP
317
+ @summary = summary unless summary == SKIP
318
+ @description = description unless description == SKIP
319
+ @location = location unless location == SKIP
320
+ @color_id = color_id unless color_id == SKIP
321
+ @creator = creator unless creator == SKIP
322
+ @organizer = organizer unless organizer == SKIP
323
+ @start = start
324
+ @mend = mend
325
+ @end_time_unspecified = end_time_unspecified unless end_time_unspecified == SKIP
326
+ @recurrence = recurrence unless recurrence == SKIP
327
+ @recurring_event_id = recurring_event_id unless recurring_event_id == SKIP
328
+ @original_start_time = original_start_time unless original_start_time == SKIP
329
+ @transparency = transparency unless transparency == SKIP
330
+ @visibility = visibility unless visibility == SKIP
331
+ @i_cal_uid = i_cal_uid unless i_cal_uid == SKIP
332
+ @sequence = sequence unless sequence == SKIP
333
+ @attendees = attendees unless attendees == SKIP
334
+ @attendees_omitted = attendees_omitted unless attendees_omitted == SKIP
335
+ @hangout_link = hangout_link unless hangout_link == SKIP
336
+ @conference_data = conference_data unless conference_data == SKIP
337
+ @guests_can_invite_others = guests_can_invite_others unless guests_can_invite_others == SKIP
338
+ @guests_can_modify = guests_can_modify unless guests_can_modify == SKIP
339
+ unless guests_can_see_other_guests == SKIP
340
+ @guests_can_see_other_guests =
341
+ guests_can_see_other_guests
342
+ end
343
+ @private_copy = private_copy unless private_copy == SKIP
344
+ @locked = locked unless locked == SKIP
345
+ @reminders = reminders unless reminders == SKIP
346
+ @source = source unless source == SKIP
347
+ @event_type = event_type unless event_type == SKIP
348
+ @extended_properties = extended_properties unless extended_properties == SKIP
349
+ @attachments = attachments unless attachments == SKIP
350
+ @birthday_properties = birthday_properties unless birthday_properties == SKIP
351
+ @out_of_office_properties = out_of_office_properties unless out_of_office_properties == SKIP
352
+ @focus_time_properties = focus_time_properties unless focus_time_properties == SKIP
353
+ unless working_location_properties == SKIP
354
+ @working_location_properties =
355
+ working_location_properties
356
+ end
357
+ @additional_properties = additional_properties
358
+ end
359
+
360
+ # Creates an instance of the object from a hash.
361
+ def self.from_hash(hash)
362
+ return nil unless hash
363
+
364
+ # Extract variables from the hash.
365
+ start = EventDateTime.from_hash(hash['start']) if hash['start']
366
+ mend = EventDateTime.from_hash(hash['end']) if hash['end']
367
+ kind = hash['kind'] ||= 'calendar#event'
368
+ etag = hash.key?('etag') ? hash['etag'] : SKIP
369
+ id = hash.key?('id') ? hash['id'] : SKIP
370
+ status = hash.key?('status') ? hash['status'] : SKIP
371
+ html_link = hash.key?('htmlLink') ? hash['htmlLink'] : SKIP
372
+ created = if hash.key?('created')
373
+ (DateTimeHelper.from_rfc3339(hash['created']) if hash['created'])
374
+ else
375
+ SKIP
376
+ end
377
+ updated = if hash.key?('updated')
378
+ (DateTimeHelper.from_rfc3339(hash['updated']) if hash['updated'])
379
+ else
380
+ SKIP
381
+ end
382
+ summary = hash.key?('summary') ? hash['summary'] : SKIP
383
+ description = hash.key?('description') ? hash['description'] : SKIP
384
+ location = hash.key?('location') ? hash['location'] : SKIP
385
+ color_id = hash.key?('colorId') ? hash['colorId'] : SKIP
386
+ creator = Person.from_hash(hash['creator']) if hash['creator']
387
+ organizer = Person.from_hash(hash['organizer']) if hash['organizer']
388
+ end_time_unspecified = hash['endTimeUnspecified'] ||= false
389
+ recurrence = hash.key?('recurrence') ? hash['recurrence'] : SKIP
390
+ recurring_event_id =
391
+ hash.key?('recurringEventId') ? hash['recurringEventId'] : SKIP
392
+ original_start_time = EventDateTime.from_hash(hash['originalStartTime']) if
393
+ hash['originalStartTime']
394
+ transparency = hash['transparency'] ||= EventTransparency::OPAQUE
395
+ visibility = hash['visibility'] ||= EventVisibility::DEFAULT
396
+ i_cal_uid = hash.key?('iCalUID') ? hash['iCalUID'] : SKIP
397
+ sequence = hash.key?('sequence') ? hash['sequence'] : SKIP
398
+ # Parameter is an array, so we need to iterate through it
399
+ attendees = nil
400
+ unless hash['attendees'].nil?
401
+ attendees = []
402
+ hash['attendees'].each do |structure|
403
+ attendees << (Attendee.from_hash(structure) if structure)
404
+ end
405
+ end
406
+
407
+ attendees = SKIP unless hash.key?('attendees')
408
+ attendees_omitted = hash['attendeesOmitted'] ||= false
409
+ hangout_link = hash.key?('hangoutLink') ? hash['hangoutLink'] : SKIP
410
+ conference_data = ConferenceData.from_hash(hash['conferenceData']) if hash['conferenceData']
411
+ guests_can_invite_others = hash['guestsCanInviteOthers'] ||= true
412
+ guests_can_modify = hash['guestsCanModify'] ||= false
413
+ guests_can_see_other_guests = hash['guestsCanSeeOtherGuests'] ||= true
414
+ private_copy = hash['privateCopy'] ||= false
415
+ locked = hash['locked'] ||= false
416
+ reminders = EventReminders.from_hash(hash['reminders']) if hash['reminders']
417
+ source = EventSource.from_hash(hash['source']) if hash['source']
418
+ event_type = hash.key?('eventType') ? hash['eventType'] : SKIP
419
+ extended_properties = ExtendedProperties.from_hash(hash['extendedProperties']) if
420
+ hash['extendedProperties']
421
+ # Parameter is an array, so we need to iterate through it
422
+ attachments = nil
423
+ unless hash['attachments'].nil?
424
+ attachments = []
425
+ hash['attachments'].each do |structure|
426
+ attachments << (Attachment.from_hash(structure) if structure)
427
+ end
428
+ end
429
+
430
+ attachments = SKIP unless hash.key?('attachments')
431
+ birthday_properties = BirthdayProperties.from_hash(hash['birthdayProperties']) if
432
+ hash['birthdayProperties']
433
+ out_of_office_properties = OutOfOfficeProperties.from_hash(hash['outOfOfficeProperties']) if
434
+ hash['outOfOfficeProperties']
435
+ focus_time_properties = FocusTimeProperties.from_hash(hash['focusTimeProperties']) if
436
+ hash['focusTimeProperties']
437
+ if hash['workingLocationProperties']
438
+ working_location_properties = WorkingLocationProperties.from_hash(hash['workingLocationProperties'])
439
+ end
440
+
441
+ # Create a new hash for additional properties, removing known properties.
442
+ new_hash = hash.reject { |k, _| names.value?(k) }
443
+
444
+ additional_properties = APIHelper.get_additional_properties(
445
+ new_hash, proc { |value| value }
446
+ )
447
+
448
+ # Create object from extracted values.
449
+ Event.new(start: start,
450
+ mend: mend,
451
+ kind: kind,
452
+ etag: etag,
453
+ id: id,
454
+ status: status,
455
+ html_link: html_link,
456
+ created: created,
457
+ updated: updated,
458
+ summary: summary,
459
+ description: description,
460
+ location: location,
461
+ color_id: color_id,
462
+ creator: creator,
463
+ organizer: organizer,
464
+ end_time_unspecified: end_time_unspecified,
465
+ recurrence: recurrence,
466
+ recurring_event_id: recurring_event_id,
467
+ original_start_time: original_start_time,
468
+ transparency: transparency,
469
+ visibility: visibility,
470
+ i_cal_uid: i_cal_uid,
471
+ sequence: sequence,
472
+ attendees: attendees,
473
+ attendees_omitted: attendees_omitted,
474
+ hangout_link: hangout_link,
475
+ conference_data: conference_data,
476
+ guests_can_invite_others: guests_can_invite_others,
477
+ guests_can_modify: guests_can_modify,
478
+ guests_can_see_other_guests: guests_can_see_other_guests,
479
+ private_copy: private_copy,
480
+ locked: locked,
481
+ reminders: reminders,
482
+ source: source,
483
+ event_type: event_type,
484
+ extended_properties: extended_properties,
485
+ attachments: attachments,
486
+ birthday_properties: birthday_properties,
487
+ out_of_office_properties: out_of_office_properties,
488
+ focus_time_properties: focus_time_properties,
489
+ working_location_properties: working_location_properties,
490
+ additional_properties: additional_properties)
491
+ end
492
+
493
+ def to_custom_created
494
+ DateTimeHelper.to_rfc3339(created)
495
+ end
496
+
497
+ def to_custom_updated
498
+ DateTimeHelper.to_rfc3339(updated)
499
+ end
500
+
501
+ # Provides a human-readable string representation of the object.
502
+ def to_s
503
+ class_name = self.class.name.split('::').last
504
+ "<#{class_name} kind: #{@kind}, etag: #{@etag}, id: #{@id}, status: #{@status}, html_link:"\
505
+ " #{@html_link}, created: #{@created}, updated: #{@updated}, summary: #{@summary},"\
506
+ " description: #{@description}, location: #{@location}, color_id: #{@color_id}, creator:"\
507
+ " #{@creator}, organizer: #{@organizer}, start: #{@start}, mend: #{@mend},"\
508
+ " end_time_unspecified: #{@end_time_unspecified}, recurrence: #{@recurrence},"\
509
+ " recurring_event_id: #{@recurring_event_id}, original_start_time: #{@original_start_time},"\
510
+ " transparency: #{@transparency}, visibility: #{@visibility}, i_cal_uid: #{@i_cal_uid},"\
511
+ " sequence: #{@sequence}, attendees: #{@attendees}, attendees_omitted:"\
512
+ " #{@attendees_omitted}, hangout_link: #{@hangout_link}, conference_data:"\
513
+ " #{@conference_data}, guests_can_invite_others: #{@guests_can_invite_others},"\
514
+ " guests_can_modify: #{@guests_can_modify}, guests_can_see_other_guests:"\
515
+ " #{@guests_can_see_other_guests}, private_copy: #{@private_copy}, locked: #{@locked},"\
516
+ " reminders: #{@reminders}, source: #{@source}, event_type: #{@event_type},"\
517
+ " extended_properties: #{@extended_properties}, attachments: #{@attachments},"\
518
+ " birthday_properties: #{@birthday_properties}, out_of_office_properties:"\
519
+ " #{@out_of_office_properties}, focus_time_properties: #{@focus_time_properties},"\
520
+ " working_location_properties: #{@working_location_properties}, additional_properties:"\
521
+ " #{@additional_properties}>"
522
+ end
523
+
524
+ # Provides a debugging-friendly string with detailed object information.
525
+ def inspect
526
+ class_name = self.class.name.split('::').last
527
+ "<#{class_name} kind: #{@kind.inspect}, etag: #{@etag.inspect}, id: #{@id.inspect}, status:"\
528
+ " #{@status.inspect}, html_link: #{@html_link.inspect}, created: #{@created.inspect},"\
529
+ " updated: #{@updated.inspect}, summary: #{@summary.inspect}, description:"\
530
+ " #{@description.inspect}, location: #{@location.inspect}, color_id: #{@color_id.inspect},"\
531
+ " creator: #{@creator.inspect}, organizer: #{@organizer.inspect}, start: #{@start.inspect},"\
532
+ " mend: #{@mend.inspect}, end_time_unspecified: #{@end_time_unspecified.inspect},"\
533
+ " recurrence: #{@recurrence.inspect}, recurring_event_id: #{@recurring_event_id.inspect},"\
534
+ " original_start_time: #{@original_start_time.inspect}, transparency:"\
535
+ " #{@transparency.inspect}, visibility: #{@visibility.inspect}, i_cal_uid:"\
536
+ " #{@i_cal_uid.inspect}, sequence: #{@sequence.inspect}, attendees: #{@attendees.inspect},"\
537
+ " attendees_omitted: #{@attendees_omitted.inspect}, hangout_link: #{@hangout_link.inspect},"\
538
+ " conference_data: #{@conference_data.inspect}, guests_can_invite_others:"\
539
+ " #{@guests_can_invite_others.inspect}, guests_can_modify: #{@guests_can_modify.inspect},"\
540
+ " guests_can_see_other_guests: #{@guests_can_see_other_guests.inspect}, private_copy:"\
541
+ " #{@private_copy.inspect}, locked: #{@locked.inspect}, reminders: #{@reminders.inspect},"\
542
+ " source: #{@source.inspect}, event_type: #{@event_type.inspect}, extended_properties:"\
543
+ " #{@extended_properties.inspect}, attachments: #{@attachments.inspect},"\
544
+ " birthday_properties: #{@birthday_properties.inspect}, out_of_office_properties:"\
545
+ " #{@out_of_office_properties.inspect}, focus_time_properties:"\
546
+ " #{@focus_time_properties.inspect}, working_location_properties:"\
547
+ " #{@working_location_properties.inspect}, additional_properties:"\
548
+ " #{@additional_properties}>"
549
+ end
550
+ end
551
+ end
@@ -0,0 +1,107 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module CalendarApi
8
+ # A timestamp marking the start or end of an event. For all-day events, use
9
+ # date; for timed events, use dateTime.
10
+ class EventDateTime < BaseModel
11
+ SKIP = Object.new
12
+ private_constant :SKIP
13
+
14
+ # The date, in the format "yyyy-mm-dd", if this is an all-day event.
15
+ # @return [Date]
16
+ attr_accessor :date
17
+
18
+ # The time, as a combined date-time value (RFC3339). A time zone offset is
19
+ # required unless a time zone is explicitly specified in timeZone.
20
+ # @return [DateTime]
21
+ attr_accessor :date_time
22
+
23
+ # The time zone in which the time is specified. Formatted as an IANA Time
24
+ # Zone Database name, e.g. "America/New_York".
25
+ # @return [String]
26
+ attr_accessor :time_zone
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['date'] = 'date'
32
+ @_hash['date_time'] = 'dateTime'
33
+ @_hash['time_zone'] = 'timeZone'
34
+ @_hash
35
+ end
36
+
37
+ # An array for optional fields
38
+ def self.optionals
39
+ %w[
40
+ date
41
+ date_time
42
+ time_zone
43
+ ]
44
+ end
45
+
46
+ # An array for nullable fields
47
+ def self.nullables
48
+ []
49
+ end
50
+
51
+ def initialize(date: SKIP, date_time: SKIP, time_zone: SKIP,
52
+ additional_properties: nil)
53
+ # Add additional model properties to the instance
54
+ additional_properties = {} if additional_properties.nil?
55
+
56
+ @date = date unless date == SKIP
57
+ @date_time = date_time unless date_time == SKIP
58
+ @time_zone = time_zone unless time_zone == SKIP
59
+ @additional_properties = additional_properties
60
+ end
61
+
62
+ # Creates an instance of the object from a hash.
63
+ def self.from_hash(hash)
64
+ return nil unless hash
65
+
66
+ # Extract variables from the hash.
67
+ date = hash.key?('date') ? hash['date'] : SKIP
68
+ date_time = if hash.key?('dateTime')
69
+ (DateTimeHelper.from_rfc3339(hash['dateTime']) if hash['dateTime'])
70
+ else
71
+ SKIP
72
+ end
73
+ time_zone = hash.key?('timeZone') ? hash['timeZone'] : SKIP
74
+
75
+ # Create a new hash for additional properties, removing known properties.
76
+ new_hash = hash.reject { |k, _| names.value?(k) }
77
+
78
+ additional_properties = APIHelper.get_additional_properties(
79
+ new_hash, proc { |value| value }
80
+ )
81
+
82
+ # Create object from extracted values.
83
+ EventDateTime.new(date: date,
84
+ date_time: date_time,
85
+ time_zone: time_zone,
86
+ additional_properties: additional_properties)
87
+ end
88
+
89
+ def to_custom_date_time
90
+ DateTimeHelper.to_rfc3339(date_time)
91
+ end
92
+
93
+ # Provides a human-readable string representation of the object.
94
+ def to_s
95
+ class_name = self.class.name.split('::').last
96
+ "<#{class_name} date: #{@date}, date_time: #{@date_time}, time_zone: #{@time_zone},"\
97
+ " additional_properties: #{@additional_properties}>"
98
+ end
99
+
100
+ # Provides a debugging-friendly string with detailed object information.
101
+ def inspect
102
+ class_name = self.class.name.split('::').last
103
+ "<#{class_name} date: #{@date.inspect}, date_time: #{@date_time.inspect}, time_zone:"\
104
+ " #{@time_zone.inspect}, additional_properties: #{@additional_properties}>"
105
+ end
106
+ end
107
+ end