vpim 0.323 → 0.357

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,9 @@
7
7
  =end
8
8
 
9
9
  module Vpim
10
- VERSION = "0.323"
10
+ PRODID = '-//Ensemble Independent//vPim 0.357//EN'
11
+
12
+ VERSION = '0.357'
11
13
 
12
14
  # Return the API version as a string.
13
15
  def Vpim.version
@@ -15,74 +15,7 @@ require 'vpim/property/common'
15
15
  require 'vpim/property/priority'
16
16
  require 'vpim/property/location'
17
17
  require 'vpim/property/resources'
18
-
19
- module Vpim
20
- class Icalendar
21
- class Vjournal
22
- include Vpim::Icalendar::Property::Base
23
- include Vpim::Icalendar::Property::Common
24
-
25
- def initialize(fields) #:nodoc:
26
- outer, inner = Vpim.outer_inner(fields)
27
-
28
- @properties = Vpim::DirectoryInfo.create(outer)
29
-
30
- @elements = inner
31
- end
32
-
33
- # Create a Vjournal component.
34
- def self.create(fields=[])
35
- di = DirectoryInfo.create([], 'VJOURNAL')
36
-
37
- Vpim::DirectoryInfo::Field.create_array(fields).each { |f| di.push_unique f }
38
-
39
- new(di.to_a)
40
- end
41
-
42
- end
43
- end
44
- end
45
-
46
- module Vpim
47
- class Icalendar
48
- class Vtodo
49
- include Vpim::Icalendar::Property::Base
50
- include Vpim::Icalendar::Property::Common
51
- include Vpim::Icalendar::Property::Priority
52
- include Vpim::Icalendar::Property::Location
53
- include Vpim::Icalendar::Property::Resources
54
-
55
- def initialize(fields) #:nodoc:
56
- outer, inner = Vpim.outer_inner(fields)
57
-
58
- @properties = Vpim::DirectoryInfo.create(outer)
59
-
60
- @elements = inner
61
- end
62
-
63
- # Create a new Vtodo object.
64
- #
65
- # If specified, +fields+ must be either an array of Field objects to
66
- # add, or a Hash of String names to values that will be used to build
67
- # Field objects. The latter is a convenient short-cut allowing the Field
68
- # objects to be created for you when called like:
69
- #
70
- # Vtodo.create('SUMMARY' => "buy mangos")
71
- #
72
- # TODO - maybe todos are usually created in a particular way? I can
73
- # make it easier. Ideally, I would like to make it hard to encode an invalid
74
- # Event.
75
- def Vtodo.create(fields=[])
76
- di = DirectoryInfo.create([], 'VTODO')
77
-
78
- Vpim::DirectoryInfo::Field.create_array(fields).each { |f| di.push_unique f }
79
-
80
- new(di.to_a)
81
- end
82
-
83
- end
84
- end
85
- end
18
+ require 'vpim/property/recurrence'
86
19
 
87
20
  module Vpim
88
21
  class Icalendar
@@ -92,6 +25,7 @@ module Vpim
92
25
  include Vpim::Icalendar::Property::Priority
93
26
  include Vpim::Icalendar::Property::Location
94
27
  include Vpim::Icalendar::Property::Resources
28
+ include Vpim::Icalendar::Property::Recurrence
95
29
 
96
30
  def initialize(fields) #:nodoc:
97
31
  outer, inner = Vpim.outer_inner(fields)
@@ -201,28 +135,6 @@ module Vpim
201
135
  end
202
136
  end
203
137
 
204
- # The recurrence rule, if any, for this event. Recurrence starts at the
205
- # DTSTART time.
206
- def rrule
207
- propvalue 'RRULE'
208
- end
209
-
210
- # The times this event occurs, as a Vpim::Rrule.
211
- #
212
- # Note: the event may occur only once.
213
- #
214
- # Note: occurences are currently calculated only from DTSTART and RRULE,
215
- # no allowance for EXDATE or other fields is made.
216
- def occurences
217
- Vpim::Rrule.new(dtstart, rrule)
218
- end
219
-
220
- # Check if this event overlaps with the time period later than or equal to +t0+, but
221
- # earlier than +t1+.
222
- def occurs_in?(t0, t1)
223
- occurences.each_until(t1).detect { |t| tend = t + (duration || 0); tend > t0 }
224
- end
225
-
226
138
  end
227
139
  end
228
140
  end
@@ -0,0 +1,46 @@
1
+ =begin
2
+ Copyright (C) 2006 Sam Roberts
3
+
4
+ This library is free software; you can redistribute it and/or modify it
5
+ under the same terms as the ruby language itself, see the file COPYING for
6
+ details.
7
+ =end
8
+
9
+ require 'vpim/dirinfo'
10
+ require 'vpim/field'
11
+ require 'vpim/rfc2425'
12
+ require 'vpim/vpim'
13
+ require 'vpim/property/base'
14
+ require 'vpim/property/common'
15
+ require 'vpim/property/recurrence'
16
+
17
+ module Vpim
18
+ class Icalendar
19
+
20
+ class Vjournal
21
+ include Vpim::Icalendar::Property::Base
22
+ include Vpim::Icalendar::Property::Common
23
+ include Vpim::Icalendar::Property::Recurrence
24
+
25
+ def initialize(fields) #:nodoc:
26
+ outer, inner = Vpim.outer_inner(fields)
27
+
28
+ @properties = Vpim::DirectoryInfo.create(outer)
29
+
30
+ @elements = inner
31
+ end
32
+
33
+ # Create a Vjournal component.
34
+ def self.create(fields=[])
35
+ di = DirectoryInfo.create([], 'VJOURNAL')
36
+
37
+ Vpim::DirectoryInfo::Field.create_array(fields).each { |f| di.push_unique f }
38
+
39
+ new(di.to_a)
40
+ end
41
+
42
+ end
43
+
44
+ end
45
+ end
46
+
@@ -6,84 +6,26 @@
6
6
  details.
7
7
  =end
8
8
 
9
- #:main:Vpim
10
- #:title:vpim - a library to manipulate vCards and iCalendars
11
- #
12
- # Author:: Sam Roberts <sroberts@uniserve.com>
13
- # Copyright:: Copyright (C) 2006 Sam Roberts
14
- # License:: May be distributed under the same terms as Ruby
15
- # Homepage:: http://vpim.rubyforge.org
16
- #
17
- # vCard (RFC 2426) is a format for personal information, see Vpim::Vcard and
18
- # Vpim::Maker::Vcard.
19
- #
20
- # iCalendar (RFC 2445) is a format for calendar related information, see
21
- # Vpim::Icalendar.
22
- #
23
- # iCalendar was called vCalendar pre-IETF standardization, and since both of
24
- # these "v-formats" are commonly used for personal information management, the
25
- # library is called "vpim".
26
- #
27
- # vCard and iCalendar support is built on top of an implementation of the MIME
28
- # Content-Type for Directory Information (RFC 2425). The basic RFC 2425 format
29
- # is implemented by Vpim::DirectoryInfo and Vpim::DirectoryInfo::Field.
30
- #
31
- # The libary is quite useable, but there is always more that could be done.
32
- # Since I have a more on my todo list than I have time, if you think something
33
- # is missing or have API suggestions, please contact me. I can't promise
34
- # instantaneous turnaround, but I might be able to suggest another approach,
35
- # and features requested by users of vPim are high priority for me.
36
- #
37
- # = Project Information
38
- #
39
- # The latest release can be downloaded from the Ruby Forge project page:
40
- #
41
- # - http://rubyforge.org/projects/vpim
42
- #
43
- # For notifications about new releases, or asking questions about vPim, please
44
- # subscribe to "vpim-talk":
45
- #
46
- # - http://rubyforge.org/mailman/listinfo/vpim-talk
47
- #
48
- # = Examples
49
- #
50
- # Sample utilities are provided as examples of using vPim in samples/.
51
- #
52
- # vCard examples are:
53
- # - link:ex_mkvcard.txt: example of creating a vCard
54
- # - link:ex_cpvcard.txt: example of copying and them modifying a vCard
55
- # - link:ex_mkv21vcard.txt: example of creating version 2.1 vCard
56
- # - link:mutt-aliases-to-vcf.txt: convert a mutt aliases file to vCards
57
- # - link:ex_get_vcard_photo.txt: pull photo data from a vCard
58
- # - link:ab-query.txt: query the OS X Address Book to find vCards
59
- # - link:vcf-to-mutt.txt: query vCards for matches, output in formats useful
60
- # with Mutt (see link:README.mutt for details)
61
- # - link:tabbed-file-to-vcf.txt: convert a tab-delimited file to vCards, a
62
- # (small but) complete application contributed by Dane G. Avilla, thanks!
63
- # - link:vcf-to-ics.txt: example of how to create calendars of birthdays from vCards
64
- # - link:vcf-dump.txt: utility for dumping contents of .vcf files
65
- #
66
- # iCalendar examples are:
67
- # - link:ics-to-rss.txt: prints todos as RSS, or starts a WEBrick servlet
68
- # that publishes todos as a RSS feed. Thanks to Dave Thomas for this idea,
69
- # from http://pragprog.com/pragdave/Tech/Blog/ToDos.rdoc.
70
- # - link:cmd-itip.txt: prints emailed iCalendar invitations in human-readable
71
- # form, and see link:README.mutt for instruction on mutt integration. I get
72
- # a lot of meeting invitations from Lotus Notes/Domino users at work, and
73
- # this is pretty useful in figuring out where and when I am supposed to be.
74
- # - link:reminder.txt: prints upcoming events and todos, by default from
75
- # Apple's iCal calendars
76
- # - link:rrule.txt: utility for printing recurrence rules
77
- # - link:ics-dump.txt: utility for dumping contents of .ics files
78
- module Vpim
79
- end
80
-
81
9
  require 'vpim/version'
82
10
 
11
+ #:main:README
12
+ #:title:vpim - a library to manipulate vCards and iCalendars
83
13
  module Vpim
84
14
  # Exception used to indicate that data being decoded is invalid, the message
85
- # usually gives some clue as to exactly what is invalid.
15
+ # should describe what is invalid.
86
16
  class InvalidEncodingError < StandardError; end
17
+
18
+ # Exception used to indicate that data being decoded is unsupported, the message
19
+ # should describe what is unsupported.
20
+ #
21
+ # If its unsupported, its likely because I didn't anticipate it being useful
22
+ # to support this, and it likely it could be supported on request.
23
+ class UnsupportedError < StandardError; end
24
+
25
+ # Exception used to indicate that encoding failed, probably because the
26
+ # object would not result in validly encoded data. The message should
27
+ # describe what is unsupported.
28
+ class Unencodeable < StandardError; end
87
29
  end
88
30
 
89
31
  module Vpim::Methods #:nodoc:
@@ -0,0 +1,82 @@
1
+ =begin
2
+ Copyright (C) 2006 Sam Roberts
3
+
4
+ This library is free software; you can redistribute it and/or modify it
5
+ under the same terms as the ruby language itself, see the file COPYING for
6
+ details.
7
+ =end
8
+
9
+ require 'vpim/dirinfo'
10
+ require 'vpim/field'
11
+ require 'vpim/rfc2425'
12
+ require 'vpim/vpim'
13
+ require 'vpim/property/base'
14
+ require 'vpim/property/common'
15
+ require 'vpim/property/priority'
16
+ require 'vpim/property/location'
17
+ require 'vpim/property/resources'
18
+ require 'vpim/property/recurrence'
19
+
20
+ module Vpim
21
+ class Icalendar
22
+
23
+ class Vtodo
24
+ include Vpim::Icalendar::Property::Base
25
+ include Vpim::Icalendar::Property::Common
26
+ include Vpim::Icalendar::Property::Priority
27
+ include Vpim::Icalendar::Property::Location
28
+ include Vpim::Icalendar::Property::Resources
29
+ include Vpim::Icalendar::Property::Recurrence
30
+
31
+ def initialize(fields) #:nodoc:
32
+ outer, inner = Vpim.outer_inner(fields)
33
+
34
+ @properties = Vpim::DirectoryInfo.create(outer)
35
+
36
+ @elements = inner
37
+ end
38
+
39
+ # Create a new Vtodo object.
40
+ #
41
+ # If specified, +fields+ must be either an array of Field objects to
42
+ # add, or a Hash of String names to values that will be used to build
43
+ # Field objects. The latter is a convenient short-cut allowing the Field
44
+ # objects to be created for you when called like:
45
+ #
46
+ # Vtodo.create('SUMMARY' => "buy mangos")
47
+ #
48
+ # TODO - maybe todos are usually created in a particular way? I can
49
+ # make it easier. Ideally, I would like to make it hard to encode an invalid
50
+ # Event.
51
+ def Vtodo.create(fields=[])
52
+ di = DirectoryInfo.create([], 'VTODO')
53
+
54
+ Vpim::DirectoryInfo::Field.create_array(fields).each { |f| di.push_unique f }
55
+
56
+ new(di.to_a)
57
+ end
58
+
59
+ # The date and time that a to-do is expected to be completed, a Time.
60
+ def due
61
+ proptime 'DUE'
62
+ end
63
+
64
+ # The date and time that a to-do was actually completed, a Time.
65
+ def completed
66
+ proptime 'COMPLETED'
67
+ end
68
+
69
+ # The percentage completetion of the to-do, between 0 and 100. 0 means it hasn't
70
+ # started, 100 that it has been completed.
71
+ #
72
+ # TODO - the handling of this property isn't tied to either COMPLETED: or
73
+ # STATUS:, but perhaps it should be?
74
+ def percent_complete
75
+ propinteger 'PERCENT-COMPLETE'
76
+ end
77
+
78
+ end
79
+
80
+ end
81
+ end
82
+
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: vpim
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.323"
7
- date: 2006-03-20 00:00:00 -08:00
6
+ version: "0.357"
7
+ date: 2006-03-31 00:00:00 -08:00
8
8
  summary: a library to manipulate vCards and iCalendars
9
9
  require_paths:
10
10
  - lib
@@ -29,6 +29,8 @@ authors:
29
29
  - Sam Roberts
30
30
  files:
31
31
  - lib/vpim.rb
32
+ - lib/vpim/address.rb
33
+ - lib/vpim/attachment.rb
32
34
  - lib/vpim/date.rb
33
35
  - lib/vpim/dirinfo.rb
34
36
  - lib/vpim/duration.rb
@@ -41,12 +43,15 @@ files:
41
43
  - lib/vpim/vcard.rb
42
44
  - lib/vpim/version.rb
43
45
  - lib/vpim/vevent.rb
46
+ - lib/vpim/vjournal.rb
44
47
  - lib/vpim/vpim.rb
48
+ - lib/vpim/vtodo.rb
45
49
  - lib/vpim/maker/vcard.rb
46
50
  - lib/vpim/property/base.rb
47
51
  - lib/vpim/property/common.rb
48
52
  - lib/vpim/property/location.rb
49
53
  - lib/vpim/property/priority.rb
54
+ - lib/vpim/property/recurrence.rb
50
55
  - lib/vpim/property/resources.rb
51
56
  test_files: []
52
57