Class: TwistedCaldav::Query
- Inherits:
-
Object
- Object
- TwistedCaldav::Query
- Defined in:
- lib/twisted-caldav/query.rb
Instance Attribute Summary collapse
-
#child ⇒ Object
Returns the value of attribute child.
Class Method Summary collapse
Instance Method Summary collapse
- #event(param = nil) ⇒ Object
-
#to_xml(xml = Builder::XmlMarkup.new(:indent => 2)) ⇒ Object
TODO: raise error if to_xml is called before child is assigned.
- #todo(param = nil) ⇒ Object
Instance Attribute Details
#child ⇒ Object
Returns the value of attribute child.
3 4 5 |
# File 'lib/twisted-caldav/query.rb', line 3 def child @child end |
Class Method Details
.event(param = nil) ⇒ Object
42 43 44 |
# File 'lib/twisted-caldav/query.rb', line 42 def self.event( param=nil ) self.new.event( param ) end |
.todo(param = nil) ⇒ Object
47 48 49 |
# File 'lib/twisted-caldav/query.rb', line 47 def self.todo( param=nil ) self.new.todo end |
Instance Method Details
#event(param = nil) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/twisted-caldav/query.rb', line 21 def event(param = nil) self.child = Filter::Component.new("VEVENT") if param.is_a? Range self.child.time_range(param) elsif param.is_a? String self.child.uid(param) else self.child end end |
#to_xml(xml = Builder::XmlMarkup.new(:indent => 2)) ⇒ Object
TODO: raise error if to_xml is called before child is assigned
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/twisted-caldav/query.rb', line 6 def to_xml(xml = Builder::XmlMarkup.new(:indent => 2)) xml.instruct! xml.tag! "cal:calendar-query", TwistedCaldav::NAMESPACES do xml.tag! "dav:prop" do xml.tag! "dav:getetag" xml.tag! "cal:calendar-data" end xml.tag! "cal:filter" do cal = Filter::Component.new("VCALENDAR", self) cal.child = self.child cal.build_xml(xml) end end end |