class Tilia::CalDav::Notifications::Collection

This node represents a list of notifications.

It provides no additional functionality, but you must implement this interface to allow the Notifications plugin to mark the collection as a notifications collection.

This collection should only return SabreCalDAVNotificationsINode nodes as its children.

Public Class Methods

new(caldav_backend, principal_uri) click to toggle source

Constructor

@param CalDAVBackendNotificationSupport caldav_backend @param string principal_uri

# File lib/tilia/cal_dav/notifications/collection.rb, line 32
def initialize(caldav_backend, principal_uri)
  @caldav_backend = caldav_backend
  @principal_uri = principal_uri
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/collection.rb, line 90
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/collection.rb, line 111
def acl=(_acl)
  fail Dav::Exception::NotImplemented, 'Updating ACLs is not implemented here'
end
children() click to toggle source

Returns all notifications for a principal

@return array

# File lib/tilia/cal_dav/notifications/collection.rb, line 40
def children
  children = []
  notifications = @caldav_backend.notifications_for_principal(@principal_uri)

  notifications.each do |notification|
    children << Node.new(
      @caldav_backend,
      @principal_uri,
      notification
    )
  end

  children
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/collection.rb, line 76
def group
  nil
end
name() click to toggle source

Returns the name of this object

@return string

# File lib/tilia/cal_dav/notifications/collection.rb, line 58
def name
  'notifications'
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/collection.rb, line 67
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/collection.rb, line 125
def supported_privilege_set
  nil
end