icalendar-recurrence 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a2ae1e548eb6c46fa2693f5951f3528e99b8abb
4
- data.tar.gz: 0aaecc9ba2d1c7aa887f820d9dfe94348c472f28
3
+ metadata.gz: ea618af19f9205cd550cdfcdd8838cc58f07ba60
4
+ data.tar.gz: ba7cfe8c164538af1dd10c2b9153f7b9455bc11c
5
5
  SHA512:
6
- metadata.gz: f28af3cd81e7afde47cee2c16032ad1c6eee436064081fb3280355007ab0e063c60dceb2a7383e4c11df26ca347b6487bde78670ac1c34f508fef7a538178fdd
7
- data.tar.gz: ff86db8785368cd0d38f84f06dc5c371298eeb6b642ce8331d3b5bd43645151eaba17475d1b25e92aedb16b8604842c10689ba571e0f40bed7a770ea28c74ccf
6
+ metadata.gz: 220f7c2227eda41a360182574d44187dbb45398534a84b743b7a889d664e40305d561c13f9e65f5248cf43682b0d65c917e9398d2faba82c2c332a8be1003f22
7
+ data.tar.gz: 626d4958cbe0a0abf12e35b8c67e5559c0314649ec8dafdf9f1296431f1d3933f1b9d0d87cbc4364067c116dd0e4f883f8c3dbae3abdf1e35b9897b0469eb54a
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  *.gem
2
2
  *.rbc
3
+ .DS_Store
3
4
  .bundle
4
5
  .config
5
6
  .yardoc
@@ -14,4 +15,4 @@ rdoc
14
15
  spec/reports
15
16
  test/tmp
16
17
  test/version_tmp
17
- tmp
18
+ tmp
@@ -1,9 +1,8 @@
1
1
  language: ruby
2
2
  sudo: false
3
3
  rvm:
4
- - 2.4.1
5
- - 2.3.4
6
- - 2.1.7
7
- - 2.0.0
8
- - 1.9.3
4
+ - 2.5
5
+ - 2.4
6
+ - 2.1
7
+ - 2.0
9
8
  script: bundle exec rspec
@@ -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.13'
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 |exception_date|
79
- exception_date = Time.parse(exception_date) if exception_date.is_a?(String)
80
- schedule.add_exception_time(TimeUtil.to_time(exception_date))
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
 
@@ -1,5 +1,5 @@
1
1
  module Icalendar
2
2
  module Recurrence
3
- VERSION = "1.1.2"
3
+ VERSION = "1.1.3"
4
4
  end
5
5
  end
@@ -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
@@ -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 "#occurrences_between return object that responds to #start_time and #end_time (timezoned example)" do
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.2
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: 2017-04-20 00:00:00.000000000 Z
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.13'
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.13'
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