class Tilia::CalDav::Xml::Notification::SystemStatus
SystemStatus
notification
This notification can be used to indicate to the user that the system is down.
@copyright Copyright (C) 2007-2015 fruux GmbH (fruux.com/). @author Evert Pot (evertpot.com/) @license sabre.io/license/ Modified BSD License
Constants
- TYPE_HIGH
- TYPE_LOW
- TYPE_MEDIUM
Attributes
Returns the ETag for this notification.
The ETag must be surrounded by literal double-quotes.
@return string
Returns a unique id for this notification
This is just the base url. This should generally be some kind of unique id.
@return string
Public Class Methods
Creates the notification.
Some kind of unique id should be provided. This is used to generate a url.
@param string id @param string etag @param int type @param string description @param string href
# File lib/tilia/cal_dav/xml/notification/system_status.rb, line 58 def initialize(id, etag, type = TYPE_HIGH, description = nil, href = nil) @id = id @type = type @description = description @href = href @etag = etag end
Public Instance Methods
The serialize method is called during xml writing.
It should use the writer argument to encode this object into XML.
Important note: it is not needed to create the parent element. The parent element is already created, and we only have to worry about attributes, child elements and text (if any).
Important note 2: If you are writing any new elements, you are also responsible for closing them.
@param Writer writer @return void
# File lib/tilia/cal_dav/xml/notification/system_status.rb, line 79 def xml_serialize(writer) case @type when TYPE_LOW type = 'low' when TYPE_MEDIUM type = 'medium' else type = 'high' end writer.start_element("{#{Plugin::NS_CALENDARSERVER}}systemstatus") writer.write_attribute('type', type) writer.end_element end
This method serializes the entire notification, as it is used in the response body.
@param Writer writer @return void
# File lib/tilia/cal_dav/xml/notification/system_status.rb, line 99 def xml_serialize_full(writer) cs = "{#{Plugin::NS_CALENDARSERVER}}" case @type when TYPE_LOW type = 'low' when TYPE_MEDIUM type = 'medium' else type = 'high' end writer.start_element(cs + 'systemstatus') writer.write_attribute('type', type) unless @description.blank? writer.write_element(cs + 'description', @description) end writer.write_element('{DAV:}href', @href) unless @href.blank? writer.end_element # systemstatus end