From 8d30aa42abf83277ae97b4e921676ec218b85bac Mon Sep 17 00:00:00 2001 From: Bhushan Ahire Date: Tue, 24 Sep 2013 08:48:20 -0400 Subject: [PATCH] Added functionality to support Outlook FREE / BUSY status implementation --- README.txt | 10 +++++++++- lib/ri_cal/properties/event.rb | 35 +++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/README.txt b/README.txt index 9d25d5c9..69b6a72d 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -== RI_CAL -- a new implementation of RFC2445 in Ruby +== RI_CAL -- a new implementation of RFC2445 in Ruby with Outlook FREE / BUSY status implementation http://ri-cal.rubyforge.org/ by Rick DeNatale @@ -17,6 +17,8 @@ A Google group for discussion of this library has been set up http://groups.goog * All examples of recurring events in RFC 2445 are handled. RSpec examples are provided for them. +Added functionality to support Outlook FREE / BUSY status implementation + == SYNOPSIS: For the full RDOC see http://ri-cal.rubyforge.org/rdoc/ @@ -36,6 +38,8 @@ The methods for accessing the properties of each type of component are defined i same name as the component class in the RiCal::properties module. For example the property accessing methods for RiCal::Component::Event are defined in RiCal::Properties::Event +Added functionality to support Outlook FREE / BUSY status implementation + === Creating Calendars and Calendar Components RiCal provides a builder DSL for creating calendars and calendar components. An example @@ -47,6 +51,8 @@ RiCal provides a builder DSL for creating calendars and calendar components. An dtend DateTime.parse("2/20/1962 19:43:02") location "Cape Canaveral" add_attendee "john.glenn@nasa.gov" + #Outlook FREE / BUSY status + outlook_busystatus "FREE" alarm do description "Segment 51" end @@ -69,6 +75,7 @@ will be passed as that argument event.dtend = DateTime.parse("2/20/1962 19:43:02") event.location = "Cape Canaveral" event.add_attendee "john.glenn@nasa.gov" + event.outlook_busystatus = "FREE" event.alarm do description "Segment 51" end @@ -290,6 +297,7 @@ In either case the result will be an array of components. CREATED:20090225T000839Z DTEND;TZID=US/Eastern:20090224T100000 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20090228T045959Z + X-MICROSOFT-CDO-BUSYSTATUS:FREE END:VEVENT END:VCALENDAR ENDCAL diff --git a/lib/ri_cal/properties/event.rb b/lib/ri_cal/properties/event.rb index c6e43e97..fd324c6c 100644 --- a/lib/ri_cal/properties/event.rb +++ b/lib/ri_cal/properties/event.rb @@ -1200,6 +1200,36 @@ def request_status_property_from_string(line) # :nodoc: request_status_property << RiCal::PropertyValue::Text.new(self, line) end + # return the the X-MICROSOFT-CDO-BUSYSTATUS property + # which will be an instance of RiCal::PropertyValueText + # + + def outlook_busystatus_property + @outlook_busystatus_property ||= [] + end + + # set the the X-MICROSOFT-CDO-BUSYSTATUS property + # one or more instances of RiCal::PropertyValueText may be passed to this method + def outlook_busystatus_property=(property_values) + @outlook_busystatus_property = property_values + end + + # set the value of the X-MICROSOFT-CDO-BUSYSTATUS property to a single value + # one instance of String may be passed to this method + def outlook_busystatus=(ruby_value) + @outlook_busystatus_property = RiCal::PropertyValue::Text.convert(self, ruby_value) + end + + # return the value of the X-MICROSOFT-CDO-BUSYSTATUS property + # which will be an array of instances of String + def outlook_busystatus + outlook_busystatus ? outlook_busystatus.ruby_value : nil + end + + def outlook_busystatus_property_from_string(line) # :nodoc: + outlook_busystatus_property << RiCal::PropertyValue::Text.new(self, line) + end + # return the the RELATED-TO property # which will be an array of instances of RiCal::PropertyValueText # @@ -1421,6 +1451,7 @@ def export_properties_to(export_stream) #:nodoc: export_prop_to(export_stream, "LOCATION", @location_property) export_prop_to(export_stream, "COMMENT", @comment_property) export_prop_to(export_stream, "SEQUENCE", @sequence_property) + export_prop_to(export_stream, "X-MICROSOFT-CDO-BUSYSTATUS", @outlook_busystatus_property) end def ==(o) #:nodoc: @@ -1455,7 +1486,8 @@ def ==(o) #:nodoc: (exrule_property == o.exrule_property) && (location_property == o.location_property) && (comment_property == o.comment_property) && - (sequence_property == o.sequence_property) + (sequence_property == o.sequence_property) && + (outlook_busystatus_property == o.outlook_busystatus_property) else super end @@ -1494,6 +1526,7 @@ def initialize_copy(o) #:nodoc: location_property = location_property && location_property.dup comment_property = comment_property && comment_property.dup sequence_property = sequence_property && sequence_property.dup + outlook_busystatus_property = outlook_busystatus_property && outlook_busystatus_property.dup end def add_date_times_to(required_timezones) #:nodoc: