It would be nice if there were a way to fetch the reminders from an entry. I have attached a
patch to Net::Google::Calendar::Entry which adds a reminders() method for this purpose.
Cheers,
Sterling
Subject: | 0001-Add-a-reminders-method-for-enumerating-existing-remi.patch |
From f41a484bfcc43b79fa9bf884c7221e3e60df11fb Mon Sep 17 00:00:00 2001
From: Sterling Hanenkamp <hanenkamp@cpan.org>
Date: Sun, 6 Feb 2011 00:13:14 -0600
Subject: [PATCH] Add a reminders() method for enumerating existing reminders
---
lib/Net/Google/Calendar/Entry.pm | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/lib/Net/Google/Calendar/Entry.pm b/lib/Net/Google/Calendar/Entry.pm
index 773423a..b2f1003 100644
--- a/lib/Net/Google/Calendar/Entry.pm
+++ b/lib/Net/Google/Calendar/Entry.pm
@@ -351,7 +351,33 @@ sub reminder {
return 1;
}
+=head2 reminders
+Gets the list of reminders attached to this entry. They are returned as a list of arrays references. For example.
+
+ ( [ 'alert', 'days', '2' ], [ 'sms', 'minutes', '15' ] )
+
+Each element in the returned list is in the format that may be passed to the C<reminder> method.
+
+=cut
+
+sub reminders {
+ my $self = shift;
+
+ my @reminders;
+ REMINDER: for my $reminder ($self->_my_getlist($self->{_gd_ns}, 'reminder')) {
+ for my $type (qw( days hours minutes absoluteTime )) {
+ my $when = $reminder->getAttribute($type);
+ if (defined $when) {
+ push @reminders,
+ [ $reminder->getAttribute('method'), $type, $when ];
+ next REMINDER;
+ }
+ }
+ }
+
+ return @reminders;
+}
--
1.7.3.2