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,186 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # Initializes a new instance of RequestLoggingConfiguration.
8
+ class RequestLoggingConfiguration < CoreLibrary::ApiRequestLoggingConfiguration
9
+ # @param log_body [Boolean] Indicates whether the message body should be logged. Default is false.
10
+ # @param log_headers [Boolean] Indicates whether the message headers should be logged. Default is false.
11
+ # @param headers_to_exclude [Array<String>] Array of headers not displayed in logging. Default is an empty array.
12
+ # @param headers_to_include [Array<String>] Array of headers to be displayed in logging. Default is an empty array.
13
+ # @param headers_to_unmask [Array<String>] Array of headers which values are non-sensitive to display in logging.
14
+ # Default is an empty array.
15
+ def initialize(log_body: false, log_headers: false, headers_to_include: nil,
16
+ headers_to_exclude: nil, headers_to_unmask: nil,
17
+ include_query_in_path: false)
18
+ super(
19
+ log_body,
20
+ log_headers,
21
+ headers_to_exclude,
22
+ headers_to_include,
23
+ headers_to_unmask,
24
+ include_query_in_path
25
+ )
26
+ end
27
+
28
+ def clone_with(log_body: nil, log_headers: nil, headers_to_include: nil,
29
+ headers_to_exclude: nil, headers_to_unmask: nil, include_query_in_path: nil)
30
+ log_body ||= self.log_body
31
+ log_headers ||= self.log_headers
32
+ headers_to_include ||= self.headers_to_include
33
+ headers_to_exclude ||= self.headers_to_exclude
34
+ headers_to_unmask ||= self.headers_to_unmask
35
+ include_query_in_path ||= self.include_query_in_path
36
+
37
+ RequestLoggingConfiguration.new(
38
+ log_body: log_body,
39
+ log_headers: log_headers,
40
+ headers_to_include: headers_to_include,
41
+ headers_to_exclude: headers_to_exclude,
42
+ headers_to_unmask: headers_to_unmask,
43
+ include_query_in_path: include_query_in_path
44
+ )
45
+ end
46
+
47
+ def self.from_env
48
+ log_body = ENV['REQUEST_LOG_BODY']
49
+ log_headers = ENV['REQUEST_LOG_HEADERS']
50
+ headers_to_include = ENV['REQUEST_HEADERS_TO_INCLUDE']
51
+ headers_to_exclude = ENV['REQUEST_HEADERS_TO_EXCLUDE']
52
+ headers_to_unmask = ENV['REQUEST_HEADERS_TO_UNMASK']
53
+ include_query_in_path = ENV['REQUEST_INCLUDE_QUERY_IN_PATH']
54
+
55
+ new(
56
+ log_body: log_body,
57
+ log_headers: log_headers,
58
+ headers_to_include: headers_to_include,
59
+ headers_to_exclude: headers_to_exclude,
60
+ headers_to_unmask: headers_to_unmask,
61
+ include_query_in_path: include_query_in_path
62
+ )
63
+ end
64
+
65
+ def self.any_logging_configured?
66
+ %w[
67
+ REQUEST_LOG_BODY
68
+ REQUEST_LOG_HEADERS
69
+ REQUEST_HEADERS_TO_INCLUDE
70
+ REQUEST_HEADERS_TO_EXCLUDE
71
+ REQUEST_HEADERS_TO_UNMASK
72
+ REQUEST_INCLUDE_QUERY_IN_PATH
73
+ ].any? { |key| ENV.key?(key) && !ENV[key].nil? && !ENV[key].empty? }
74
+ end
75
+ end
76
+
77
+ # Initializes a new instance of ResponseLoggingConfiguration.
78
+ class ResponseLoggingConfiguration < CoreLibrary::ApiResponseLoggingConfiguration
79
+ def initialize(log_body: false, log_headers: false, headers_to_include: nil,
80
+ headers_to_exclude: nil, headers_to_unmask: nil)
81
+ super(
82
+ log_body,
83
+ log_headers,
84
+ headers_to_exclude,
85
+ headers_to_include,
86
+ headers_to_unmask
87
+ )
88
+ end
89
+
90
+ def clone_with(log_body: nil, log_headers: nil, headers_to_include: nil,
91
+ headers_to_exclude: nil, headers_to_unmask: nil)
92
+ log_body ||= self.log_body
93
+ log_headers ||= self.log_headers
94
+ headers_to_include ||= self.headers_to_include
95
+ headers_to_exclude ||= self.headers_to_exclude
96
+ headers_to_unmask ||= self.headers_to_unmask
97
+
98
+ ResponseLoggingConfiguration.new(
99
+ log_body: log_body,
100
+ log_headers: log_headers,
101
+ headers_to_include: headers_to_include,
102
+ headers_to_exclude: headers_to_exclude,
103
+ headers_to_unmask: headers_to_unmask
104
+ )
105
+ end
106
+
107
+ def self.from_env
108
+ log_body = ENV['RESPONSE_LOG_BODY']
109
+ log_headers = ENV['RESPONSE_LOG_HEADERS']
110
+ headers_to_include = ENV['RESPONSE_HEADERS_TO_INCLUDE']
111
+ headers_to_exclude = ENV['RESPONSE_HEADERS_TO_EXCLUDE']
112
+ headers_to_unmask = ENV['RESPONSE_HEADERS_TO_UNMASK']
113
+
114
+ new(
115
+ log_body: log_body,
116
+ log_headers: log_headers,
117
+ headers_to_include: headers_to_include,
118
+ headers_to_exclude: headers_to_exclude,
119
+ headers_to_unmask: headers_to_unmask
120
+ )
121
+ end
122
+
123
+ def self.any_logging_configured?
124
+ %w[
125
+ RESPONSE_LOG_BODY
126
+ RESPONSE_LOG_HEADERS
127
+ RESPONSE_HEADERS_TO_INCLUDE
128
+ RESPONSE_HEADERS_TO_EXCLUDE
129
+ RESPONSE_HEADERS_TO_UNMASK
130
+ ].any? { |key| ENV.key?(key) && !ENV[key].nil? && !ENV[key].empty? }
131
+ end
132
+ end
133
+
134
+ # Initializes a new instance of LoggingConfiguration.
135
+ class LoggingConfiguration < CoreLibrary::ApiLoggingConfiguration
136
+ def initialize(logger: nil, log_level: nil, mask_sensitive_headers: true,
137
+ request_logging_config: nil,
138
+ response_logging_config: nil)
139
+ request_logging_config ||= RequestLoggingConfiguration.new
140
+ response_logging_config ||= ResponseLoggingConfiguration.new
141
+ super(
142
+ logger,
143
+ log_level,
144
+ request_logging_config,
145
+ response_logging_config,
146
+ mask_sensitive_headers
147
+ )
148
+ end
149
+
150
+ def clone_with(logger: nil, log_level: nil, mask_sensitive_headers: nil,
151
+ request_logging_config: nil, response_logging_config: nil)
152
+ logger ||= self.logger
153
+ log_level ||= self.log_level
154
+ mask_sensitive_headers ||= self.mask_sensitive_headers
155
+ request_logging_config ||= self.request_logging_config.clone
156
+ response_logging_config ||= self.response_logging_config.clone
157
+
158
+ LoggingConfiguration.new(
159
+ logger: logger,
160
+ log_level: log_level,
161
+ mask_sensitive_headers: mask_sensitive_headers,
162
+ request_logging_config: request_logging_config,
163
+ response_logging_config: response_logging_config
164
+ )
165
+ end
166
+
167
+ def self.from_env
168
+ log_level = ENV['LOG_LEVEL']
169
+ mask_sensitive_headers = ENV['MASK_SENSITIVE_HEADERS']
170
+
171
+ new(
172
+ log_level: log_level,
173
+ mask_sensitive_headers: mask_sensitive_headers,
174
+ request_logging_config: RequestLoggingConfiguration.from_env,
175
+ response_logging_config: ResponseLoggingConfiguration.from_env
176
+ )
177
+ end
178
+
179
+ def self.any_logging_configured?
180
+ RequestLoggingConfiguration.any_logging_configured? ||
181
+ ResponseLoggingConfiguration.any_logging_configured? ||
182
+ ENV.key?('LOG_LEVEL') ||
183
+ ENV.key?('MASK_SENSITIVE_HEADERS')
184
+ end
185
+ end
186
+ end
@@ -0,0 +1,17 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # Represents the generic logger facade
8
+ class AbstractLogger < Logger
9
+ # Logs a message with a specified log level and additional parameters.
10
+ # @param level [Symbol] The log level of the message.
11
+ # @param message [String] The message to log.
12
+ # @param params [Hash] Additional parameters to include in the log message.
13
+ def log(level, message, params)
14
+ raise NotImplementedError, 'This method needs to be implemented in a child class.'
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,115 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # A file attachment for an event.
8
+ class Attachment < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # URL link to the attachment. Required when adding an attachment.
13
+ # @return [String]
14
+ attr_accessor :file_url
15
+
16
+ # Attachment title.
17
+ # @return [String]
18
+ attr_accessor :title
19
+
20
+ # Internet media type (MIME type) of the attachment.
21
+ # @return [String]
22
+ attr_accessor :mime_type
23
+
24
+ # URL link to the attachment's icon.
25
+ # @return [String]
26
+ attr_accessor :icon_link
27
+
28
+ # ID of the attached file. Only populated for Google Drive files.
29
+ # @return [String]
30
+ attr_accessor :file_id
31
+
32
+ # A mapping from model property names to API property names.
33
+ def self.names
34
+ @_hash = {} if @_hash.nil?
35
+ @_hash['file_url'] = 'fileUrl'
36
+ @_hash['title'] = 'title'
37
+ @_hash['mime_type'] = 'mimeType'
38
+ @_hash['icon_link'] = 'iconLink'
39
+ @_hash['file_id'] = 'fileId'
40
+ @_hash
41
+ end
42
+
43
+ # An array for optional fields
44
+ def self.optionals
45
+ %w[
46
+ file_url
47
+ title
48
+ mime_type
49
+ icon_link
50
+ file_id
51
+ ]
52
+ end
53
+
54
+ # An array for nullable fields
55
+ def self.nullables
56
+ []
57
+ end
58
+
59
+ def initialize(file_url: SKIP, title: SKIP, mime_type: SKIP,
60
+ icon_link: SKIP, file_id: SKIP, additional_properties: nil)
61
+ # Add additional model properties to the instance
62
+ additional_properties = {} if additional_properties.nil?
63
+
64
+ @file_url = file_url unless file_url == SKIP
65
+ @title = title unless title == SKIP
66
+ @mime_type = mime_type unless mime_type == SKIP
67
+ @icon_link = icon_link unless icon_link == SKIP
68
+ @file_id = file_id unless file_id == SKIP
69
+ @additional_properties = additional_properties
70
+ end
71
+
72
+ # Creates an instance of the object from a hash.
73
+ def self.from_hash(hash)
74
+ return nil unless hash
75
+
76
+ # Extract variables from the hash.
77
+ file_url = hash.key?('fileUrl') ? hash['fileUrl'] : SKIP
78
+ title = hash.key?('title') ? hash['title'] : SKIP
79
+ mime_type = hash.key?('mimeType') ? hash['mimeType'] : SKIP
80
+ icon_link = hash.key?('iconLink') ? hash['iconLink'] : SKIP
81
+ file_id = hash.key?('fileId') ? hash['fileId'] : SKIP
82
+
83
+ # Create a new hash for additional properties, removing known properties.
84
+ new_hash = hash.reject { |k, _| names.value?(k) }
85
+
86
+ additional_properties = APIHelper.get_additional_properties(
87
+ new_hash, proc { |value| value }
88
+ )
89
+
90
+ # Create object from extracted values.
91
+ Attachment.new(file_url: file_url,
92
+ title: title,
93
+ mime_type: mime_type,
94
+ icon_link: icon_link,
95
+ file_id: file_id,
96
+ additional_properties: additional_properties)
97
+ end
98
+
99
+ # Provides a human-readable string representation of the object.
100
+ def to_s
101
+ class_name = self.class.name.split('::').last
102
+ "<#{class_name} file_url: #{@file_url}, title: #{@title}, mime_type: #{@mime_type},"\
103
+ " icon_link: #{@icon_link}, file_id: #{@file_id}, additional_properties:"\
104
+ " #{@additional_properties}>"
105
+ end
106
+
107
+ # Provides a debugging-friendly string with detailed object information.
108
+ def inspect
109
+ class_name = self.class.name.split('::').last
110
+ "<#{class_name} file_url: #{@file_url.inspect}, title: #{@title.inspect}, mime_type:"\
111
+ " #{@mime_type.inspect}, icon_link: #{@icon_link.inspect}, file_id: #{@file_id.inspect},"\
112
+ " additional_properties: #{@additional_properties}>"
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,167 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # An attendee of an event.
8
+ class Attendee < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The attendee's Profile ID.
13
+ # @return [String]
14
+ attr_accessor :id
15
+
16
+ # The attendee's email address. Required when adding an attendee.
17
+ # @return [String]
18
+ attr_accessor :email
19
+
20
+ # The attendee's name.
21
+ # @return [String]
22
+ attr_accessor :display_name
23
+
24
+ # Whether the attendee is the organizer of the event.
25
+ # @return [TrueClass | FalseClass]
26
+ attr_accessor :organizer
27
+
28
+ # Whether this entry represents the calendar on which this copy of the event
29
+ # appears.
30
+ # @return [TrueClass | FalseClass]
31
+ attr_accessor :mself
32
+
33
+ # Whether the attendee is a resource (e.g. a room).
34
+ # @return [TrueClass | FalseClass]
35
+ attr_accessor :resource
36
+
37
+ # Whether this is an optional attendee.
38
+ # @return [TrueClass | FalseClass]
39
+ attr_accessor :optional
40
+
41
+ # The attendee's response status.
42
+ # @return [ResponseStatus]
43
+ attr_accessor :response_status
44
+
45
+ # The attendee's response comment.
46
+ # @return [String]
47
+ attr_accessor :comment
48
+
49
+ # Number of additional guests the attendee is bringing.
50
+ # @return [Integer]
51
+ attr_accessor :additional_guests
52
+
53
+ # A mapping from model property names to API property names.
54
+ def self.names
55
+ @_hash = {} if @_hash.nil?
56
+ @_hash['id'] = 'id'
57
+ @_hash['email'] = 'email'
58
+ @_hash['display_name'] = 'displayName'
59
+ @_hash['organizer'] = 'organizer'
60
+ @_hash['mself'] = 'self'
61
+ @_hash['resource'] = 'resource'
62
+ @_hash['optional'] = 'optional'
63
+ @_hash['response_status'] = 'responseStatus'
64
+ @_hash['comment'] = 'comment'
65
+ @_hash['additional_guests'] = 'additionalGuests'
66
+ @_hash
67
+ end
68
+
69
+ # An array for optional fields
70
+ def self.optionals
71
+ %w[
72
+ id
73
+ email
74
+ display_name
75
+ organizer
76
+ mself
77
+ resource
78
+ optional
79
+ response_status
80
+ comment
81
+ additional_guests
82
+ ]
83
+ end
84
+
85
+ # An array for nullable fields
86
+ def self.nullables
87
+ []
88
+ end
89
+
90
+ def initialize(id: SKIP, email: SKIP, display_name: SKIP, organizer: SKIP,
91
+ mself: SKIP, resource: SKIP, optional: false,
92
+ response_status: SKIP, comment: SKIP, additional_guests: 0,
93
+ additional_properties: nil)
94
+ # Add additional model properties to the instance
95
+ additional_properties = {} if additional_properties.nil?
96
+
97
+ @id = id unless id == SKIP
98
+ @email = email unless email == SKIP
99
+ @display_name = display_name unless display_name == SKIP
100
+ @organizer = organizer unless organizer == SKIP
101
+ @mself = mself unless mself == SKIP
102
+ @resource = resource unless resource == SKIP
103
+ @optional = optional unless optional == SKIP
104
+ @response_status = response_status unless response_status == SKIP
105
+ @comment = comment unless comment == SKIP
106
+ @additional_guests = additional_guests unless additional_guests == SKIP
107
+ @additional_properties = additional_properties
108
+ end
109
+
110
+ # Creates an instance of the object from a hash.
111
+ def self.from_hash(hash)
112
+ return nil unless hash
113
+
114
+ # Extract variables from the hash.
115
+ id = hash.key?('id') ? hash['id'] : SKIP
116
+ email = hash.key?('email') ? hash['email'] : SKIP
117
+ display_name = hash.key?('displayName') ? hash['displayName'] : SKIP
118
+ organizer = hash.key?('organizer') ? hash['organizer'] : SKIP
119
+ mself = hash.key?('self') ? hash['self'] : SKIP
120
+ resource = hash.key?('resource') ? hash['resource'] : SKIP
121
+ optional = hash['optional'] ||= false
122
+ response_status =
123
+ hash.key?('responseStatus') ? hash['responseStatus'] : SKIP
124
+ comment = hash.key?('comment') ? hash['comment'] : SKIP
125
+ additional_guests = hash['additionalGuests'] ||= 0
126
+
127
+ # Create a new hash for additional properties, removing known properties.
128
+ new_hash = hash.reject { |k, _| names.value?(k) }
129
+
130
+ additional_properties = APIHelper.get_additional_properties(
131
+ new_hash, proc { |value| value }
132
+ )
133
+
134
+ # Create object from extracted values.
135
+ Attendee.new(id: id,
136
+ email: email,
137
+ display_name: display_name,
138
+ organizer: organizer,
139
+ mself: mself,
140
+ resource: resource,
141
+ optional: optional,
142
+ response_status: response_status,
143
+ comment: comment,
144
+ additional_guests: additional_guests,
145
+ additional_properties: additional_properties)
146
+ end
147
+
148
+ # Provides a human-readable string representation of the object.
149
+ def to_s
150
+ class_name = self.class.name.split('::').last
151
+ "<#{class_name} id: #{@id}, email: #{@email}, display_name: #{@display_name}, organizer:"\
152
+ " #{@organizer}, mself: #{@mself}, resource: #{@resource}, optional: #{@optional},"\
153
+ " response_status: #{@response_status}, comment: #{@comment}, additional_guests:"\
154
+ " #{@additional_guests}, additional_properties: #{@additional_properties}>"
155
+ end
156
+
157
+ # Provides a debugging-friendly string with detailed object information.
158
+ def inspect
159
+ class_name = self.class.name.split('::').last
160
+ "<#{class_name} id: #{@id.inspect}, email: #{@email.inspect}, display_name:"\
161
+ " #{@display_name.inspect}, organizer: #{@organizer.inspect}, mself: #{@mself.inspect},"\
162
+ " resource: #{@resource.inspect}, optional: #{@optional.inspect}, response_status:"\
163
+ " #{@response_status.inspect}, comment: #{@comment.inspect}, additional_guests:"\
164
+ " #{@additional_guests.inspect}, additional_properties: #{@additional_properties}>"
165
+ end
166
+ end
167
+ end
@@ -0,0 +1,40 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # Whether to auto-decline conflicting meeting invitations.
8
+ class AutoDeclineMode
9
+ AUTO_DECLINE_MODE = [
10
+ # TODO: Write general description for DECLINENONE
11
+ DECLINENONE = 'declineNone'.freeze,
12
+
13
+ # TODO: Write general description for DECLINEALLCONFLICTINGINVITATIONS
14
+ DECLINEALLCONFLICTINGINVITATIONS = 'declineAllConflictingInvitations'.freeze,
15
+
16
+ # TODO: Write general description for DECLINEONLYNEWCONFLICTINGINVITATIONS
17
+ DECLINEONLYNEWCONFLICTINGINVITATIONS = 'declineOnlyNewConflictingInvitations'.freeze
18
+ ].freeze
19
+
20
+ def self.validate(value)
21
+ return false if value.nil?
22
+
23
+ AUTO_DECLINE_MODE.include?(value)
24
+ end
25
+
26
+ def self.from_value(value, default_value = DECLINENONE)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'declinenone' then DECLINENONE
33
+ when 'declineallconflictinginvitations' then DECLINEALLCONFLICTINGINVITATIONS
34
+ when 'declineonlynewconflictinginvitations' then DECLINEONLYNEWCONFLICTINGINVITATIONS
35
+ else
36
+ default_value
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,110 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # Base model.
8
+ # rubocop:disable all
9
+ class BaseModel < CoreLibrary::BaseModel
10
+ # Returns a Hash representation of the current object.
11
+ def to_hash
12
+ # validating the model being serialized
13
+ self.class.validate(self) if self.class.respond_to?(:validate)
14
+
15
+ hash = {}
16
+ instance_variables.each do |name|
17
+ value = instance_variable_get(name)
18
+ name = name[1..]
19
+ if name == 'additional_properties'
20
+ additional_properties = process_additional_properties(value, self.class.names)
21
+ hash.merge!(additional_properties)
22
+ else
23
+ key = self.class.names.key?(name) ? self.class.names[name] : name
24
+ optional_fields = self.class.optionals
25
+ nullable_fields = self.class.nullables
26
+ if value.nil?
27
+ next unless nullable_fields.include?(name)
28
+
29
+ if !optional_fields.include?(name) && !nullable_fields.include?(name)
30
+ raise ArgumentError,
31
+ "`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
32
+ end
33
+ end
34
+
35
+ hash[key] = nil
36
+ unless value.nil?
37
+ if respond_to?("to_custom_#{name}")
38
+ if (value.instance_of? Array) || (value.instance_of? Hash)
39
+ params = [hash, key]
40
+ hash[key] = send("to_custom_#{name}", *params)
41
+ else
42
+ hash[key] = send("to_custom_#{name}")
43
+ end
44
+ elsif respond_to?("to_union_type_#{name}")
45
+ hash[key] = send("to_union_type_#{name}")
46
+ elsif value.instance_of? Array
47
+ hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
48
+ elsif value.instance_of? Hash
49
+ hash[key] = {}
50
+ value.each do |k, v|
51
+ hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
52
+ end
53
+ else
54
+ hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
55
+ end
56
+ end
57
+ end
58
+ end
59
+ hash
60
+ end
61
+
62
+ # Processes additional properties, ensuring no conflicts with existing properties.
63
+ def process_additional_properties(additional_properties, existing_prop_names)
64
+ hash = {}
65
+ additional_properties.each do |name, value|
66
+ check_for_conflict(name, existing_prop_names)
67
+
68
+ hash[name] = if value.is_a?(Array)
69
+ process_array(value)
70
+ elsif value.is_a?(Hash)
71
+ process_hash(value)
72
+ else
73
+ process_basic_value(value)
74
+ end
75
+ end
76
+ hash
77
+ end
78
+
79
+ # Checks if an additional property conflicts with a model's existing property.
80
+ def check_for_conflict(name, existing_prop_names)
81
+ return unless existing_prop_names.key?(name)
82
+
83
+ raise ArgumentError, "An additional property key, '#{name}' conflicts with one of the model's properties"
84
+ end
85
+
86
+ # Processes an array of values, recursively calling `to_hash` on BaseModel objects.
87
+ def process_array(value)
88
+ value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
89
+ end
90
+
91
+ # Processes a hash of values, recursively calling `to_hash` on BaseModel objects.
92
+ def process_hash(value)
93
+ value.transform_values do |v|
94
+ v.is_a?(BaseModel) ? v.to_hash : v
95
+ end
96
+ end
97
+
98
+ # Processes a basic value (non-array, non-hash).
99
+ def process_basic_value(value)
100
+ value.is_a?(BaseModel) ? value.to_hash : value
101
+ end
102
+
103
+ # Returns a JSON representation of the curent object.
104
+ def to_json(options = {})
105
+ hash = to_hash
106
+ hash.to_json(options)
107
+ end
108
+ end
109
+ # rubocop:enable all
110
+ end