Class: Zm::Client::Appointment

Inherits:
Base::AccountObject show all
Defined in:
lib/zm/client/appointment/appointment.rb

Overview

class for account appointment

Defined Under Namespace

Classes: Attendee, Attendees, Organizer

Constant Summary collapse

INSTANCE_VARIABLE_KEYS =
i[id uid name l desc start_at dur end_at tn allDay organizer timezone calItemId apptId invId rev fb transp]

Instance Attribute Summary collapse

Attributes inherited from Base::Object

#grantee_type, #id, #name, #parent, #token

Instance Method Summary collapse

Methods inherited from Base::AccountObject

#soap_account_connector

Methods inherited from Base::Object

#arrow_name, #clone, #convert_json_string_value, #init_from_json, #instance_variables_array, #instance_variables_hash, #recorded?, #save!, #to_s

Constructor Details

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

def initialize(parent, json = nil)

Yields:

  • (_self)

Yield Parameters:



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

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

#attendeesObject (readonly)

Returns the value of attribute attendees.



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

def attendees
  @attendees
end

#bodyObject (readonly)

Returns the value of attribute body.



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

def body
  @body
end

#folderObject



33
34
35
# File 'lib/zm/client/appointment/appointment.rb', line 33

def folder
  @folder ||= @parent.folders.all.find { |folder| folder.id == l }
end

#jsonObject (readonly)

Returns the value of attribute json.



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

def json
  @json
end

#recipientsObject (readonly)

Returns the value of attribute recipients.



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

def recipients
  @recipients
end

Instance Method Details

#busy!Object



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

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

#concatObject



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

def concat
  INSTANCE_VARIABLE_KEYS.map { |key| instance_variable_get(arrow_name(key)) }
end

#create!Object



43
44
45
46
47
48
49
50
51
# File 'lib/zm/client/appointment/appointment.rb', line 43

def create!
  jsns_builder = AppointmentJsnsBuilder.new(self)
  rep = @parent.sacc.create_appointment(@parent.token, jsns_builder.to_jsns)
  rep_h = rep[:Body][:CreateAppointmentResponse]

  aji = AppointmentJsnsInitializer.new(@parent, rep_h)
  aji.appointment = self
  aji.update
end

#delete!Object



66
67
68
69
# File 'lib/zm/client/appointment/appointment.rb', line 66

def delete!
  jsns_builder = AppointmentJsnsBuilder.new(self)
  @parent.sacc.cancel_appointment(@parent.token, jsns_builder.to_delete)
end

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



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

def download(dest_file_path, fmt = 'ics')
  # @parent.uploader.download_file(folder.absFolderPath, 'ics', ['appointment'], [id], dest_file_path)
  uploader = Upload.new(@parent, RestAccountConnector.new)
  uploader.download_file(folder.absFolderPath, fmt, ['appointment'], [id], dest_file_path)
end

#free!Object



71
72
73
74
# File 'lib/zm/client/appointment/appointment.rb', line 71

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

#modify!Object



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

def modify!
  jsns_builder = AppointmentJsnsBuilder.new(self)
  @parent.sacc.modify_appointment(@parent.token, jsns_builder.to_update)
end

#must_confirm!Object



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

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

#out_of_office!Object



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

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

#reload!Object



58
59
60
61
62
63
64
# File 'lib/zm/client/appointment/appointment.rb', line 58

def reload!
  rep = @parent.sacc.get_msg(@parent.token, @id)
  entry = rep[:Body][:GetMsgResponse][:m].first
  aji = AppointmentJsnsInitializer.new(@parent, entry)
  aji.appointment = self
  aji.create
end