Class: Tilia::CalDav::Notifications::Node
- Includes:
- INode, DavAcl::IAcl
- Defined in:
- lib/tilia/cal_dav/notifications/node.rb
Overview
This node represents a single notification.
The signature is mostly identical to that of SabreDAVIFile, but the get method MUST return an xml document that matches the requirements of the ‘caldav-notifications.txt’ spec.
Instance Method Summary collapse
-
#acl ⇒ Object
Returns a list of ACE’s for this node.
-
#acl=(_acl) ⇒ Object
Updates the ACL.
-
#delete ⇒ Object
Deletes this notification.
-
#etag ⇒ Object
Returns the etag for the notification.
-
#group ⇒ Object
Returns a group principal.
-
#initialize(caldav_backend, principal_uri, notification) ⇒ Node
constructor
Constructor.
-
#name ⇒ Object
Returns the path name for this notification.
-
#notification_type ⇒ Object
This method must return an xml element, using the SabreCalDAVNotificationsINotificationType classes.
-
#owner ⇒ Object
Returns the owner principal.
-
#supported_privilege_set ⇒ Object
Returns the list of supported privileges for this node.
Methods included from Dav::INode
Methods inherited from Dav::File
#content_type, #get, #put, #size
Methods included from Dav::IFile
#content_type, #get, #put, #size
Methods inherited from Dav::Node
Constructor Details
#initialize(caldav_backend, principal_uri, notification) ⇒ Node
Constructor
36 37 38 39 40 |
# File 'lib/tilia/cal_dav/notifications/node.rb', line 36 def initialize(caldav_backend, principal_uri, notification) @caldav_backend = caldav_backend @principal_uri = principal_uri @notification = notification end |
Instance Method Details
#acl ⇒ Object
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.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/tilia/cal_dav/notifications/node.rb', line 101 def acl [ { 'principal' => owner, 'privilege' => '{DAV:}read', 'protected' => true }, { 'principal' => owner, 'privilege' => '{DAV:}write', 'protected' => true } ] end |
#acl=(_acl) ⇒ Object
Updates the ACL
This method will receive a list of new ACE’s as an array argument.
122 123 124 |
# File 'lib/tilia/cal_dav/notifications/node.rb', line 122 def acl=(_acl) fail Dav::Exception::NotImplemented, 'Updating ACLs is not implemented here' end |
#delete ⇒ Object
Deletes this notification
69 70 71 |
# File 'lib/tilia/cal_dav/notifications/node.rb', line 69 def delete @caldav_backend.delete_notification(owner, @notification) end |
#etag ⇒ Object
Returns the etag for the notification.
The etag must be surrounded by litteral double-quotes.
54 55 56 |
# File 'lib/tilia/cal_dav/notifications/node.rb', line 54 def etag @notification.etag end |
#group ⇒ Object
Returns a group principal
This must be a url to a principal, or null if there’s no owner
87 88 89 |
# File 'lib/tilia/cal_dav/notifications/node.rb', line 87 def group nil end |
#name ⇒ Object
Returns the path name for this notification
45 46 47 |
# File 'lib/tilia/cal_dav/notifications/node.rb', line 45 def name @notification.id.to_s + '.xml' end |
#notification_type ⇒ Object
This method must return an xml element, using the SabreCalDAVNotificationsINotificationType classes.
62 63 64 |
# File 'lib/tilia/cal_dav/notifications/node.rb', line 62 def notification_type @notification end |
#owner ⇒ Object
Returns the owner principal
This must be a url to a principal, or null if there’s no owner
78 79 80 |
# File 'lib/tilia/cal_dav/notifications/node.rb', line 78 def owner @principal_uri end |
#supported_privilege_set ⇒ Object
Returns the list of supported privileges for this node.
The returned data structure is a list of nested privileges. See SabreDAVACLPlugin::getDefaultSupportedPrivilegeSet for a simple standard structure.
If null is returned from this method, the default privilege set is used, which is fine for most common usecases.
136 137 138 |
# File 'lib/tilia/cal_dav/notifications/node.rb', line 136 def supported_privilege_set nil end |