Class: Zm::Client::Appointment

Inherits:
Base::Object show all
Includes:
BelongsToFolder, BelongsToTag
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 inherited from Base::Object

#parent, #token

Instance Method Summary collapse

Methods included from BelongsToTag

#tags

Methods included from BelongsToFolder

#folder, #folder!, #folder=, #folder_id, #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:



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

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.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def allDay
  @allDay
end

#apptIdObject

Returns the value of attribute apptId.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def apptId
  @apptId
end

#attendeesObject (readonly)

Returns the value of attribute attendees.



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

def attendees
  @attendees
end

#bodyObject (readonly)

Returns the value of attribute body.



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

def body
  @body
end

#calItemIdObject

Returns the value of attribute calItemId.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def calItemId
  @calItemId
end

#descObject Also known as: description

Returns the value of attribute desc.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def desc
  @desc
end

#durObject

Returns the value of attribute dur.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def dur
  @dur
end

#end_atObject

Returns the value of attribute end_at.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def end_at
  @end_at
end

#fbObject

Returns the value of attribute fb.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def fb
  @fb
end

#idObject

Returns the value of attribute id.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def id
  @id
end

#invIdObject

Returns the value of attribute invId.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def invId
  @invId
end

#lObject

Returns the value of attribute l.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def l
  @l
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def name
  @name
end

#organizerObject

Returns the value of attribute organizer.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def organizer
  @organizer
end

#recipientsObject (readonly)

Returns the value of attribute recipients.



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

def recipients
  @recipients
end

#revObject

Returns the value of attribute rev.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def rev
  @rev
end

#start_atObject

Returns the value of attribute start_at.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def start_at
  @start_at
end

#timezoneObject

Returns the value of attribute timezone.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def timezone
  @timezone
end

#tnObject

Returns the value of attribute tn.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def tn
  @tn
end

#transpObject

Returns the value of attribute transp.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def transp
  @transp
end

#uidObject

Returns the value of attribute uid.



10
11
12
# File 'lib/zm/client/appointment/appointment.rb', line 10

def uid
  @uid
end

Instance Method Details

#busy!Object



80
81
82
83
# File 'lib/zm/client/appointment/appointment.rb', line 80

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

#create!Object



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

def create!
  soap_request = SoapElement.mail(SoapMailConstants::CREATE_APPOINTMENT_REQUEST).add_attributes(jsns_builder.to_jsns)
  rep = @parent.sacc.invoke(soap_request)

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

#delete!Object



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

def delete!
  return false if @id.nil?

  @parent.sacc.invoke(jsns_builder.to_delete)
  @id = nil
end

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



27
28
29
30
# File 'lib/zm/client/appointment/appointment.rb', line 27

def download(dest_file_path, fmt = 'ics')
  uploader = Upload.new(@parent, RestAccountConnector.new)
  uploader.download_file(Zm::Client::FolderDefault::ROOT[:path], fmt, [Zm::Client::FolderView::APPOINTMENT], [@id], dest_file_path)
end

#free!Object



75
76
77
78
# File 'lib/zm/client/appointment/appointment.rb', line 75

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

#modify!Object



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

def modify!
  soap_request = SoapElement.mail(SoapMailConstants::MODIFY_APPOINTMENT_REQUEST).add_attributes(jsns_builder.to_update)
  @parent.sacc.invoke(soap_request)
  true
end

#must_confirm!Object



85
86
87
88
# File 'lib/zm/client/appointment/appointment.rb', line 85

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

#out_of_office!Object



90
91
92
93
# File 'lib/zm/client/appointment/appointment.rb', line 90

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

#reload!Object



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

def reload!
  jsns = { m: { id: @id, html: 1 } }

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

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

#rename!(*args) ⇒ Object

Raises:

  • (NotImplementedError)


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

def rename!(*args)
  raise NotImplementedError
end

#update!(*args) ⇒ Object

Raises:

  • (NotImplementedError)


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

def update!(*args)
  raise NotImplementedError
end