class Tilia::CalDav::Xml::Property::ScheduleCalendarTransp

schedule-calendar-transp property.

This property is a representation of the schedule-calendar-transp property. This property is defined in:

tools.ietf.org/html/rfc6638#section-9.1

Its values are either 'transparent' or 'opaque'. If it's transparent, it means that this calendar will not be taken into consideration when a different user queries for free-busy information. If it's 'opaque', it will.

Constants

OPAQUE
TRANSPARENT

Attributes

value[R]

Returns the current value

@return string

Public Class Methods

new(value) click to toggle source

Creates the property

@param string value

# File lib/tilia/cal_dav/xml/property/schedule_calendar_transp.rb, line 29
def initialize(value)
  if value != TRANSPARENT && value != OPAQUE
    fail ArgumentError, 'The value must either be specified as "transparent" or "opaque"'
  end
  @value = value
end
xml_deserialize(reader) click to toggle source

The deserialize method is called during xml parsing.

This method is called statictly, this is because in theory this method may be used as a type of constructor, or factory method.

Often you want to return an instance of the current class, but you are free to return other data as well.

You are responsible for advancing the reader to the next element. Not doing anything will result in a never-ending loop.

If you just want to skip parsing for this element altogether, you can just call reader.next

reader.parse_inner_tree will parse the entire sub-tree, and advance to the next element.

@param Reader reader @return mixed

# File lib/tilia/cal_dav/xml/property/schedule_calendar_transp.rb, line 86
def self.xml_deserialize(reader)
  elems = Tilia::Xml::Element::Elements.xml_deserialize(reader)

  value = nil

  elems.each do |elem|
    case elem
    when "{#{Plugin::NS_CALDAV}}opaque"
      value = OPAQUE
    when "{#{Plugin::NS_CALDAV}}transparent"
      value = TRANSPARENT
    end
  end

  return nil unless value

  new(value)
end

Public Instance Methods

xml_serialize(writer) click to toggle source

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.

@param Writer writer @return void

# File lib/tilia/cal_dav/xml/property/schedule_calendar_transp.rb, line 58
def xml_serialize(writer)
  case @value
  when TRANSPARENT
    writer.write_element("{#{Plugin::NS_CALDAV}}transparent")
  when OPAQUE
    writer.write_element("{#{Plugin::NS_CALDAV}}opaque")
  end
end