class Tilia::CalDav::Schedule::SchedulingObject
The SchedulingObject
represents a scheduling object in the Inbox
collection
Public Class Methods
new(caldav_backend, object_data)
click to toggle source
Constructor
The following properties may be passed within object_data:
* uri - A unique uri. Only the 'basename' must be passed. * principaluri - the principal that owns the object. * calendardata (optional) - The iCalendar data * etag - (optional) The etag for this object, MUST be encloded with double-quotes. * size - (optional) The size of the data in bytes. * lastmodified - (optional) format as a unix timestamp. * acl - (optional) Use this to override the default ACL for the node.
@param BackendBackendInterface caldav_backend @param array object_data
# File lib/tilia/cal_dav/schedule/scheduling_object.rb, line 35 def initialize(caldav_backend, object_data) @caldav_backend = caldav_backend fail ArgumentError, 'The objectData argument must contain an \'uri\' property' unless object_data.key?('uri') @object_data = object_data end
Public Instance Methods
acl()
click to toggle source
Returns a list of ACE's for this node.
Each ACE has the following properties:
* 'privilege', a string such as {DAV:}read or {DAV:}write. These are currently the only supported privileges * 'principal', a url to the principal who owns the node * 'protected' (optional), indicating that this ACE is not allowed to be updated.
@return array
# File lib/tilia/cal_dav/schedule/scheduling_object.rb, line 89 def acl # An alternative acl may be specified in the object data. # return @object_data['acl'] if @object_data.key?('acl') # The default ACL [ { 'privilege' => '{DAV:}read', 'principal' => @object_data['principaluri'], 'protected' => true }, { 'privilege' => '{DAV:}write', 'principal' => @object_data['principaluri'], 'protected' => true }, { 'privilege' => '{DAV:}read', 'principal' => @object_data['principaluri'] + '/calendar-proxy-write', 'protected' => true }, { 'privilege' => '{DAV:}write', 'principal' => @object_data['principaluri'] + '/calendar-proxy-write', 'protected' => true }, { 'privilege' => '{DAV:}read', 'principal' => @object_data['principaluri'] + '/calendar-proxy-read', 'protected' => true } ] end
delete()
click to toggle source
Deletes the scheduling message
@return void
# File lib/tilia/cal_dav/schedule/scheduling_object.rb, line 66 def delete @caldav_backend.delete_scheduling_object(@object_data['principaluri'], @object_data['uri']) end
get()
click to toggle source
Returns the ICalendar-formatted object
@return string
# File lib/tilia/cal_dav/schedule/scheduling_object.rb, line 46 def get # Pre-populating the 'calendardata' is optional, if we don't have it # already we fetch it from the backend. unless @object_data.key?('calendardata') @object_data = @caldav_backend.scheduling_object(@object_data['principaluri'], @object_data['uri']) end @object_data['calendardata'] end
owner()
click to toggle source
Returns the owner principal
This must be a url to a principal, or null if there's no owner
@return string|null
# File lib/tilia/cal_dav/schedule/scheduling_object.rb, line 75 def owner @object_data['principaluri'] end
put(_calendar_data)
click to toggle source
Updates the ICalendar-formatted object
@param string|resource calendar_data @return string
# File lib/tilia/cal_dav/schedule/scheduling_object.rb, line 59 def put(_calendar_data) fail Dav::Exception::MethodNotAllowed, 'Updating scheduling objects is not supported' end