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,135 @@
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
+ # Response with free/busy information.
9
+ class FreeBusyResponse < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # Type of the resource.
14
+ # @return [String]
15
+ attr_accessor :kind
16
+
17
+ # The start of the time range queried.
18
+ # @return [DateTime]
19
+ attr_accessor :time_min
20
+
21
+ # The end of the time range queried.
22
+ # @return [DateTime]
23
+ attr_accessor :time_max
24
+
25
+ # Free/busy information for each requested calendar.
26
+ # @return [Hash[String, FreeBusyCalendar]]
27
+ attr_accessor :calendars
28
+
29
+ # Expansion of groups.
30
+ # @return [Hash[String, FreeBusyGroup]]
31
+ attr_accessor :groups
32
+
33
+ # A mapping from model property names to API property names.
34
+ def self.names
35
+ @_hash = {} if @_hash.nil?
36
+ @_hash['kind'] = 'kind'
37
+ @_hash['time_min'] = 'timeMin'
38
+ @_hash['time_max'] = 'timeMax'
39
+ @_hash['calendars'] = 'calendars'
40
+ @_hash['groups'] = 'groups'
41
+ @_hash
42
+ end
43
+
44
+ # An array for optional fields
45
+ def self.optionals
46
+ %w[
47
+ kind
48
+ time_min
49
+ time_max
50
+ calendars
51
+ groups
52
+ ]
53
+ end
54
+
55
+ # An array for nullable fields
56
+ def self.nullables
57
+ []
58
+ end
59
+
60
+ def initialize(kind: 'calendar#freeBusy', time_min: SKIP, time_max: SKIP,
61
+ calendars: SKIP, groups: SKIP, additional_properties: nil)
62
+ # Add additional model properties to the instance
63
+ additional_properties = {} if additional_properties.nil?
64
+
65
+ @kind = kind unless kind == SKIP
66
+ @time_min = time_min unless time_min == SKIP
67
+ @time_max = time_max unless time_max == SKIP
68
+ @calendars = calendars unless calendars == SKIP
69
+ @groups = groups unless groups == SKIP
70
+ @additional_properties = additional_properties
71
+ end
72
+
73
+ # Creates an instance of the object from a hash.
74
+ def self.from_hash(hash)
75
+ return nil unless hash
76
+
77
+ # Extract variables from the hash.
78
+ kind = hash['kind'] ||= 'calendar#freeBusy'
79
+ time_min = if hash.key?('timeMin')
80
+ (DateTimeHelper.from_rfc3339(hash['timeMin']) if hash['timeMin'])
81
+ else
82
+ SKIP
83
+ end
84
+ time_max = if hash.key?('timeMax')
85
+ (DateTimeHelper.from_rfc3339(hash['timeMax']) if hash['timeMax'])
86
+ else
87
+ SKIP
88
+ end
89
+ calendars = FreeBusyCalendar.from_hash(hash['calendars']) if hash['calendars']
90
+
91
+ calendars = SKIP unless hash.key?('calendars')
92
+ groups = FreeBusyGroup.from_hash(hash['groups']) if hash['groups']
93
+
94
+ groups = SKIP unless hash.key?('groups')
95
+
96
+ # Create a new hash for additional properties, removing known properties.
97
+ new_hash = hash.reject { |k, _| names.value?(k) }
98
+
99
+ additional_properties = APIHelper.get_additional_properties(
100
+ new_hash, proc { |value| value }
101
+ )
102
+
103
+ # Create object from extracted values.
104
+ FreeBusyResponse.new(kind: kind,
105
+ time_min: time_min,
106
+ time_max: time_max,
107
+ calendars: calendars,
108
+ groups: groups,
109
+ additional_properties: additional_properties)
110
+ end
111
+
112
+ def to_custom_time_min
113
+ DateTimeHelper.to_rfc3339(time_min)
114
+ end
115
+
116
+ def to_custom_time_max
117
+ DateTimeHelper.to_rfc3339(time_max)
118
+ end
119
+
120
+ # Provides a human-readable string representation of the object.
121
+ def to_s
122
+ class_name = self.class.name.split('::').last
123
+ "<#{class_name} kind: #{@kind}, time_min: #{@time_min}, time_max: #{@time_max}, calendars:"\
124
+ " #{@calendars}, groups: #{@groups}, additional_properties: #{@additional_properties}>"
125
+ end
126
+
127
+ # Provides a debugging-friendly string with detailed object information.
128
+ def inspect
129
+ class_name = self.class.name.split('::').last
130
+ "<#{class_name} kind: #{@kind.inspect}, time_min: #{@time_min.inspect}, time_max:"\
131
+ " #{@time_max.inspect}, calendars: #{@calendars.inspect}, groups: #{@groups.inspect},"\
132
+ " additional_properties: #{@additional_properties}>"
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,62 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # OAuth 2 Authorization error codes
8
+ class OauthProviderError
9
+ OAUTH_PROVIDER_ERROR = [
10
+ # The request is missing a required parameter, includes an unsupported
11
+ # parameter value (other than grant type), repeats a parameter, includes
12
+ # multiple credentials, utilizes more than one mechanism for
13
+ # authenticating the client, or is otherwise malformed.
14
+ INVALID_REQUEST = 'invalid_request'.freeze,
15
+
16
+ # Client authentication failed (e.g., unknown client, no client
17
+ # authentication included, or unsupported authentication method).
18
+ INVALID_CLIENT = 'invalid_client'.freeze,
19
+
20
+ # The provided authorization grant (e.g., authorization code, resource
21
+ # owner credentials) or refresh token is invalid, expired, revoked, does
22
+ # not match the redirection URI used in the authorization request, or was
23
+ # issued to another client.
24
+ INVALID_GRANT = 'invalid_grant'.freeze,
25
+
26
+ # The authenticated client is not authorized to use this authorization
27
+ # grant type.
28
+ UNAUTHORIZED_CLIENT = 'unauthorized_client'.freeze,
29
+
30
+ # The authorization grant type is not supported by the authorization
31
+ # server.
32
+ UNSUPPORTED_GRANT_TYPE = 'unsupported_grant_type'.freeze,
33
+
34
+ # The requested scope is invalid, unknown, malformed, or exceeds the scope
35
+ # granted by the resource owner.
36
+ INVALID_SCOPE = 'invalid_scope'.freeze
37
+ ].freeze
38
+
39
+ def self.validate(value)
40
+ return false if value.nil?
41
+
42
+ OAUTH_PROVIDER_ERROR.include?(value)
43
+ end
44
+
45
+ def self.from_value(value, default_value = INVALID_REQUEST)
46
+ return default_value if value.nil?
47
+
48
+ str = value.to_s.strip
49
+
50
+ case str.downcase
51
+ when 'invalid_request' then INVALID_REQUEST
52
+ when 'invalid_client' then INVALID_CLIENT
53
+ when 'invalid_grant' then INVALID_GRANT
54
+ when 'unauthorized_client' then UNAUTHORIZED_CLIENT
55
+ when 'unsupported_grant_type' then UNSUPPORTED_GRANT_TYPE
56
+ when 'invalid_scope' then INVALID_SCOPE
57
+ else
58
+ default_value
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,41 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # OAuth 2 scopes supported by the API
8
+ class OauthScope
9
+ OAUTH_SCOPE = [
10
+ # See and download any calendar you can access using your Google Calendar.
11
+ HTTPS_WWW_GOOGLEAPIS_COM_AUTH_CALENDAR_READONLY = 'https://www.googleapis.com/auth/calendar.readonly'.freeze,
12
+
13
+ # View and edit events on all your calendars.
14
+ HTTPS_WWW_GOOGLEAPIS_COM_AUTH_CALENDAR_EVENTS = 'https://www.googleapis.com/auth/calendar.events'.freeze,
15
+
16
+ # See, edit, share, and permanently delete all the calendars you can
17
+ # access using Google Calendar.
18
+ HTTPS_WWW_GOOGLEAPIS_COM_AUTH_CALENDAR = 'https://www.googleapis.com/auth/calendar'.freeze
19
+ ].freeze
20
+
21
+ def self.validate(value)
22
+ return false if value.nil?
23
+
24
+ OAUTH_SCOPE.include?(value)
25
+ end
26
+
27
+ def self.from_value(value, default_value = HTTPS_WWW_GOOGLEAPIS_COM_AUTH_CALENDAR_READONLY)
28
+ return default_value if value.nil?
29
+
30
+ str = value.to_s.strip
31
+
32
+ case str.downcase
33
+ when 'https_www_googleapis_com_auth_calendar_readonly' then HTTPS_WWW_GOOGLEAPIS_COM_AUTH_CALENDAR_READONLY
34
+ when 'https_www_googleapis_com_auth_calendar_events' then HTTPS_WWW_GOOGLEAPIS_COM_AUTH_CALENDAR_EVENTS
35
+ when 'https_www_googleapis_com_auth_calendar' then HTTPS_WWW_GOOGLEAPIS_COM_AUTH_CALENDAR
36
+ else
37
+ default_value
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,96 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # OAuth 2 Authorization endpoint response
8
+ class OauthToken < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Access token
13
+ # @return [String]
14
+ attr_accessor :access_token
15
+
16
+ # Type of access token
17
+ # @return [String]
18
+ attr_accessor :token_type
19
+
20
+ # Time in seconds before the access token expires
21
+ # @return [Integer]
22
+ attr_accessor :expires_in
23
+
24
+ # List of scopes granted
25
+ # This is a space-delimited list of strings.
26
+ # @return [String]
27
+ attr_accessor :scope
28
+
29
+ # Time of token expiry as unix timestamp (UTC)
30
+ # @return [Integer]
31
+ attr_accessor :expiry
32
+
33
+ # Refresh token
34
+ # Used to get a new access token when it expires.
35
+ # @return [String]
36
+ attr_accessor :refresh_token
37
+
38
+ # A mapping from model property names to API property names.
39
+ def self.names
40
+ @_hash = {} if @_hash.nil?
41
+ @_hash['access_token'] = 'access_token'
42
+ @_hash['token_type'] = 'token_type'
43
+ @_hash['expires_in'] = 'expires_in'
44
+ @_hash['scope'] = 'scope'
45
+ @_hash['expiry'] = 'expiry'
46
+ @_hash['refresh_token'] = 'refresh_token'
47
+ @_hash
48
+ end
49
+
50
+ # An array for optional fields
51
+ def self.optionals
52
+ %w[
53
+ expires_in
54
+ scope
55
+ expiry
56
+ refresh_token
57
+ ]
58
+ end
59
+
60
+ # An array for nullable fields
61
+ def self.nullables
62
+ []
63
+ end
64
+
65
+ def initialize(access_token:, token_type:, expires_in: SKIP, scope: SKIP,
66
+ expiry: SKIP, refresh_token: SKIP)
67
+ @access_token = access_token
68
+ @token_type = token_type
69
+ @expires_in = expires_in unless expires_in == SKIP
70
+ @scope = scope unless scope == SKIP
71
+ @expiry = expiry unless expiry == SKIP
72
+ @refresh_token = refresh_token unless refresh_token == SKIP
73
+ end
74
+
75
+ # Creates an instance of the object from a hash.
76
+ def self.from_hash(hash)
77
+ return nil unless hash
78
+
79
+ # Extract variables from the hash.
80
+ access_token = hash.key?('access_token') ? hash['access_token'] : nil
81
+ token_type = hash.key?('token_type') ? hash['token_type'] : nil
82
+ expires_in = hash.key?('expires_in') ? hash['expires_in'] : SKIP
83
+ scope = hash.key?('scope') ? hash['scope'] : SKIP
84
+ expiry = hash.key?('expiry') ? hash['expiry'] : SKIP
85
+ refresh_token = hash.key?('refresh_token') ? hash['refresh_token'] : SKIP
86
+
87
+ # Create object from extracted values.
88
+ OauthToken.new(access_token: access_token,
89
+ token_type: token_type,
90
+ expires_in: expires_in,
91
+ scope: scope,
92
+ expiry: expiry,
93
+ refresh_token: refresh_token)
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,116 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # Office location details for a working location event.
8
+ class OfficeLocation < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Building identifier.
13
+ # @return [String]
14
+ attr_accessor :building_id
15
+
16
+ # Floor identifier.
17
+ # @return [String]
18
+ attr_accessor :floor_id
19
+
20
+ # Floor section identifier.
21
+ # @return [String]
22
+ attr_accessor :floor_section_id
23
+
24
+ # Desk identifier.
25
+ # @return [String]
26
+ attr_accessor :desk_id
27
+
28
+ # Office name displayed in Calendar Web and Mobile clients.
29
+ # @return [String]
30
+ attr_accessor :label
31
+
32
+ # A mapping from model property names to API property names.
33
+ def self.names
34
+ @_hash = {} if @_hash.nil?
35
+ @_hash['building_id'] = 'buildingId'
36
+ @_hash['floor_id'] = 'floorId'
37
+ @_hash['floor_section_id'] = 'floorSectionId'
38
+ @_hash['desk_id'] = 'deskId'
39
+ @_hash['label'] = 'label'
40
+ @_hash
41
+ end
42
+
43
+ # An array for optional fields
44
+ def self.optionals
45
+ %w[
46
+ building_id
47
+ floor_id
48
+ floor_section_id
49
+ desk_id
50
+ label
51
+ ]
52
+ end
53
+
54
+ # An array for nullable fields
55
+ def self.nullables
56
+ []
57
+ end
58
+
59
+ def initialize(building_id: SKIP, floor_id: SKIP, floor_section_id: SKIP,
60
+ desk_id: SKIP, label: SKIP, additional_properties: nil)
61
+ # Add additional model properties to the instance
62
+ additional_properties = {} if additional_properties.nil?
63
+
64
+ @building_id = building_id unless building_id == SKIP
65
+ @floor_id = floor_id unless floor_id == SKIP
66
+ @floor_section_id = floor_section_id unless floor_section_id == SKIP
67
+ @desk_id = desk_id unless desk_id == SKIP
68
+ @label = label unless label == 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
+ building_id = hash.key?('buildingId') ? hash['buildingId'] : SKIP
78
+ floor_id = hash.key?('floorId') ? hash['floorId'] : SKIP
79
+ floor_section_id =
80
+ hash.key?('floorSectionId') ? hash['floorSectionId'] : SKIP
81
+ desk_id = hash.key?('deskId') ? hash['deskId'] : SKIP
82
+ label = hash.key?('label') ? hash['label'] : SKIP
83
+
84
+ # Create a new hash for additional properties, removing known properties.
85
+ new_hash = hash.reject { |k, _| names.value?(k) }
86
+
87
+ additional_properties = APIHelper.get_additional_properties(
88
+ new_hash, proc { |value| value }
89
+ )
90
+
91
+ # Create object from extracted values.
92
+ OfficeLocation.new(building_id: building_id,
93
+ floor_id: floor_id,
94
+ floor_section_id: floor_section_id,
95
+ desk_id: desk_id,
96
+ label: label,
97
+ additional_properties: additional_properties)
98
+ end
99
+
100
+ # Provides a human-readable string representation of the object.
101
+ def to_s
102
+ class_name = self.class.name.split('::').last
103
+ "<#{class_name} building_id: #{@building_id}, floor_id: #{@floor_id}, floor_section_id:"\
104
+ " #{@floor_section_id}, desk_id: #{@desk_id}, label: #{@label}, additional_properties:"\
105
+ " #{@additional_properties}>"
106
+ end
107
+
108
+ # Provides a debugging-friendly string with detailed object information.
109
+ def inspect
110
+ class_name = self.class.name.split('::').last
111
+ "<#{class_name} building_id: #{@building_id.inspect}, floor_id: #{@floor_id.inspect},"\
112
+ " floor_section_id: #{@floor_section_id.inspect}, desk_id: #{@desk_id.inspect}, label:"\
113
+ " #{@label.inspect}, additional_properties: #{@additional_properties}>"
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,88 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # Out-of-office event data. Used if eventType is outOfOffice.
8
+ class OutOfOfficeProperties < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Whether to auto-decline conflicting meeting invitations.
13
+ # @return [AutoDeclineMode]
14
+ attr_accessor :auto_decline_mode
15
+
16
+ # Response message to set when auto-declining invitations.
17
+ # @return [String]
18
+ attr_accessor :decline_message
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['auto_decline_mode'] = 'autoDeclineMode'
24
+ @_hash['decline_message'] = 'declineMessage'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ auto_decline_mode
32
+ decline_message
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(auto_decline_mode: SKIP, decline_message: SKIP,
42
+ additional_properties: nil)
43
+ # Add additional model properties to the instance
44
+ additional_properties = {} if additional_properties.nil?
45
+
46
+ @auto_decline_mode = auto_decline_mode unless auto_decline_mode == SKIP
47
+ @decline_message = decline_message unless decline_message == SKIP
48
+ @additional_properties = additional_properties
49
+ end
50
+
51
+ # Creates an instance of the object from a hash.
52
+ def self.from_hash(hash)
53
+ return nil unless hash
54
+
55
+ # Extract variables from the hash.
56
+ auto_decline_mode =
57
+ hash.key?('autoDeclineMode') ? hash['autoDeclineMode'] : SKIP
58
+ decline_message =
59
+ hash.key?('declineMessage') ? hash['declineMessage'] : SKIP
60
+
61
+ # Create a new hash for additional properties, removing known properties.
62
+ new_hash = hash.reject { |k, _| names.value?(k) }
63
+
64
+ additional_properties = APIHelper.get_additional_properties(
65
+ new_hash, proc { |value| value }
66
+ )
67
+
68
+ # Create object from extracted values.
69
+ OutOfOfficeProperties.new(auto_decline_mode: auto_decline_mode,
70
+ decline_message: decline_message,
71
+ additional_properties: additional_properties)
72
+ end
73
+
74
+ # Provides a human-readable string representation of the object.
75
+ def to_s
76
+ class_name = self.class.name.split('::').last
77
+ "<#{class_name} auto_decline_mode: #{@auto_decline_mode}, decline_message:"\
78
+ " #{@decline_message}, additional_properties: #{@additional_properties}>"
79
+ end
80
+
81
+ # Provides a debugging-friendly string with detailed object information.
82
+ def inspect
83
+ class_name = self.class.name.split('::').last
84
+ "<#{class_name} auto_decline_mode: #{@auto_decline_mode.inspect}, decline_message:"\
85
+ " #{@decline_message.inspect}, additional_properties: #{@additional_properties}>"
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,106 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # Identifies a person associated with the event, such as the creator or
8
+ # organizer.
9
+ class Person < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # The person's Profile ID.
14
+ # @return [String]
15
+ attr_accessor :id
16
+
17
+ # The person's email address.
18
+ # @return [String]
19
+ attr_accessor :email
20
+
21
+ # The person's name.
22
+ # @return [String]
23
+ attr_accessor :display_name
24
+
25
+ # Whether this person corresponds to the calendar owner.
26
+ # @return [TrueClass | FalseClass]
27
+ attr_accessor :mself
28
+
29
+ # A mapping from model property names to API property names.
30
+ def self.names
31
+ @_hash = {} if @_hash.nil?
32
+ @_hash['id'] = 'id'
33
+ @_hash['email'] = 'email'
34
+ @_hash['display_name'] = 'displayName'
35
+ @_hash['mself'] = 'self'
36
+ @_hash
37
+ end
38
+
39
+ # An array for optional fields
40
+ def self.optionals
41
+ %w[
42
+ id
43
+ email
44
+ display_name
45
+ mself
46
+ ]
47
+ end
48
+
49
+ # An array for nullable fields
50
+ def self.nullables
51
+ []
52
+ end
53
+
54
+ def initialize(id: SKIP, email: SKIP, display_name: SKIP, mself: SKIP,
55
+ additional_properties: nil)
56
+ # Add additional model properties to the instance
57
+ additional_properties = {} if additional_properties.nil?
58
+
59
+ @id = id unless id == SKIP
60
+ @email = email unless email == SKIP
61
+ @display_name = display_name unless display_name == SKIP
62
+ @mself = mself unless mself == SKIP
63
+ @additional_properties = additional_properties
64
+ end
65
+
66
+ # Creates an instance of the object from a hash.
67
+ def self.from_hash(hash)
68
+ return nil unless hash
69
+
70
+ # Extract variables from the hash.
71
+ id = hash.key?('id') ? hash['id'] : SKIP
72
+ email = hash.key?('email') ? hash['email'] : SKIP
73
+ display_name = hash.key?('displayName') ? hash['displayName'] : SKIP
74
+ mself = hash.key?('self') ? hash['self'] : SKIP
75
+
76
+ # Create a new hash for additional properties, removing known properties.
77
+ new_hash = hash.reject { |k, _| names.value?(k) }
78
+
79
+ additional_properties = APIHelper.get_additional_properties(
80
+ new_hash, proc { |value| value }
81
+ )
82
+
83
+ # Create object from extracted values.
84
+ Person.new(id: id,
85
+ email: email,
86
+ display_name: display_name,
87
+ mself: mself,
88
+ additional_properties: additional_properties)
89
+ end
90
+
91
+ # Provides a human-readable string representation of the object.
92
+ def to_s
93
+ class_name = self.class.name.split('::').last
94
+ "<#{class_name} id: #{@id}, email: #{@email}, display_name: #{@display_name}, mself:"\
95
+ " #{@mself}, additional_properties: #{@additional_properties}>"
96
+ end
97
+
98
+ # Provides a debugging-friendly string with detailed object information.
99
+ def inspect
100
+ class_name = self.class.name.split('::').last
101
+ "<#{class_name} id: #{@id.inspect}, email: #{@email.inspect}, display_name:"\
102
+ " #{@display_name.inspect}, mself: #{@mself.inspect}, additional_properties:"\
103
+ " #{@additional_properties}>"
104
+ end
105
+ end
106
+ end