icalendar-recurrence 1.1.2 → 1.1.3
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/.gitignore +2 -1
- data/.travis.yml +4 -5
- data/icalendar-recurrence.gemspec +1 -1
- data/lib/icalendar/recurrence/event_extensions.rb +3 -3
- data/lib/icalendar/recurrence/schedule.rb +7 -6
- data/lib/icalendar/recurrence/version.rb +1 -1
- data/spec/lib/recurrence_spec.rb +26 -4
- data/spec/lib/schedule_spec.rb +9 -1
- data/spec/support/fixtures/multiple_exception_event.ics +20 -0
- data/spec/support/fixtures/multiple_exception_multiple_line_event.ics +22 -0
- data/spec/support/fixtures/week_long_event.ics +23 -0
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea618af19f9205cd550cdfcdd8838cc58f07ba60
|
4
|
+
data.tar.gz: ba7cfe8c164538af1dd10c2b9153f7b9455bc11c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 220f7c2227eda41a360182574d44187dbb45398534a84b743b7a889d664e40305d561c13f9e65f5248cf43682b0d65c917e9398d2faba82c2c332a8be1003f22
|
7
|
+
data.tar.gz: 626d4958cbe0a0abf12e35b8c67e5559c0314649ec8dafdf9f1296431f1d3933f1b9d0d87cbc4364067c116dd0e4f883f8c3dbae3abdf1e35b9897b0469eb54a
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
20
|
spec.add_runtime_dependency 'icalendar', '~> 2.0'
|
21
|
-
spec.add_runtime_dependency 'ice_cube', '~> 0.
|
21
|
+
spec.add_runtime_dependency 'ice_cube', '~> 0.16'
|
22
22
|
|
23
23
|
spec.add_development_dependency 'activesupport', '~> 4.0'
|
24
24
|
spec.add_development_dependency 'awesome_print'
|
@@ -13,8 +13,8 @@ module Icalendar
|
|
13
13
|
dtend
|
14
14
|
end
|
15
15
|
|
16
|
-
def occurrences_between(begin_time, closing_time)
|
17
|
-
schedule.occurrences_between(begin_time, closing_time)
|
16
|
+
def occurrences_between(begin_time, closing_time, spans: false)
|
17
|
+
schedule.occurrences_between(begin_time, closing_time, spans: spans)
|
18
18
|
end
|
19
19
|
|
20
20
|
def schedule
|
@@ -33,4 +33,4 @@ module Icalendar
|
|
33
33
|
class Event
|
34
34
|
include Icalendar::Recurrence::EventExtensions
|
35
35
|
end
|
36
|
-
end
|
36
|
+
end
|
@@ -32,8 +32,8 @@ module Icalendar
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
def occurrences_between(begin_time, closing_time)
|
36
|
-
ice_cube_occurrences = ice_cube_schedule.occurrences_between(TimeUtil.to_time(begin_time), TimeUtil.to_time(closing_time))
|
35
|
+
def occurrences_between(begin_time, closing_time, spans: false)
|
36
|
+
ice_cube_occurrences = ice_cube_schedule.occurrences_between(TimeUtil.to_time(begin_time), TimeUtil.to_time(closing_time), spans: spans)
|
37
37
|
|
38
38
|
ice_cube_occurrences.map do |occurrence|
|
39
39
|
convert_ice_cube_occurrence(occurrence)
|
@@ -75,14 +75,15 @@ module Icalendar
|
|
75
75
|
schedule.add_recurrence_rule(ice_cube_recurrence_rule)
|
76
76
|
end
|
77
77
|
|
78
|
-
event.exdate.each do |
|
79
|
-
|
80
|
-
|
78
|
+
event.exdate.each do |exception_date_or_dates|
|
79
|
+
Array(exception_date_or_dates).each do |exception_date|
|
80
|
+
schedule.add_exception_time(TimeUtil.to_time(exception_date))
|
81
|
+
end
|
81
82
|
end
|
82
83
|
|
83
84
|
schedule
|
84
85
|
end
|
85
|
-
|
86
|
+
|
86
87
|
def convert_duration_to_seconds(ical_duration)
|
87
88
|
return 0 unless ical_duration
|
88
89
|
|
data/spec/lib/recurrence_spec.rb
CHANGED
@@ -52,9 +52,31 @@ describe "Event#occurrences_between" do
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
context "event repeating every thursday with multiple exceptions" do
|
56
|
+
context "exclusions are on a single line" do
|
57
|
+
let(:event) { example_event :multiple_exception } # has exclusions in array form
|
58
|
+
it "properly calculates recurrence, including exclusion dates" do
|
59
|
+
occurrences = event.occurrences_between(start_time, start_time + 1.months)
|
60
|
+
|
61
|
+
expect(occurrences.length).to eq(1)
|
62
|
+
expect(occurrences.first.start_time).to eq(Time.parse("2017-11-16 13:40:00 UTC"))
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context "exclusions are on multiple lines" do
|
67
|
+
let(:event) { example_event :multiple_exception_multiple_line } # has multiple single exclusions
|
68
|
+
it "properly calculates recurrence, including exclusion dates" do
|
69
|
+
occurrences = event.occurrences_between(start_time, start_time + 1.months)
|
70
|
+
|
71
|
+
expect(occurrences.length).to eq(1)
|
72
|
+
expect(occurrences.first.start_time).to eq(Time.parse("2017-11-16 13:40:00 UTC"))
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
55
77
|
context "event repeating bimonthly (DST example)" do
|
56
78
|
let(:event) { example_event :on_third_every_two_months }
|
57
|
-
|
79
|
+
|
58
80
|
it "occurs twice over 60 days" do
|
59
81
|
occurrences = event.occurrences_between(start_time, start_time + 60.days)
|
60
82
|
|
@@ -81,7 +103,7 @@ describe "Event#occurrences_between" do
|
|
81
103
|
|
82
104
|
it "occurrs 10 times over two weeks" do
|
83
105
|
occurrences = event.occurrences_between(start_time, start_time + 13.days)
|
84
|
-
|
106
|
+
|
85
107
|
expect(occurrences.length).to eq(10)
|
86
108
|
expect(occurrences.map(&:start_time)).to include(Time.parse("2014-01-10"))
|
87
109
|
expect(occurrences.map(&:start_time)).to_not include(Time.parse("2014-01-11"))
|
@@ -118,7 +140,7 @@ describe "Event#occurrences_between" do
|
|
118
140
|
|
119
141
|
context "event repeating on first saturday of month event" do
|
120
142
|
let(:event) { example_event :first_saturday_of_month }
|
121
|
-
|
143
|
+
|
122
144
|
it "occurs twice over two months" do
|
123
145
|
occurrences = event.occurrences_between(start_time, start_time + 55.days)
|
124
146
|
|
@@ -151,4 +173,4 @@ describe "Event#occurrences_between" do
|
|
151
173
|
expect(occurrences.first.start_time).to eq(Time.parse("20140114T180000Z"))
|
152
174
|
end
|
153
175
|
end
|
154
|
-
end
|
176
|
+
end
|
data/spec/lib/schedule_spec.rb
CHANGED
@@ -13,6 +13,14 @@ describe Icalendar::Recurrence::Schedule do
|
|
13
13
|
expect(example_occurrence).to respond_to :end_time
|
14
14
|
end
|
15
15
|
|
16
|
+
it "returns occurrences within range, including duration spanning #start_time " do
|
17
|
+
schedule = Schedule.new(example_event(:week_long))
|
18
|
+
occurrences = schedule.occurrences_between(Time.parse("2014-01-13T09:00:00-08:00"), Date.parse("2014-01-20"), spans: true)
|
19
|
+
|
20
|
+
expect(schedule.start_time).to eq(Time.parse("2014-01-13T08:00:00-08:00"))
|
21
|
+
expect(occurrences.count).to eq(7)
|
22
|
+
end
|
23
|
+
|
16
24
|
context "timezoned event" do
|
17
25
|
let(:example_occurrence) do
|
18
26
|
timezoned_event = example_event :first_saturday_of_month
|
@@ -20,7 +28,7 @@ describe Icalendar::Recurrence::Schedule do
|
|
20
28
|
example_occurrence = schedule.occurrences_between(Date.parse("2014-02-01"), Date.parse("2014-03-01")).first
|
21
29
|
end
|
22
30
|
|
23
|
-
it "
|
31
|
+
it "returns object that responds to #start_time and #end_time (timezoned example)" do
|
24
32
|
expect(example_occurrence).to respond_to :start_time
|
25
33
|
expect(example_occurrence).to respond_to :end_time
|
26
34
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
BEGIN:VCALENDAR
|
2
|
+
VERSION:2.0
|
3
|
+
CALSCALE:GREGORIAN
|
4
|
+
PRODID:-//Apple Inc.//Mac OS X 10.12.6//EN
|
5
|
+
BEGIN:VEVENT
|
6
|
+
UID:AA000000-AAAA-CCCC-DDDD-CC7176000000
|
7
|
+
DTSTART;TZID=Asia/Dubai:20171019T174000
|
8
|
+
DTEND;TZID=Asia/Dubai:20171019T181000
|
9
|
+
CREATED:20170830T130728Z
|
10
|
+
DTSTAMP:20171016T185512Z
|
11
|
+
EXDATE;TZID=Asia/Dubai:20171102T174000,20171026T174000,20171019T174000,20
|
12
|
+
171109T174000
|
13
|
+
LAST-MODIFIED:20171016T185511Z
|
14
|
+
RRULE:FREQ=WEEKLY;UNTIL=20171215T195959Z;BYDAY=TH
|
15
|
+
SEQUENCE:0
|
16
|
+
SUMMARY:Exception with timezone
|
17
|
+
TRANSP:OPAQUE
|
18
|
+
X-APPLE-TRAVEL-ADVISORY-BEHAVIOR:AUTOMATIC
|
19
|
+
END:VEVENT
|
20
|
+
END:VCALENDAR
|
@@ -0,0 +1,22 @@
|
|
1
|
+
BEGIN:VCALENDAR
|
2
|
+
VERSION:2.0
|
3
|
+
CALSCALE:GREGORIAN
|
4
|
+
PRODID:-//Apple Inc.//Mac OS X 10.12.6//EN
|
5
|
+
BEGIN:VEVENT
|
6
|
+
UID:AA000000-AAAA-CCCC-DDDD-CC7176000000
|
7
|
+
DTSTART;TZID=Asia/Dubai:20171019T174000
|
8
|
+
DTEND;TZID=Asia/Dubai:20171019T181000
|
9
|
+
CREATED:20170830T130728Z
|
10
|
+
DTSTAMP:20171016T185512Z
|
11
|
+
EXDATE;TZID=Asia/Dubai:20171102T174000
|
12
|
+
EXDATE;TZID=Asia/Dubai:20171026T174000
|
13
|
+
EXDATE;TZID=Asia/Dubai:20171019T174000
|
14
|
+
EXDATE;TZID=Asia/Dubai:20171109T174000
|
15
|
+
LAST-MODIFIED:20171016T185511Z
|
16
|
+
RRULE:FREQ=WEEKLY;UNTIL=20171215T195959Z;BYDAY=TH
|
17
|
+
SEQUENCE:0
|
18
|
+
SUMMARY:Exception with timezone
|
19
|
+
TRANSP:OPAQUE
|
20
|
+
X-APPLE-TRAVEL-ADVISORY-BEHAVIOR:AUTOMATIC
|
21
|
+
END:VEVENT
|
22
|
+
END:VCALENDAR
|
@@ -0,0 +1,23 @@
|
|
1
|
+
BEGIN:VCALENDAR
|
2
|
+
X-WR-CALNAME:Example Calendar
|
3
|
+
X-WR-CALID:f512e378-050c-4366-809a-ef471ce45b09:297138
|
4
|
+
PRODID:Zimbra-Calendar-Provider
|
5
|
+
VERSION:2.0
|
6
|
+
METHOD:PUBLISH
|
7
|
+
BEGIN:VEVENT
|
8
|
+
UID:28aad2ac-af09-44d0-b07d-6f49177c086f
|
9
|
+
RRULE:FREQ=DAILY;UNTIL=20140120T075959Z;INTERVAL=1
|
10
|
+
SUMMARY:All week\, then done
|
11
|
+
X-ALT-DESC;FMTTYPE=text/html:<html><body></body></html>
|
12
|
+
ORGANIZER;CN=Jordan Raine:mailto:jraine@sfu.ca
|
13
|
+
DTSTART;TZID="America/Los_Angeles":20140113T080000
|
14
|
+
DTEND;TZID="America/Los_Angeles":20140113T120000
|
15
|
+
STATUS:CONFIRMED
|
16
|
+
CLASS:PUBLIC
|
17
|
+
X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
|
18
|
+
TRANSP:OPAQUE
|
19
|
+
LAST-MODIFIED:20140117T200033Z
|
20
|
+
DTSTAMP:20140117T200033Z
|
21
|
+
SEQUENCE:0
|
22
|
+
END:VEVENT
|
23
|
+
END:VCALENDAR
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icalendar-recurrence
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Raine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: icalendar
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.16'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
40
|
+
version: '0.16'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activesupport
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -189,9 +189,12 @@ files:
|
|
189
189
|
- spec/support/fixtures/first_sunday_of_january_yearly_event.ics
|
190
190
|
- spec/support/fixtures/monday_until_friday_event.ics
|
191
191
|
- spec/support/fixtures/multi_day_weekly_event.ics
|
192
|
+
- spec/support/fixtures/multiple_exception_event.ics
|
193
|
+
- spec/support/fixtures/multiple_exception_multiple_line_event.ics
|
192
194
|
- spec/support/fixtures/on_third_every_two_months_event.ics
|
193
195
|
- spec/support/fixtures/one_day_a_month_for_three_months_event.ics
|
194
196
|
- spec/support/fixtures/utc_event.ics
|
197
|
+
- spec/support/fixtures/week_long_event.ics
|
195
198
|
- spec/support/fixtures/weekly_with_count_event.ics
|
196
199
|
- spec/support/helpers.rb
|
197
200
|
homepage: https://github.com/icalendar/icalendar-recurrence
|
@@ -214,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
217
|
version: '0'
|
215
218
|
requirements: []
|
216
219
|
rubyforge_project:
|
217
|
-
rubygems_version: 2.5.2
|
220
|
+
rubygems_version: 2.5.2.3
|
218
221
|
signing_key:
|
219
222
|
specification_version: 4
|
220
223
|
summary: Provides recurrence to icalendar gem.
|
@@ -234,8 +237,11 @@ test_files:
|
|
234
237
|
- spec/support/fixtures/first_sunday_of_january_yearly_event.ics
|
235
238
|
- spec/support/fixtures/monday_until_friday_event.ics
|
236
239
|
- spec/support/fixtures/multi_day_weekly_event.ics
|
240
|
+
- spec/support/fixtures/multiple_exception_event.ics
|
241
|
+
- spec/support/fixtures/multiple_exception_multiple_line_event.ics
|
237
242
|
- spec/support/fixtures/on_third_every_two_months_event.ics
|
238
243
|
- spec/support/fixtures/one_day_a_month_for_three_months_event.ics
|
239
244
|
- spec/support/fixtures/utc_event.ics
|
245
|
+
- spec/support/fixtures/week_long_event.ics
|
240
246
|
- spec/support/fixtures/weekly_with_count_event.ics
|
241
247
|
- spec/support/helpers.rb
|