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

#concat, #init_from_json, #rename!, #soap_account_connector, #to_h

Methods inherited from Base::Object

#arrow_name, #clone, #concat, #convert_json_string_value, #disable_builder, #enable_builder, #init_from_json, #instance_variables_array, #instance_variables_hash, #logger, #recorded?, #save!, #to_s, #use_builder?

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
# 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

#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



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

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

#all_instance_variable_keysObject



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

def all_instance_variable_keys
  INSTANCE_VARIABLE_KEYS
end

#busy!Object



73
74
75
76
# File 'lib/zm/client/appointment/appointment.rb', line 73

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

#create!Object



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

def create!
  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



63
64
65
66
# File 'lib/zm/client/appointment/appointment.rb', line 63

def delete!
  @parent.sacc.cancel_appointment(@parent.token, jsns_builder.to_delete)
  super
end

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



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

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



68
69
70
71
# File 'lib/zm/client/appointment/appointment.rb', line 68

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

#modify!Object



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

def modify!
  @parent.sacc.modify_appointment(@parent.token, jsns_builder.to_update)
end

#must_confirm!Object



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

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

#out_of_office!Object



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

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

#reload!Object



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

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