Class: CalendarApi::CalendarListEntry

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/calendar_api/models/calendar_list_entry.rb

Overview

An entry on the user’s calendar list.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(kind: 'calendar#calendarListEntry', etag: SKIP, id: SKIP, summary: SKIP, description: SKIP, location: SKIP, time_zone: SKIP, summary_override: SKIP, color_id: SKIP, background_color: SKIP, foreground_color: SKIP, hidden: false, selected: false, access_role: SKIP, default_reminders: SKIP, notification_settings: SKIP, primary: SKIP, deleted: false, conference_properties: SKIP, additional_properties: nil) ⇒ CalendarListEntry

Returns a new instance of CalendarListEntry.



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 146

def initialize(kind: 'calendar#calendarListEntry', etag: SKIP, id: SKIP,
               summary: SKIP, description: SKIP, location: SKIP,
               time_zone: SKIP, summary_override: SKIP, color_id: SKIP,
               background_color: SKIP, foreground_color: SKIP,
               hidden: false, selected: false, access_role: SKIP,
               default_reminders: SKIP, notification_settings: SKIP,
               primary: SKIP, deleted: false, conference_properties: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @kind = kind unless kind == SKIP
  @etag = etag unless etag == SKIP
  @id = id unless id == SKIP
  @summary = summary unless summary == SKIP
  @description = description unless description == SKIP
  @location = location unless location == SKIP
  @time_zone = time_zone unless time_zone == SKIP
  @summary_override = summary_override unless summary_override == SKIP
  @color_id = color_id unless color_id == SKIP
  @background_color = background_color unless background_color == SKIP
  @foreground_color = foreground_color unless foreground_color == SKIP
  @hidden = hidden unless hidden == SKIP
  @selected = selected unless selected == SKIP
  @access_role = access_role unless access_role == SKIP
  @default_reminders = default_reminders unless default_reminders == SKIP
  @notification_settings = notification_settings unless notification_settings == SKIP
  @primary = primary unless primary == SKIP
  @deleted = deleted unless deleted == SKIP
  @conference_properties = conference_properties unless conference_properties == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#access_roleCalendarAccessRole

The user’s access role for a calendar.

Returns:



69
70
71
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 69

def access_role
  @access_role
end

#background_colorString

The main color of the calendar in hexadecimal format (e.g. “#0088aa”).

Returns:

  • (String)


52
53
54
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 52

def background_color
  @background_color
end

#color_idString

The color of the calendar. References an entry in the calendar section of the colors definition.

Returns:

  • (String)


48
49
50
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 48

def color_id
  @color_id
end

#conference_propertiesCalendarListEntryConferenceProperties

Conference properties for this calendar.



89
90
91
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 89

def conference_properties
  @conference_properties
end

#default_remindersArray[Reminder]

The default reminders that the authenticated user has for this calendar.

Returns:



73
74
75
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 73

def default_reminders
  @default_reminders
end

#deletedTrueClass | FalseClass

Whether the calendar list entry has been removed from the list.

Returns:

  • (TrueClass | FalseClass)


85
86
87
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 85

def deleted
  @deleted
end

#descriptionString

Description of the calendar.

Returns:

  • (String)


31
32
33
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 31

def description
  @description
end

#etagString

ETag of the resource.

Returns:

  • (String)


18
19
20
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 18

def etag
  @etag
end

#foreground_colorString

The foreground color of the calendar in hexadecimal format (e.g. “#ffffff”).

Returns:

  • (String)


57
58
59
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 57

def foreground_color
  @foreground_color
end

#hiddenTrueClass | FalseClass

Whether the calendar has been hidden from the list.

Returns:

  • (TrueClass | FalseClass)


61
62
63
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 61

def hidden
  @hidden
end

#idString

Identifier of the calendar. Use this value as the calendarId path parameter in event operations.

Returns:

  • (String)


23
24
25
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 23

def id
  @id
end

#kindString

Type of the resource.

Returns:

  • (String)


14
15
16
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 14

def kind
  @kind
end

#locationString

Geographic location of the calendar as free-form text.

Returns:

  • (String)


35
36
37
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 35

def location
  @location
end

#notification_settingsCalendarListEntryNotificationSettings

The notifications the authenticated user receives for this calendar.



77
78
79
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 77

def notification_settings
  @notification_settings
end

#primaryTrueClass | FalseClass

Whether the calendar is the primary calendar of the authenticated user.

Returns:

  • (TrueClass | FalseClass)


81
82
83
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 81

def primary
  @primary
end

#selectedTrueClass | FalseClass

Whether the calendar content shows up in the calendar UI.

Returns:

  • (TrueClass | FalseClass)


65
66
67
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 65

def selected
  @selected
end

#summaryString

Title of the calendar.

Returns:

  • (String)


27
28
29
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 27

def summary
  @summary
end

#summary_overrideString

The summary that the authenticated user has set for this calendar.

Returns:

  • (String)


43
44
45
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 43

def summary_override
  @summary_override
end

#time_zoneString

The time zone of the calendar.

Returns:

  • (String)


39
40
41
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 39

def time_zone
  @time_zone
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 180

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  kind = hash['kind'] ||= 'calendar#calendarListEntry'
  etag = hash.key?('etag') ? hash['etag'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  summary = hash.key?('summary') ? hash['summary'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  location = hash.key?('location') ? hash['location'] : SKIP
  time_zone = hash.key?('timeZone') ? hash['timeZone'] : SKIP
  summary_override =
    hash.key?('summaryOverride') ? hash['summaryOverride'] : SKIP
  color_id = hash.key?('colorId') ? hash['colorId'] : SKIP
  background_color =
    hash.key?('backgroundColor') ? hash['backgroundColor'] : SKIP
  foreground_color =
    hash.key?('foregroundColor') ? hash['foregroundColor'] : SKIP
  hidden = hash['hidden'] ||= false
  selected = hash['selected'] ||= false
  access_role = hash.key?('accessRole') ? hash['accessRole'] : SKIP
  # Parameter is an array, so we need to iterate through it
  default_reminders = nil
  unless hash['defaultReminders'].nil?
    default_reminders = []
    hash['defaultReminders'].each do |structure|
      default_reminders << (Reminder.from_hash(structure) if structure)
    end
  end

  default_reminders = SKIP unless hash.key?('defaultReminders')
  if hash['notificationSettings']
    notification_settings = CalendarListEntryNotificationSettings.from_hash(hash['notificationSettings'])
  end
  primary = hash.key?('primary') ? hash['primary'] : SKIP
  deleted = hash['deleted'] ||= false
  if hash['conferenceProperties']
    conference_properties = CalendarListEntryConferenceProperties.from_hash(hash['conferenceProperties'])
  end

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  CalendarListEntry.new(kind: kind,
                        etag: etag,
                        id: id,
                        summary: summary,
                        description: description,
                        location: location,
                        time_zone: time_zone,
                        summary_override: summary_override,
                        color_id: color_id,
                        background_color: background_color,
                        foreground_color: foreground_color,
                        hidden: hidden,
                        selected: selected,
                        access_role: access_role,
                        default_reminders: default_reminders,
                        notification_settings: notification_settings,
                        primary: primary,
                        deleted: deleted,
                        conference_properties: conference_properties,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 92

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['kind'] = 'kind'
  @_hash['etag'] = 'etag'
  @_hash['id'] = 'id'
  @_hash['summary'] = 'summary'
  @_hash['description'] = 'description'
  @_hash['location'] = 'location'
  @_hash['time_zone'] = 'timeZone'
  @_hash['summary_override'] = 'summaryOverride'
  @_hash['color_id'] = 'colorId'
  @_hash['background_color'] = 'backgroundColor'
  @_hash['foreground_color'] = 'foregroundColor'
  @_hash['hidden'] = 'hidden'
  @_hash['selected'] = 'selected'
  @_hash['access_role'] = 'accessRole'
  @_hash['default_reminders'] = 'defaultReminders'
  @_hash['notification_settings'] = 'notificationSettings'
  @_hash['primary'] = 'primary'
  @_hash['deleted'] = 'deleted'
  @_hash['conference_properties'] = 'conferenceProperties'
  @_hash
end

.nullablesObject

An array for nullable fields



142
143
144
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 142

def self.nullables
  []
end

.optionalsObject

An array for optional fields



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 117

def self.optionals
  %w[
    kind
    etag
    id
    summary
    description
    location
    time_zone
    summary_override
    color_id
    background_color
    foreground_color
    hidden
    selected
    access_role
    default_reminders
    notification_settings
    primary
    deleted
    conference_properties
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 264

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} kind: #{@kind.inspect}, etag: #{@etag.inspect}, id: #{@id.inspect},"\
  " summary: #{@summary.inspect}, description: #{@description.inspect}, location:"\
  " #{@location.inspect}, time_zone: #{@time_zone.inspect}, summary_override:"\
  " #{@summary_override.inspect}, color_id: #{@color_id.inspect}, background_color:"\
  " #{@background_color.inspect}, foreground_color: #{@foreground_color.inspect}, hidden:"\
  " #{@hidden.inspect}, selected: #{@selected.inspect}, access_role: #{@access_role.inspect},"\
  " default_reminders: #{@default_reminders.inspect}, notification_settings:"\
  " #{@notification_settings.inspect}, primary: #{@primary.inspect}, deleted:"\
  " #{@deleted.inspect}, conference_properties: #{@conference_properties.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



251
252
253
254
255
256
257
258
259
260
261
# File 'lib/calendar_api/models/calendar_list_entry.rb', line 251

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} kind: #{@kind}, etag: #{@etag}, id: #{@id}, summary: #{@summary},"\
  " description: #{@description}, location: #{@location}, time_zone: #{@time_zone},"\
  " summary_override: #{@summary_override}, color_id: #{@color_id}, background_color:"\
  " #{@background_color}, foreground_color: #{@foreground_color}, hidden: #{@hidden},"\
  " selected: #{@selected}, access_role: #{@access_role}, default_reminders:"\
  " #{@default_reminders}, notification_settings: #{@notification_settings}, primary:"\
  " #{@primary}, deleted: #{@deleted}, conference_properties: #{@conference_properties},"\
  " additional_properties: #{@additional_properties}>"
end