Class: Tilia::CalDav::Xml::Property::AllowedSharingModes

Inherits:
Object
  • Object
show all
Includes:
Xml::XmlSerializable
Defined in:
lib/tilia/cal_dav/xml/property/allowed_sharing_modes.rb

Overview

AllowedSharingModes

This property encodes the ‘allowed-sharing-modes’ property, as defined by the ‘caldav-sharing-02’ spec, in the calendarserver.org/ns/ namespace.

This property is a representation of the supported-calendar_component-set property in the CalDAV namespace. It simply requires an array of components, such as VEVENT, VTODO

Instance Method Summary collapse

Constructor Details

#initialize(can_be_shared, can_be_published) ⇒ Object

Constructor

Parameters:

  • bool

    can_be_shared

  • bool

    can_be_published



34
35
36
37
# File 'lib/tilia/cal_dav/xml/property/allowed_sharing_modes.rb', line 34

def initialize(can_be_shared, can_be_published)
  @can_be_shared = can_be_shared
  @can_be_published = can_be_published
end

Instance Method Details

#xml_serialize(writer) ⇒ Object

The xmlSerialize metod is called during xml writing.

Use the writer argument to write its own xml serialization.

An important note: do not create a parent element. Any element implementing XmlSerializble should only ever write what’s considered its ‘inner xml’.

The parent of the current element is responsible for writing a containing element.

This allows serializers to be re-used for different element names.

If you are opening new elements, you must also close them again.

Parameters:

  • Writer

    writer

Returns:

  • void



56
57
58
59
# File 'lib/tilia/cal_dav/xml/property/allowed_sharing_modes.rb', line 56

def xml_serialize(writer)
  writer.write_element("{#{Plugin::NS_CALENDARSERVER}}can-be-shared") if @can_be_shared
  writer.write_element("{#{Plugin::NS_CALENDARSERVER}}can-be-published") if @can_be_published
end