Class: CalendarApi::Attendee

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

Overview

An attendee of an event.

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(id: SKIP, email: SKIP, display_name: SKIP, organizer: SKIP, mself: SKIP, resource: SKIP, optional: false, response_status: SKIP, comment: SKIP, additional_guests: 0, additional_properties: nil) ⇒ Attendee

Returns a new instance of Attendee.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/calendar_api/models/attendee.rb', line 90

def initialize(id: SKIP, email: SKIP, display_name: SKIP, organizer: SKIP,
               mself: SKIP, resource: SKIP, optional: false,
               response_status: SKIP, comment: SKIP, additional_guests: 0,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id unless id == SKIP
  @email = email unless email == SKIP
  @display_name = display_name unless display_name == SKIP
  @organizer = organizer unless organizer == SKIP
  @mself = mself unless mself == SKIP
  @resource = resource unless resource == SKIP
  @optional = optional unless optional == SKIP
  @response_status = response_status unless response_status == SKIP
  @comment = comment unless comment == SKIP
  @additional_guests = additional_guests unless additional_guests == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#additional_guestsInteger

Number of additional guests the attendee is bringing.

Returns:

  • (Integer)


51
52
53
# File 'lib/calendar_api/models/attendee.rb', line 51

def additional_guests
  @additional_guests
end

#commentString

The attendee’s response comment.

Returns:

  • (String)


47
48
49
# File 'lib/calendar_api/models/attendee.rb', line 47

def comment
  @comment
end

#display_nameString

The attendee’s name.

Returns:

  • (String)


22
23
24
# File 'lib/calendar_api/models/attendee.rb', line 22

def display_name
  @display_name
end

#emailString

The attendee’s email address. Required when adding an attendee.

Returns:

  • (String)


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

def email
  @email
end

#idString

The attendee’s Profile ID.

Returns:

  • (String)


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

def id
  @id
end

#mselfTrueClass | FalseClass

Whether this entry represents the calendar on which this copy of the event appears.

Returns:

  • (TrueClass | FalseClass)


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

def mself
  @mself
end

#optionalTrueClass | FalseClass

Whether this is an optional attendee.

Returns:

  • (TrueClass | FalseClass)


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

def optional
  @optional
end

#organizerTrueClass | FalseClass

Whether the attendee is the organizer of the event.

Returns:

  • (TrueClass | FalseClass)


26
27
28
# File 'lib/calendar_api/models/attendee.rb', line 26

def organizer
  @organizer
end

#resourceTrueClass | FalseClass

Whether the attendee is a resource (e.g. a room).

Returns:

  • (TrueClass | FalseClass)


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

def resource
  @resource
end

#response_statusResponseStatus

The attendee’s response status.

Returns:



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

def response_status
  @response_status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/calendar_api/models/attendee.rb', line 111

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  email = hash.key?('email') ? hash['email'] : SKIP
  display_name = hash.key?('displayName') ? hash['displayName'] : SKIP
  organizer = hash.key?('organizer') ? hash['organizer'] : SKIP
  mself = hash.key?('self') ? hash['self'] : SKIP
  resource = hash.key?('resource') ? hash['resource'] : SKIP
  optional = hash['optional'] ||= false
  response_status =
    hash.key?('responseStatus') ? hash['responseStatus'] : SKIP
  comment = hash.key?('comment') ? hash['comment'] : SKIP
  additional_guests = hash['additionalGuests'] ||= 0

  # 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.
  Attendee.new(id: id,
               email: email,
               display_name: display_name,
               organizer: organizer,
               mself: mself,
               resource: resource,
               optional: optional,
               response_status: response_status,
               comment: comment,
               additional_guests: additional_guests,
               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/calendar_api/models/attendee.rb', line 54

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['email'] = 'email'
  @_hash['display_name'] = 'displayName'
  @_hash['organizer'] = 'organizer'
  @_hash['mself'] = 'self'
  @_hash['resource'] = 'resource'
  @_hash['optional'] = 'optional'
  @_hash['response_status'] = 'responseStatus'
  @_hash['comment'] = 'comment'
  @_hash['additional_guests'] = 'additionalGuests'
  @_hash
end

.nullablesObject

An array for nullable fields



86
87
88
# File 'lib/calendar_api/models/attendee.rb', line 86

def self.nullables
  []
end

.optionalsObject

An array for optional fields



70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/calendar_api/models/attendee.rb', line 70

def self.optionals
  %w[
    id
    email
    display_name
    organizer
    mself
    resource
    optional
    response_status
    comment
    additional_guests
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



158
159
160
161
162
163
164
165
# File 'lib/calendar_api/models/attendee.rb', line 158

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, email: #{@email.inspect}, display_name:"\
  " #{@display_name.inspect}, organizer: #{@organizer.inspect}, mself: #{@mself.inspect},"\
  " resource: #{@resource.inspect}, optional: #{@optional.inspect}, response_status:"\
  " #{@response_status.inspect}, comment: #{@comment.inspect}, additional_guests:"\
  " #{@additional_guests.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



149
150
151
152
153
154
155
# File 'lib/calendar_api/models/attendee.rb', line 149

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, email: #{@email}, display_name: #{@display_name}, organizer:"\
  " #{@organizer}, mself: #{@mself}, resource: #{@resource}, optional: #{@optional},"\
  " response_status: #{@response_status}, comment: #{@comment}, additional_guests:"\
  " #{@additional_guests}, additional_properties: #{@additional_properties}>"
end