icalendar 1.4.4 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.txt +5 -0
- data/README.md +1 -0
- data/lib/icalendar/base.rb +1 -1
- data/lib/icalendar/component.rb +6 -4
- data/lib/icalendar/component/alarm.rb +9 -8
- data/lib/icalendar/parser.rb +12 -12
- data/test/test_component.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fac2f5451b7ca770f2ac6c7a821cde7019b243b0
|
|
4
|
+
data.tar.gz: 2e67f1b9d5f1e0194fc3a988674e18095947dc64
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f5d251b5bc4f461d7870a47b97f0b31ab7333e2cd7db214903b15275a9994f152f19330fe4a4a926c6c26a90d885c856f4ab9cebee55f6a3c1cdc488a044e6f0
|
|
7
|
+
data.tar.gz: 85137efbd0de1f1233f043dace763619e1332ba49a38a709da4a3c30243a7b10b9cc452bf47d5e13c78a214b95137aa200e7769b888c15998f6686c80deeac58
|
data/History.txt
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
=== 1.4.5 2013-11-14
|
|
2
|
+
* Fix Geo accessor methods - bouzuya
|
|
3
|
+
* Add ical_multiline_property :related_to for Alarm
|
|
4
|
+
* Allow using multi setters to append single values
|
|
5
|
+
|
|
1
6
|
=== 1.4.4 2013-11-05
|
|
2
7
|
* Allow user to handle TZInfo::AmbiguousTime error - David Bradford
|
|
3
8
|
* Better handling of multiple exdate and rdate values
|
data/README.md
CHANGED
|
@@ -2,6 +2,7 @@ iCalendar -- Internet calendaring, Ruby style
|
|
|
2
2
|
===
|
|
3
3
|
|
|
4
4
|
[](https://travis-ci.org/icalendar/icalendar)
|
|
5
|
+
[](https://codeclimate.com/github/icalendar/icalendar)
|
|
5
6
|
|
|
6
7
|
<http://github.com/icalendar/icalendar>
|
|
7
8
|
|
data/lib/icalendar/base.rb
CHANGED
data/lib/icalendar/component.rb
CHANGED
|
@@ -14,15 +14,17 @@ module Icalendar
|
|
|
14
14
|
class Geo < Icalendar::Base
|
|
15
15
|
attr_accessor :latitude, :longitude
|
|
16
16
|
alias :lat :latitude
|
|
17
|
+
alias :lat= :latitude=
|
|
17
18
|
alias :long :longitude
|
|
19
|
+
alias :long= :longitude=
|
|
18
20
|
|
|
19
21
|
def initialize(lat, long)
|
|
20
|
-
@
|
|
21
|
-
@
|
|
22
|
+
@latitude = lat
|
|
23
|
+
@longitude = long
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
def to_ical
|
|
25
|
-
"#{@
|
|
27
|
+
"#{@latitude.to_ical};#{@longitude.to_ical}"
|
|
26
28
|
end
|
|
27
29
|
end
|
|
28
30
|
|
|
@@ -345,7 +347,7 @@ module Icalendar
|
|
|
345
347
|
elsif a =~ /^[^"].*(?<!\\\\),.*[^"]$/
|
|
346
348
|
@properties["#{property}"] = a.split(/(?<!\\\\),/).to_ary
|
|
347
349
|
else
|
|
348
|
-
|
|
350
|
+
(@properties["#{property}"] ||= []) << a
|
|
349
351
|
end
|
|
350
352
|
end
|
|
351
353
|
code
|
|
@@ -5,26 +5,26 @@
|
|
|
5
5
|
under the same terms as the ruby language itself, see the file COPYING for
|
|
6
6
|
details.
|
|
7
7
|
=end
|
|
8
|
-
module Icalendar
|
|
8
|
+
module Icalendar
|
|
9
9
|
# An Alarm calendar component is a grouping of component
|
|
10
10
|
# properties that is a reminder or alarm for an event or a
|
|
11
11
|
# to-do. For example, it may be used to define a reminder for a
|
|
12
|
-
# pending Event or an overdue Todo.
|
|
12
|
+
# pending Event or an overdue Todo.
|
|
13
13
|
class Alarm < Component
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
# Single properties
|
|
16
16
|
ical_property :action
|
|
17
17
|
ical_property :description
|
|
18
18
|
ical_property :trigger
|
|
19
19
|
ical_property :summary
|
|
20
20
|
ical_property :uid
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
# Single but must appear together
|
|
23
23
|
ical_property :duration
|
|
24
24
|
ical_property :repeat
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
# Single and only occurring once
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
ical_property :created
|
|
29
29
|
ical_property :last_modified
|
|
30
30
|
ical_property :timestamp
|
|
@@ -34,11 +34,12 @@ module Icalendar
|
|
|
34
34
|
# Multi properties
|
|
35
35
|
ical_multiline_property :attendee, :attendee, :attendees
|
|
36
36
|
ical_multiline_property :attach, :attachment, :attachments
|
|
37
|
+
ical_multiline_property :related_to, :related_to, :related_to
|
|
37
38
|
|
|
38
39
|
def initialize()
|
|
39
40
|
super("VALARM")
|
|
40
|
-
|
|
41
|
-
# Almost everyone just wants to display so I make it the
|
|
41
|
+
|
|
42
|
+
# Almost everyone just wants to display so I make it the
|
|
42
43
|
# default so it works for most people right away...
|
|
43
44
|
action "DISPLAY"
|
|
44
45
|
end
|
data/lib/icalendar/parser.rb
CHANGED
|
@@ -12,7 +12,7 @@ require 'uri'
|
|
|
12
12
|
require 'stringio'
|
|
13
13
|
|
|
14
14
|
module Icalendar
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
def Icalendar.parse(src, single = false)
|
|
17
17
|
cals = Icalendar::Parser.new(src).parse
|
|
18
18
|
|
|
@@ -70,8 +70,8 @@ module Icalendar
|
|
|
70
70
|
def next_line
|
|
71
71
|
line = @prev_line
|
|
72
72
|
|
|
73
|
-
if line.nil?
|
|
74
|
-
return nil
|
|
73
|
+
if line.nil?
|
|
74
|
+
return nil
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
# Loop through until we get to a non-continuation line...
|
|
@@ -102,7 +102,7 @@ module Icalendar
|
|
|
102
102
|
|
|
103
103
|
@@logger.debug "parsing..."
|
|
104
104
|
# Outer loop for Calendar objects
|
|
105
|
-
while (line = next_line)
|
|
105
|
+
while (line = next_line)
|
|
106
106
|
fields = parse_line(line)
|
|
107
107
|
|
|
108
108
|
# Just iterate through until we find the beginning of a calendar object
|
|
@@ -120,7 +120,7 @@ module Icalendar
|
|
|
120
120
|
|
|
121
121
|
# Parse a single VCALENDAR object
|
|
122
122
|
# -- This should consist of the PRODID, VERSION, option METHOD & CALSCALE,
|
|
123
|
-
# and then one or more calendar components: VEVENT, VTODO, VJOURNAL,
|
|
123
|
+
# and then one or more calendar components: VEVENT, VTODO, VJOURNAL,
|
|
124
124
|
# VFREEBUSY, VTIMEZONE
|
|
125
125
|
def parse_component(component = Calendar.new)
|
|
126
126
|
@@logger.debug "parsing new component..."
|
|
@@ -190,7 +190,7 @@ module Icalendar
|
|
|
190
190
|
raise(UnknownPropertyMethod, "Unknown property type: #{name}") if strict
|
|
191
191
|
end
|
|
192
192
|
end
|
|
193
|
-
end
|
|
193
|
+
end
|
|
194
194
|
end
|
|
195
195
|
|
|
196
196
|
component
|
|
@@ -204,7 +204,7 @@ module Icalendar
|
|
|
204
204
|
|
|
205
205
|
# Contentline
|
|
206
206
|
LINE = "(#{NAME})((?:(?:[^:]*?)(?:#{QSTR})(?:[^:]*?))+|(?:[^:]*))\:(.*)"
|
|
207
|
-
|
|
207
|
+
|
|
208
208
|
# *<Any character except CTLs, DQUOTE, ";", ":", ",">
|
|
209
209
|
PTEXT = '[^";:,]*'
|
|
210
210
|
|
|
@@ -266,7 +266,7 @@ module Icalendar
|
|
|
266
266
|
{:name => name, :value => value, :params => params}
|
|
267
267
|
end
|
|
268
268
|
|
|
269
|
-
## Following is a collection of parsing functions for various
|
|
269
|
+
## Following is a collection of parsing functions for various
|
|
270
270
|
## icalendar property value data types... First we setup
|
|
271
271
|
## a hash with property names pointing to methods...
|
|
272
272
|
def setup_parsers
|
|
@@ -305,12 +305,12 @@ module Icalendar
|
|
|
305
305
|
# This is a URI by default, and if its not a valid URI
|
|
306
306
|
# it will be returned as a string which works for binary data
|
|
307
307
|
# the other possible type.
|
|
308
|
-
@parsers["ATTACH"] = m
|
|
308
|
+
@parsers["ATTACH"] = m
|
|
309
309
|
|
|
310
310
|
# GEO
|
|
311
311
|
m = self.method(:parse_geo)
|
|
312
312
|
@parsers["GEO"] = m
|
|
313
|
-
|
|
313
|
+
|
|
314
314
|
#RECUR
|
|
315
315
|
m = self.method(:parse_recur)
|
|
316
316
|
@parsers["RRULE"] = m
|
|
@@ -378,7 +378,7 @@ module Icalendar
|
|
|
378
378
|
end
|
|
379
379
|
|
|
380
380
|
# Durations
|
|
381
|
-
# TODO: Need to figure out the best way to represent durations
|
|
381
|
+
# TODO: Need to figure out the best way to represent durations
|
|
382
382
|
# so just returning string for now.
|
|
383
383
|
def parse_duration(name, params, value)
|
|
384
384
|
value
|
|
@@ -417,7 +417,7 @@ module Icalendar
|
|
|
417
417
|
# if the parsing fails return the string
|
|
418
418
|
def parse_geo(name, params, value)
|
|
419
419
|
strloc = value.split(';')
|
|
420
|
-
if strloc.size != 2
|
|
420
|
+
if strloc.size != 2
|
|
421
421
|
return value
|
|
422
422
|
end
|
|
423
423
|
|
data/test/test_component.rb
CHANGED
|
@@ -52,6 +52,10 @@ class TestComponent < Test::Unit::TestCase
|
|
|
52
52
|
@event.remove_comment "c1"
|
|
53
53
|
assert_equal(["c2"], @event.comments)
|
|
54
54
|
|
|
55
|
+
# Add using multi setter
|
|
56
|
+
@event.comments "c3"
|
|
57
|
+
assert_equal(["c2","c3"], @event.comments)
|
|
58
|
+
|
|
55
59
|
# Set & get whole array
|
|
56
60
|
foo = ["as", "df"]
|
|
57
61
|
@event.comments = foo
|
|
@@ -78,4 +82,21 @@ class TestComponent < Test::Unit::TestCase
|
|
|
78
82
|
component = Icalendar::Component.new('name')
|
|
79
83
|
assert component.respond_to?(:x_foobar)
|
|
80
84
|
end
|
|
85
|
+
|
|
86
|
+
def test_geo_constructor
|
|
87
|
+
geo = Icalendar::Geo.new(1, 2)
|
|
88
|
+
assert_equal(1, geo.latitude)
|
|
89
|
+
assert_equal(1, geo.lat)
|
|
90
|
+
assert_equal(2, geo.longitude)
|
|
91
|
+
assert_equal(2, geo.long)
|
|
92
|
+
assert_equal('1;2', geo.to_ical)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def test_geo_lat_and_long_setter
|
|
96
|
+
geo = Icalendar::Geo.new(1, 2)
|
|
97
|
+
geo.lat = 3
|
|
98
|
+
geo.long = 4
|
|
99
|
+
assert_equal(3, geo.lat)
|
|
100
|
+
assert_equal(4, geo.long)
|
|
101
|
+
end
|
|
81
102
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: icalendar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.4.
|
|
4
|
+
version: 1.4.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Ahearn
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-11-
|
|
11
|
+
date: 2013-11-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|