Class: Zm::Client::Appointment

Inherits:
Base::Object show all
Includes:
BelongsToFolder, BelongsToTag, MailboxItemConcern, RequestMethodsMailbox
Defined in:
lib/zm/client/appointment/appointment.rb

Overview

class for account appointment

Defined Under Namespace

Classes: Attendee, Attendees, Organizer

Instance Attribute Summary collapse

Attributes included from MailboxItemConcern

#l

Attributes inherited from Base::Object

#id, #parent, #token

Instance Method Summary collapse

Methods included from MailboxItemConcern

#id, #id=, #mailbox_id

Methods included from RequestMethodsMailbox

#build_delete, #delete!, #modify!

Methods included from BelongsToTag

#tags

Methods included from BelongsToFolder

#folder, #folder!, #folder=, #move!, #trash!

Methods inherited from Base::Object

#clone, #inspect, #instance_variables_map, #logger, #recorded?, #save!, #to_h, #to_s, #update_attribute

Constructor Details

#initialize(parent) {|_self| ... } ⇒ Appointment

Returns a new instance of Appointment.

Yields:

  • (_self)

Yield Parameters:



18
19
20
21
22
23
24
25
26
27
# File 'lib/zm/client/appointment/appointment.rb', line 18

def initialize(parent)
  @parent = parent
  @recipients = Recipients.new
  @body = BodyMail.new
  @attendees = Attendees.new
  @allDay = false
  @timezone = 'Europe/Berlin'

  yield(self) if block_given?
end

Instance Attribute Details

#allDayObject

Returns the value of attribute allDay.



12
13
14
# File 'lib/zm/client/appointment/appointment.rb', line 12

def allDay
  @allDay
end

#apptIdObject

Returns the value of attribute apptId.



12
13
14
# File 'lib/zm/client/appointment/appointment.rb', line 12

def apptId
  @apptId
end

#attendeesObject (readonly)

Returns the value of attribute attendees.



14
15
16
# File 'lib/zm/client/appointment/appointment.rb', line 14

def attendees
  @attendees
end

#bodyObject (readonly)

Returns the value of attribute body.



14
15
16
# File 'lib/zm/client/appointment/appointment.rb', line 14

def body
  @body
end

#calItemIdObject

Returns the value of attribute calItemId.



12
13
14
# File 'lib/zm/client/appointment/appointment.rb', line 12

def calItemId
  @calItemId
end

#descObject Also known as: description

Returns the value of attribute desc.



12
13
14
# File 'lib/zm/client/appointment/appointment.rb', line 12

def desc
  @desc
end

#durObject

Returns the value of attribute dur.



12
13
14
# File 'lib/zm/client/appointment/appointment.rb', line 12

def dur
  @dur
end

#end_atObject

Returns the value of attribute end_at.



12
13
14
# File 'lib/zm/client/appointment/appointment.rb', line 12

def end_at
  @end_at
end

#fbObject

Returns the value of attribute fb.



12
13
14
# File 'lib/zm/client/appointment/appointment.rb', line 12

def fb
  @fb
end

#invIdObject

Returns the value of attribute invId.



12
13
14
# File 'lib/zm/client/appointment/appointment.rb', line 12

def invId
  @invId
end

#nameObject

Returns the value of attribute name.



12
13
14
# File 'lib/zm/client/appointment/appointment.rb', line 12

def name
  @name
end

#organizerObject

Returns the value of attribute organizer.



12
13
14
# File 'lib/zm/client/appointment/appointment.rb', line 12

def organizer
  @organizer
end

#recipientsObject (readonly)

Returns the value of attribute recipients.



14
15
16
# File 'lib/zm/client/appointment/appointment.rb', line 14

def recipients
  @recipients
end

#revObject

Returns the value of attribute rev.



12
13
14
# File 'lib/zm/client/appointment/appointment.rb', line 12

def rev
  @rev
end

#start_atObject

Returns the value of attribute start_at.



12
13
14
# File 'lib/zm/client/appointment/appointment.rb', line 12

def start_at
  @start_at
end

#timezoneObject

Returns the value of attribute timezone.



12
13
14
# File 'lib/zm/client/appointment/appointment.rb', line 12

def timezone
  @timezone
end

#tnObject

Returns the value of attribute tn.



12
13
14
# File 'lib/zm/client/appointment/appointment.rb', line 12

def tn
  @tn
end

#transpObject

Returns the value of attribute transp.



12
13
14
# File 'lib/zm/client/appointment/appointment.rb', line 12

def transp
  @transp
end

#uidObject

Returns the value of attribute uid.



12
13
14
# File 'lib/zm/client/appointment/appointment.rb', line 12

def uid
  @uid
end

Instance Method Details

#build_createObject



43
44
45
46
# File 'lib/zm/client/appointment/appointment.rb', line 43

def build_create
  SoapElement.mail(SoapMailConstants::CREATE_APPOINTMENT_REQUEST)
             .add_attributes(jsns_builder.to_jsns)
end

#build_modifyObject



48
49
50
51
# File 'lib/zm/client/appointment/appointment.rb', line 48

def build_modify
  SoapElement.mail(SoapMailConstants::MODIFY_APPOINTMENT_REQUEST)
             .add_attributes(jsns_builder.to_update)
end

#build_rename(*args) ⇒ Object

Raises:

  • (NotImplementedError)


61
62
63
# File 'lib/zm/client/appointment/appointment.rb', line 61

def build_rename(*args)
  raise NotImplementedError
end

#busy!Object



83
84
85
86
# File 'lib/zm/client/appointment/appointment.rb', line 83

def busy!
  self.fb = 'B'
  self.transp = 'T'
end

#create!Object



34
35
36
37
38
39
40
41
# File 'lib/zm/client/appointment/appointment.rb', line 34

def create!
  rep = @parent.soap_connector.invoke(build_create)

  aji = AppointmentJsnsInitializer.new(@parent, rep[:CreateAppointmentResponse])
  aji.appointment = self
  aji.update
  id
end

#download(dest_file_path, fmt: 'ics') ⇒ Object



29
30
31
32
# File 'lib/zm/client/appointment/appointment.rb', line 29

def download(dest_file_path, fmt: 'ics')
  uploader = @parent.build_uploader
  uploader.download_file(dest_file_path, id, FolderView::APPOINTMENT, fmt:)
end

#free!Object



78
79
80
81
# File 'lib/zm/client/appointment/appointment.rb', line 78

def free!
  self.fb = 'F'
  self.transp = 'O'
end

#jsns_builderObject



150
151
152
153
154
# File 'lib/zm/client/appointment/appointment.rb', line 150

def jsns_builder
  return @jsns_builder if defined? @jsns_builder

  @jsns_builder = AppointmentJsnsBuilder.new(self)
end

#must_confirm!Object



88
89
90
91
# File 'lib/zm/client/appointment/appointment.rb', line 88

def must_confirm!
  self.fb = 'T'
  self.transp = 'T'
end

#out_of_office!Object



93
94
95
96
# File 'lib/zm/client/appointment/appointment.rb', line 93

def out_of_office!
  self.fb = 'O'
  self.transp = 'O'
end

#reload!Object



65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/zm/client/appointment/appointment.rb', line 65

def reload!
  jsns = { m: { id: id, html: SoapUtils::ON } }

  soap_request = SoapElement.mail(SoapMailConstants::GET_MSG_REQUEST)
                            .add_attributes(jsns)
  rep = @parent.soap_connector.invoke(soap_request)
  entry = rep[:GetMsgResponse][:m].first

  aji = AppointmentJsnsInitializer.new(@parent, entry)
  aji.appointment = self
  aji.create
end

#rename!(*args) ⇒ Object

Raises:

  • (NotImplementedError)


57
58
59
# File 'lib/zm/client/appointment/appointment.rb', line 57

def rename!(*args)
  raise NotImplementedError
end

#update!(*args) ⇒ Object

Raises:

  • (NotImplementedError)


53
54
55
# File 'lib/zm/client/appointment/appointment.rb', line 53

def update!(*args)
  raise NotImplementedError
end