class Tilia::CalDav::Notifications::Node

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.

Public Class Methods

new(caldav_backend, principal_uri, notification) click to toggle source

Constructor

@param CalDAVBackendNotificationSupport caldav_backend @param string principal_uri @param NotificationInterface notification

# 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

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/notifications/node.rb, line 101
def acl
  [
    {
      'principal' => owner,
      'privilege' => '{DAV:}read',
      'protected' => true
    },
    {
      'principal' => owner,
      'privilege' => '{DAV:}write',
      'protected' => true
    }
  ]
end
acl=(_acl) click to toggle source

Updates the ACL

This method will receive a list of new ACE's as an array argument.

@param array acl @return void

# 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() click to toggle source

Deletes this notification

@return void

# File lib/tilia/cal_dav/notifications/node.rb, line 69
def delete
  @caldav_backend.delete_notification(owner, @notification)
end
etag() click to toggle source

Returns the etag for the notification.

The etag must be surrounded by litteral double-quotes.

@return string

# File lib/tilia/cal_dav/notifications/node.rb, line 54
def etag
  @notification.etag
end
group() click to toggle source

Returns a group principal

This must be a url to a principal, or null if there's no owner

@return string|null

# File lib/tilia/cal_dav/notifications/node.rb, line 87
def group
  nil
end
name() click to toggle source

Returns the path name for this notification

@return id

# File lib/tilia/cal_dav/notifications/node.rb, line 45
def name
  @notification.id.to_s + '.xml'
end
notification_type() click to toggle source

This method must return an xml element, using the SabreCalDAVNotificationsINotificationType classes.

@return INotificationType

# File lib/tilia/cal_dav/notifications/node.rb, line 62
def notification_type
  @notification
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/notifications/node.rb, line 78
def owner
  @principal_uri
end
supported_privilege_set() click to toggle source

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.

@return array|null

# File lib/tilia/cal_dav/notifications/node.rb, line 136
def supported_privilege_set
  nil
end