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,83 @@
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 reminder for an event.
8
+ class Reminder < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The method used by a reminder.
13
+ # @return [ReminderMethod]
14
+ attr_accessor :method
15
+
16
+ # Number of minutes before the start of the event when the reminder should
17
+ # trigger. Valid values are between 0 and 40320 (4 weeks).
18
+ # @return [Integer]
19
+ attr_accessor :minutes
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['method'] = 'method'
25
+ @_hash['minutes'] = 'minutes'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def self.optionals
31
+ []
32
+ end
33
+
34
+ # An array for nullable fields
35
+ def self.nullables
36
+ []
37
+ end
38
+
39
+ def initialize(method:, minutes:, additional_properties: nil)
40
+ # Add additional model properties to the instance
41
+ additional_properties = {} if additional_properties.nil?
42
+
43
+ @method = method
44
+ @minutes = minutes
45
+ @additional_properties = additional_properties
46
+ end
47
+
48
+ # Creates an instance of the object from a hash.
49
+ def self.from_hash(hash)
50
+ return nil unless hash
51
+
52
+ # Extract variables from the hash.
53
+ method = hash.key?('method') ? hash['method'] : nil
54
+ minutes = hash.key?('minutes') ? hash['minutes'] : nil
55
+
56
+ # Create a new hash for additional properties, removing known properties.
57
+ new_hash = hash.reject { |k, _| names.value?(k) }
58
+
59
+ additional_properties = APIHelper.get_additional_properties(
60
+ new_hash, proc { |value| value }
61
+ )
62
+
63
+ # Create object from extracted values.
64
+ Reminder.new(method: method,
65
+ minutes: minutes,
66
+ additional_properties: additional_properties)
67
+ end
68
+
69
+ # Provides a human-readable string representation of the object.
70
+ def to_s
71
+ class_name = self.class.name.split('::').last
72
+ "<#{class_name} method: #{@method}, minutes: #{@minutes}, additional_properties:"\
73
+ " #{@additional_properties}>"
74
+ end
75
+
76
+ # Provides a debugging-friendly string with detailed object information.
77
+ def inspect
78
+ class_name = self.class.name.split('::').last
79
+ "<#{class_name} method: #{@method.inspect}, minutes: #{@minutes.inspect},"\
80
+ " additional_properties: #{@additional_properties}>"
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,36 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # The method used by a reminder.
8
+ class ReminderMethod
9
+ REMINDER_METHOD = [
10
+ # TODO: Write general description for EMAIL
11
+ EMAIL = 'email'.freeze,
12
+
13
+ # TODO: Write general description for POPUP
14
+ POPUP = 'popup'.freeze
15
+ ].freeze
16
+
17
+ def self.validate(value)
18
+ return false if value.nil?
19
+
20
+ REMINDER_METHOD.include?(value)
21
+ end
22
+
23
+ def self.from_value(value, default_value = EMAIL)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'email' then EMAIL
30
+ when 'popup' then POPUP
31
+ else
32
+ default_value
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,44 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # The attendee's response status.
8
+ class ResponseStatus
9
+ RESPONSE_STATUS = [
10
+ # TODO: Write general description for NEEDSACTION
11
+ NEEDSACTION = 'needsAction'.freeze,
12
+
13
+ # TODO: Write general description for DECLINED
14
+ DECLINED = 'declined'.freeze,
15
+
16
+ # TODO: Write general description for TENTATIVE
17
+ TENTATIVE = 'tentative'.freeze,
18
+
19
+ # TODO: Write general description for ACCEPTED
20
+ ACCEPTED = 'accepted'.freeze
21
+ ].freeze
22
+
23
+ def self.validate(value)
24
+ return false if value.nil?
25
+
26
+ RESPONSE_STATUS.include?(value)
27
+ end
28
+
29
+ def self.from_value(value, default_value = NEEDSACTION)
30
+ return default_value if value.nil?
31
+
32
+ str = value.to_s.strip
33
+
34
+ case str.downcase
35
+ when 'needsaction' then NEEDSACTION
36
+ when 'declined' then DECLINED
37
+ when 'tentative' then TENTATIVE
38
+ when 'accepted' then ACCEPTED
39
+ else
40
+ default_value
41
+ end
42
+ end
43
+ end
44
+ 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
+ # Specifies which attendees receive notifications about event changes.
8
+ class SendUpdates
9
+ SEND_UPDATES = [
10
+ # TODO: Write general description for ALL
11
+ ALL = 'all'.freeze,
12
+
13
+ # TODO: Write general description for EXTERNALONLY
14
+ EXTERNALONLY = 'externalOnly'.freeze,
15
+
16
+ # TODO: Write general description for NONE
17
+ NONE = 'none'.freeze
18
+ ].freeze
19
+
20
+ def self.validate(value)
21
+ return false if value.nil?
22
+
23
+ SEND_UPDATES.include?(value)
24
+ end
25
+
26
+ def self.from_value(value, default_value = ALL)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'all' then ALL
33
+ when 'externalonly' then EXTERNALONLY
34
+ when 'none' then NONE
35
+ else
36
+ default_value
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,85 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # Request body to stop a push notification channel. Requires the channel ID
8
+ # and resourceId returned from a previous watchEvents call.
9
+ class StopChannelRequest < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # The UUID or unique string that identifies the channel, as provided when
14
+ # the channel was created.
15
+ # @return [String]
16
+ attr_accessor :id
17
+
18
+ # An opaque ID that identifies the resource being watched on this channel.
19
+ # Returned in the watchEvents response.
20
+ # @return [String]
21
+ attr_accessor :resource_id
22
+
23
+ # A mapping from model property names to API property names.
24
+ def self.names
25
+ @_hash = {} if @_hash.nil?
26
+ @_hash['id'] = 'id'
27
+ @_hash['resource_id'] = 'resourceId'
28
+ @_hash
29
+ end
30
+
31
+ # An array for optional fields
32
+ def self.optionals
33
+ []
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(id:, resource_id:, additional_properties: nil)
42
+ # Add additional model properties to the instance
43
+ additional_properties = {} if additional_properties.nil?
44
+
45
+ @id = id
46
+ @resource_id = resource_id
47
+ @additional_properties = additional_properties
48
+ end
49
+
50
+ # Creates an instance of the object from a hash.
51
+ def self.from_hash(hash)
52
+ return nil unless hash
53
+
54
+ # Extract variables from the hash.
55
+ id = hash.key?('id') ? hash['id'] : nil
56
+ resource_id = hash.key?('resourceId') ? hash['resourceId'] : nil
57
+
58
+ # Create a new hash for additional properties, removing known properties.
59
+ new_hash = hash.reject { |k, _| names.value?(k) }
60
+
61
+ additional_properties = APIHelper.get_additional_properties(
62
+ new_hash, proc { |value| value }
63
+ )
64
+
65
+ # Create object from extracted values.
66
+ StopChannelRequest.new(id: id,
67
+ resource_id: resource_id,
68
+ additional_properties: additional_properties)
69
+ end
70
+
71
+ # Provides a human-readable string representation of the object.
72
+ def to_s
73
+ class_name = self.class.name.split('::').last
74
+ "<#{class_name} id: #{@id}, resource_id: #{@resource_id}, additional_properties:"\
75
+ " #{@additional_properties}>"
76
+ end
77
+
78
+ # Provides a debugging-friendly string with detailed object information.
79
+ def inspect
80
+ class_name = self.class.name.split('::').last
81
+ "<#{class_name} id: #{@id.inspect}, resource_id: #{@resource_id.inspect},"\
82
+ " additional_properties: #{@additional_properties}>"
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,102 @@
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 time range representing a busy period.
9
+ class TimePeriod < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # The start of the busy time period (inclusive).
14
+ # @return [DateTime]
15
+ attr_accessor :start
16
+
17
+ # The end of the busy time period (exclusive).
18
+ # @return [DateTime]
19
+ attr_accessor :mend
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['start'] = 'start'
25
+ @_hash['mend'] = 'end'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def self.optionals
31
+ %w[
32
+ start
33
+ mend
34
+ ]
35
+ end
36
+
37
+ # An array for nullable fields
38
+ def self.nullables
39
+ []
40
+ end
41
+
42
+ def initialize(start: SKIP, mend: SKIP, additional_properties: nil)
43
+ # Add additional model properties to the instance
44
+ additional_properties = {} if additional_properties.nil?
45
+
46
+ @start = start unless start == SKIP
47
+ @mend = mend unless mend == 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
+ start = if hash.key?('start')
57
+ (DateTimeHelper.from_rfc3339(hash['start']) if hash['start'])
58
+ else
59
+ SKIP
60
+ end
61
+ mend = if hash.key?('end')
62
+ (DateTimeHelper.from_rfc3339(hash['end']) if hash['end'])
63
+ else
64
+ SKIP
65
+ end
66
+
67
+ # Create a new hash for additional properties, removing known properties.
68
+ new_hash = hash.reject { |k, _| names.value?(k) }
69
+
70
+ additional_properties = APIHelper.get_additional_properties(
71
+ new_hash, proc { |value| value }
72
+ )
73
+
74
+ # Create object from extracted values.
75
+ TimePeriod.new(start: start,
76
+ mend: mend,
77
+ additional_properties: additional_properties)
78
+ end
79
+
80
+ def to_custom_start
81
+ DateTimeHelper.to_rfc3339(start)
82
+ end
83
+
84
+ def to_custom_mend
85
+ DateTimeHelper.to_rfc3339(mend)
86
+ end
87
+
88
+ # Provides a human-readable string representation of the object.
89
+ def to_s
90
+ class_name = self.class.name.split('::').last
91
+ "<#{class_name} start: #{@start}, mend: #{@mend}, additional_properties:"\
92
+ " #{@additional_properties}>"
93
+ end
94
+
95
+ # Provides a debugging-friendly string with detailed object information.
96
+ def inspect
97
+ class_name = self.class.name.split('::').last
98
+ "<#{class_name} start: #{@start.inspect}, mend: #{@mend.inspect}, additional_properties:"\
99
+ " #{@additional_properties}>"
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,113 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # Request body to set up a push notification channel.
8
+ class WatchRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A UUID or similar unique string that identifies this channel.
13
+ # @return [String]
14
+ attr_accessor :id
15
+
16
+ # An arbitrary string delivered to the target address with each
17
+ # notification. Optional.
18
+ # @return [String]
19
+ attr_accessor :token
20
+
21
+ # The type of delivery mechanism used for the notification channel.
22
+ # @return [ChannelType]
23
+ attr_accessor :type
24
+
25
+ # The address where notifications are delivered for this channel. Must be
26
+ # HTTPS.
27
+ # @return [String]
28
+ attr_accessor :address
29
+
30
+ # Additional parameters controlling delivery channel behavior.
31
+ # @return [ChannelParams]
32
+ attr_accessor :params
33
+
34
+ # A mapping from model property names to API property names.
35
+ def self.names
36
+ @_hash = {} if @_hash.nil?
37
+ @_hash['id'] = 'id'
38
+ @_hash['token'] = 'token'
39
+ @_hash['type'] = 'type'
40
+ @_hash['address'] = 'address'
41
+ @_hash['params'] = 'params'
42
+ @_hash
43
+ end
44
+
45
+ # An array for optional fields
46
+ def self.optionals
47
+ %w[
48
+ token
49
+ params
50
+ ]
51
+ end
52
+
53
+ # An array for nullable fields
54
+ def self.nullables
55
+ []
56
+ end
57
+
58
+ def initialize(id:, type:, address:, token: SKIP, params: SKIP,
59
+ additional_properties: nil)
60
+ # Add additional model properties to the instance
61
+ additional_properties = {} if additional_properties.nil?
62
+
63
+ @id = id
64
+ @token = token unless token == SKIP
65
+ @type = type
66
+ @address = address
67
+ @params = params unless params == SKIP
68
+ @additional_properties = additional_properties
69
+ end
70
+
71
+ # Creates an instance of the object from a hash.
72
+ def self.from_hash(hash)
73
+ return nil unless hash
74
+
75
+ # Extract variables from the hash.
76
+ id = hash.key?('id') ? hash['id'] : nil
77
+ type = hash.key?('type') ? hash['type'] : nil
78
+ address = hash.key?('address') ? hash['address'] : nil
79
+ token = hash.key?('token') ? hash['token'] : SKIP
80
+ params = ChannelParams.from_hash(hash['params']) if hash['params']
81
+
82
+ # Create a new hash for additional properties, removing known properties.
83
+ new_hash = hash.reject { |k, _| names.value?(k) }
84
+
85
+ additional_properties = APIHelper.get_additional_properties(
86
+ new_hash, proc { |value| value }
87
+ )
88
+
89
+ # Create object from extracted values.
90
+ WatchRequest.new(id: id,
91
+ type: type,
92
+ address: address,
93
+ token: token,
94
+ params: params,
95
+ additional_properties: additional_properties)
96
+ end
97
+
98
+ # Provides a human-readable string representation of the object.
99
+ def to_s
100
+ class_name = self.class.name.split('::').last
101
+ "<#{class_name} id: #{@id}, token: #{@token}, type: #{@type}, address: #{@address}, params:"\
102
+ " #{@params}, additional_properties: #{@additional_properties}>"
103
+ end
104
+
105
+ # Provides a debugging-friendly string with detailed object information.
106
+ def inspect
107
+ class_name = self.class.name.split('::').last
108
+ "<#{class_name} id: #{@id.inspect}, token: #{@token.inspect}, type: #{@type.inspect},"\
109
+ " address: #{@address.inspect}, params: #{@params.inspect}, additional_properties:"\
110
+ " #{@additional_properties}>"
111
+ end
112
+ end
113
+ 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
+ module CalendarApi
7
+ # Working location event data. Used if eventType is workingLocation.
8
+ class WorkingLocationProperties < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Type of working location.
13
+ # @return [WorkingLocationType]
14
+ attr_accessor :type
15
+
16
+ # Indicates working from home. Present if type is homeOffice. Value is
17
+ # always an empty object.
18
+ # @return [Object]
19
+ attr_accessor :home_office
20
+
21
+ # Office location details for a working location event.
22
+ # @return [OfficeLocation]
23
+ attr_accessor :office_location
24
+
25
+ # Custom location details for a working location event.
26
+ # @return [CustomLocation]
27
+ attr_accessor :custom_location
28
+
29
+ # A mapping from model property names to API property names.
30
+ def self.names
31
+ @_hash = {} if @_hash.nil?
32
+ @_hash['type'] = 'type'
33
+ @_hash['home_office'] = 'homeOffice'
34
+ @_hash['office_location'] = 'officeLocation'
35
+ @_hash['custom_location'] = 'customLocation'
36
+ @_hash
37
+ end
38
+
39
+ # An array for optional fields
40
+ def self.optionals
41
+ %w[
42
+ type
43
+ home_office
44
+ office_location
45
+ custom_location
46
+ ]
47
+ end
48
+
49
+ # An array for nullable fields
50
+ def self.nullables
51
+ []
52
+ end
53
+
54
+ def initialize(type: SKIP, home_office: SKIP, office_location: SKIP,
55
+ custom_location: SKIP, additional_properties: nil)
56
+ # Add additional model properties to the instance
57
+ additional_properties = {} if additional_properties.nil?
58
+
59
+ @type = type unless type == SKIP
60
+ @home_office = home_office unless home_office == SKIP
61
+ @office_location = office_location unless office_location == SKIP
62
+ @custom_location = custom_location unless custom_location == 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
+ type = hash.key?('type') ? hash['type'] : SKIP
72
+ home_office = hash.key?('homeOffice') ? hash['homeOffice'] : SKIP
73
+ office_location = OfficeLocation.from_hash(hash['officeLocation']) if hash['officeLocation']
74
+ custom_location = CustomLocation.from_hash(hash['customLocation']) if hash['customLocation']
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
+ WorkingLocationProperties.new(type: type,
85
+ home_office: home_office,
86
+ office_location: office_location,
87
+ custom_location: custom_location,
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} type: #{@type}, home_office: #{@home_office}, office_location:"\
95
+ " #{@office_location}, custom_location: #{@custom_location}, additional_properties:"\
96
+ " #{@additional_properties}>"
97
+ end
98
+
99
+ # Provides a debugging-friendly string with detailed object information.
100
+ def inspect
101
+ class_name = self.class.name.split('::').last
102
+ "<#{class_name} type: #{@type.inspect}, home_office: #{@home_office.inspect},"\
103
+ " office_location: #{@office_location.inspect}, custom_location:"\
104
+ " #{@custom_location.inspect}, additional_properties: #{@additional_properties}>"
105
+ end
106
+ end
107
+ 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
+ # Type of working location.
8
+ class WorkingLocationType
9
+ WORKING_LOCATION_TYPE = [
10
+ # TODO: Write general description for HOMEOFFICE
11
+ HOMEOFFICE = 'homeOffice'.freeze,
12
+
13
+ # TODO: Write general description for OFFICELOCATION
14
+ OFFICELOCATION = 'officeLocation'.freeze,
15
+
16
+ # TODO: Write general description for CUSTOMLOCATION
17
+ CUSTOMLOCATION = 'customLocation'.freeze
18
+ ].freeze
19
+
20
+ def self.validate(value)
21
+ return false if value.nil?
22
+
23
+ WORKING_LOCATION_TYPE.include?(value)
24
+ end
25
+
26
+ def self.from_value(value, default_value = HOMEOFFICE)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'homeoffice' then HOMEOFFICE
33
+ when 'officelocation' then OFFICELOCATION
34
+ when 'customlocation' then CUSTOMLOCATION
35
+ else
36
+ default_value
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,11 @@
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 utility that supports dateTime conversion to different formats
9
+ class DateTimeHelper < CoreLibrary::DateTimeHelper
10
+ end
11
+ end
@@ -0,0 +1,28 @@
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 utility to allow users to set the content-type for files
8
+ class FileWrapper < CoreLibrary::FileWrapper
9
+ # The constructor.
10
+ # @param [File] file The file to be sent in the request.
11
+ # @param [string] content_type The content type of the provided file.
12
+ def initialize(file, content_type: 'application/octet-stream')
13
+ super
14
+ end
15
+
16
+ # Provides a human-readable string representation of the object.
17
+ def to_s
18
+ class_name = self.class.name.split('::').last
19
+ "<#{class_name} file: #{@file}, content_type: #{@content_type}>"
20
+ end
21
+
22
+ # Provides a debugging-friendly string with detailed object information.
23
+ def to_inspect
24
+ class_name = self.class.name.split('::').last
25
+ "<#{class_name} file: #{@file.inspect}, content_type: #{@content_type.inspect}>"
26
+ end
27
+ end
28
+ end