icalendar 2.7.1 → 2.8.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fbeadc87a1316894e02896fd63e7f7644a1ab5bf3a542b0d5a02c59aabf2d603
4
- data.tar.gz: 3aaf09d7984fed57644d091fa76285084d9fbf3568e6078939e7887d6f44f50a
3
+ metadata.gz: becd9ceba3342d0b602f1bb8a33858fb2176ceafd457a0fbca76d24ff7800dc7
4
+ data.tar.gz: f11054752ca18d026b1339e936ab30d4f1ff61219ecfd94d3f913b3de6b14106
5
5
  SHA512:
6
- metadata.gz: e6134ff7d12c820d7ee10a316108c1d7a9db274cccd366b93a49fa491931038edd78eb37789a24962cc6370c83fd34d67508dd24b574e8d1fa235e815c1fa22d
7
- data.tar.gz: 0bad8ab7548493a133686dab3a6d36a58aeecddb8642da83cef5a2184d0d08e97dc59307fc6fdd9574935319044ccb5ffa50f9c936aa60e5637a2430e78eb446
6
+ metadata.gz: 8262dd28d571778ecc7dd638d6df2a44e4c26bea2221183d82a644c777d100a75027c83ac83fd53c801d43cd75b9521be104111900d6653119a0593a281b8203
7
+ data.tar.gz: 1dea941db6e27188b9ab0d769a0df2335fdc2bc492a4ca6339a5e4a90e0d91f9821282aaed13b2cc4f8a4921e24a3d20f14aa34fea97c50c6326d3a1dc29f3cc
@@ -0,0 +1,32 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+ pull_request:
9
+ branches:
10
+ - main
11
+ - master
12
+
13
+ jobs:
14
+ build:
15
+ runs-on: ubuntu-latest
16
+
17
+ strategy:
18
+ matrix:
19
+ ruby:
20
+ - 2.7.6
21
+ - 3.0.4
22
+ - 3.1.2
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby }}
30
+ bundler-cache: true
31
+ - name: Run rspec tests
32
+ run: bundle exec rake spec
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ === 2.8.0 2022-07-10
2
+ * Fix compatibility with ActiveSupport 7 - Pat Allan
3
+ * Set default action of "DISPLAY" on alarms - Rikson
4
+ * Add license information to gemspec - Robert Reiz
5
+ * Support RFC7986 properties - Daniele Frisanco
6
+
1
7
  === 2.7.1 2021-03-14
2
8
  * Recover from bad line-wrapping code that splits in the middle of Unicode code points
3
9
  * Add a verbose option to the Parser to quiet some of the chattier log entries
data/icalendar.gemspec CHANGED
@@ -6,6 +6,7 @@ Gem::Specification.new do |s|
6
6
 
7
7
  s.name = "icalendar"
8
8
  s.version = Icalendar::VERSION
9
+ s.licenses = ['BSD-2-Clause', 'GPL-3.0-only', 'icalendar']
9
10
 
10
11
  s.homepage = "https://github.com/icalendar/icalendar"
11
12
  s.platform = Gem::Platform::RUBY
@@ -22,6 +22,7 @@ module Icalendar
22
22
 
23
23
  def initialize
24
24
  super 'alarm'
25
+ self.action = 'DISPLAY'
25
26
  end
26
27
 
27
28
  def valid?(strict = false)
@@ -5,6 +5,16 @@ module Icalendar
5
5
  required_property :prodid
6
6
  optional_single_property :calscale
7
7
  optional_single_property :ip_method
8
+ optional_property :ip_name
9
+ optional_property :description
10
+ optional_single_property :uid
11
+ optional_single_property :last_modified, Icalendar::Values::DateTime, true
12
+ optional_single_property :url, Icalendar::Values::Uri, true
13
+ optional_property :categories
14
+ optional_single_property :refresh_interval, Icalendar::Values::Duration, true
15
+ optional_single_property :source, Icalendar::Values::Uri, true
16
+ optional_single_property :color
17
+ optional_property :image, Icalendar::Values::Uri, false, true
8
18
 
9
19
  component :timezone, :tzid
10
20
  component :event
@@ -12,6 +12,7 @@ module Icalendar
12
12
  mutually_exclusive_properties :dtend, :duration
13
13
 
14
14
  optional_single_property :ip_class
15
+ optional_single_property :color
15
16
  optional_single_property :created, Icalendar::Values::DateTime
16
17
  optional_single_property :description
17
18
  optional_single_property :geo, Icalendar::Values::Float
@@ -37,6 +38,8 @@ module Icalendar
37
38
  optional_property :related_to
38
39
  optional_property :resources
39
40
  optional_property :rdate, Icalendar::Values::DateTime
41
+ optional_property :conference, Icalendar::Values::Uri, false, true
42
+ optional_property :image, Icalendar::Values::Uri, false, true
40
43
 
41
44
  component :alarm, false
42
45
 
@@ -104,29 +104,29 @@ module Icalendar
104
104
  def required_property(prop, klass = Icalendar::Values::Text, validator = nil)
105
105
  validator ||= ->(component, value) { !value.nil? }
106
106
  self.required_properties[prop] = validator
107
- single_property prop, klass
107
+ single_property prop, klass, false
108
108
  end
109
109
 
110
110
  def required_multi_property(prop, klass = Icalendar::Values::Text, validator = nil)
111
111
  validator ||= ->(component, value) { !value.compact.empty? }
112
112
  self.required_properties[prop] = validator
113
- multi_property prop, klass
113
+ multi_property prop, klass, false
114
114
  end
115
115
 
116
- def optional_single_property(prop, klass = Icalendar::Values::Text)
117
- single_property prop, klass
116
+ def optional_single_property(prop, klass = Icalendar::Values::Text, new_property = false)
117
+ single_property prop, klass, new_property
118
118
  end
119
119
 
120
120
  def mutually_exclusive_properties(*properties)
121
121
  self.mutex_properties << properties
122
122
  end
123
123
 
124
- def optional_property(prop, klass = Icalendar::Values::Text, suggested_single = false)
124
+ def optional_property(prop, klass = Icalendar::Values::Text, suggested_single = false, new_property = false)
125
125
  self.suggested_single_properties << prop if suggested_single
126
- multi_property prop, klass
126
+ multi_property prop, klass, new_property
127
127
  end
128
128
 
129
- def single_property(prop, klass)
129
+ def single_property(prop, klass, new_property)
130
130
  self.single_properties << prop.to_s
131
131
  self.default_property_types[prop.to_s] = klass
132
132
 
@@ -135,17 +135,17 @@ module Icalendar
135
135
  end
136
136
 
137
137
  define_method "#{prop}=" do |value|
138
- instance_variable_set "@#{prop}", map_property_value(value, klass, false)
138
+ instance_variable_set "@#{prop}", map_property_value(value, klass, false, new_property)
139
139
  end
140
140
  end
141
141
 
142
- def multi_property(prop, klass)
142
+ def multi_property(prop, klass, new_property)
143
143
  self.multiple_properties << prop.to_s
144
144
  self.default_property_types[prop.to_s] = klass
145
145
  property_var = "@#{prop}"
146
146
 
147
147
  define_method "#{prop}=" do |value|
148
- mapped = map_property_value value, klass, true
148
+ mapped = map_property_value value, klass, true, new_property
149
149
  if mapped.is_a? Icalendar::Values::Array
150
150
  instance_variable_set property_var, mapped.to_a.compact
151
151
  else
@@ -162,20 +162,24 @@ module Icalendar
162
162
  end
163
163
 
164
164
  define_method "append_#{prop}" do |value|
165
- send(prop) << map_property_value(value, klass, true)
165
+ send(prop) << map_property_value(value, klass, true, new_property)
166
166
  end
167
167
  end
168
168
  end
169
169
 
170
170
  private
171
171
 
172
- def map_property_value(value, klass, multi_valued)
172
+ def map_property_value(value, klass, multi_valued, new_property)
173
+ params = {}
174
+ if new_property
175
+ params.merge!('VALUE': klass.value_type)
176
+ end
173
177
  if value.nil? || value.is_a?(Icalendar::Value)
174
178
  value
175
179
  elsif value.is_a? ::Array
176
- Icalendar::Values::Array.new value, klass, {}, {delimiter: (multi_valued ? ',' : ';')}
180
+ Icalendar::Values::Array.new value, klass, params, {delimiter: (multi_valued ? ',' : ';')}
177
181
  else
178
- klass.new value
182
+ klass.new value, params
179
183
  end
180
184
  end
181
185
 
@@ -6,6 +6,7 @@ module Icalendar
6
6
  required_property :uid
7
7
 
8
8
  optional_single_property :ip_class
9
+ optional_single_property :color
9
10
  optional_single_property :created, Icalendar::Values::DateTime
10
11
  optional_single_property :dtstart, Icalendar::Values::DateTime
11
12
  optional_single_property :last_modified, Icalendar::Values::DateTime
@@ -27,6 +28,7 @@ module Icalendar
27
28
  optional_property :request_status
28
29
  optional_property :related_to
29
30
  optional_property :rdate, Icalendar::Values::DateTime
31
+ optional_property :image, Icalendar::Values::Uri, false, true
30
32
 
31
33
  def initialize
32
34
  super 'journal'
@@ -50,7 +50,7 @@ module Icalendar
50
50
 
51
51
  def parse_property(component, fields = nil)
52
52
  fields = next_fields if fields.nil?
53
- prop_name = %w(class method).include?(fields[:name]) ? "ip_#{fields[:name]}" : fields[:name]
53
+ prop_name = %w(class method name).include?(fields[:name]) ? "ip_#{fields[:name]}" : fields[:name]
54
54
  multi_property = component.class.multiple_properties.include? prop_name
55
55
  prop_value = wrap_property_value component, fields, multi_property
56
56
  begin
@@ -12,6 +12,7 @@ module Icalendar
12
12
  mutually_exclusive_properties :due, :duration
13
13
 
14
14
  optional_single_property :ip_class
15
+ optional_single_property :color
15
16
  optional_single_property :completed, Icalendar::Values::DateTime
16
17
  optional_single_property :created, Icalendar::Values::DateTime
17
18
  optional_single_property :description
@@ -38,6 +39,8 @@ module Icalendar
38
39
  optional_property :related_to
39
40
  optional_property :resources
40
41
  optional_property :rdate, Icalendar::Values::DateTime
42
+ optional_property :conference, Icalendar::Values::Uri, false, true
43
+ optional_property :image, Icalendar::Values::Uri, false, true
41
44
 
42
45
  component :alarm, false
43
46
 
@@ -49,4 +52,4 @@ module Icalendar
49
52
 
50
53
  end
51
54
 
52
- end
55
+ end
@@ -52,7 +52,6 @@ module Icalendar
52
52
  def needs_value_type?(default_type)
53
53
  value.first.class != default_type
54
54
  end
55
-
56
55
  end
57
56
 
58
57
  end
@@ -6,6 +6,12 @@ begin
6
6
  if defined?(ActiveSupport::TimeWithZone)
7
7
  require 'icalendar/values/active_support_time_with_zone_adapter'
8
8
  end
9
+ rescue NameError
10
+ # ActiveSupport v7+ needs the base require to be run first before loading
11
+ # specific parts of it.
12
+ # https://guides.rubyonrails.org/active_support_core_extensions.html#stand-alone-active-support
13
+ require 'active_support'
14
+ retry
9
15
  rescue LoadError
10
16
  # tis ok, just a bit less fancy
11
17
  end
@@ -1,5 +1,5 @@
1
1
  module Icalendar
2
2
 
3
- VERSION = '2.7.1'
3
+ VERSION = '2.8.0'
4
4
 
5
5
  end
data/spec/alarm_spec.rb CHANGED
@@ -6,14 +6,15 @@ describe Icalendar::Alarm do
6
6
  describe '#valid?' do
7
7
  subject do
8
8
  described_class.new.tap do |a|
9
- a.action = 'AUDIO'
10
9
  a.trigger = Icalendar::Values::DateTime.new(Time.now.utc)
11
10
  end
12
11
  end
13
12
  context 'neither duration or repeat is set' do
13
+ before(:each) { subject.action = 'AUDIO' }
14
14
  it { should be_valid }
15
15
  end
16
16
  context 'both duration and repeat are set' do
17
+ before(:each) { subject.action = 'AUDIO' }
17
18
  before(:each) do
18
19
  subject.duration = 'PT15M'
19
20
  subject.repeat = 4
@@ -29,8 +30,12 @@ describe Icalendar::Alarm do
29
30
  it { should_not be_valid }
30
31
  end
31
32
 
33
+ context 'DISPLAY is set as default action' do
34
+ it 'must be DISPLAY' do
35
+ expect(subject.action).to eq 'DISPLAY'
36
+ end
37
+ end
32
38
  context 'display action' do
33
- before(:each) { subject.action = 'DISPLAY' }
34
39
  it 'requires description' do
35
40
  expect(subject).to_not be_valid
36
41
  subject.description = 'Display Text'
@@ -123,6 +123,16 @@ describe Icalendar::Calendar do
123
123
  describe '#to_ical' do
124
124
  before(:each) do
125
125
  Timecop.freeze DateTime.new(2013, 12, 26, 5, 0, 0, '+0000')
126
+ subject.ip_name = 'Company Vacation Days'
127
+ subject.description = 'The description'
128
+ subject.last_modified = "20140101T000000Z"
129
+ subject.url = 'https://example.com'
130
+ subject.color = 'red'
131
+ subject.image = 'https://example.com/image.png'
132
+ subject.uid = '5FC53010-1267-4F8E-BC28-1D7AE55A7C99'
133
+ subject.categories = 'MEETING'
134
+ subject.refresh_interval = 'P1W'
135
+ subject.source = 'https://example.com/holidays.ics'
126
136
  subject.event do |e|
127
137
  e.summary = 'An event'
128
138
  e.dtstart = "20140101T000000Z"
@@ -145,6 +155,15 @@ BEGIN:VCALENDAR
145
155
  VERSION:2.0
146
156
  PRODID:icalendar-ruby
147
157
  CALSCALE:GREGORIAN
158
+ LAST-MODIFIED;VALUE=DATE-TIME:20140101T000000Z
159
+ URL;VALUE=URI:https://example.com
160
+ REFRESH-INTERVAL;VALUE=DURATION:P1W
161
+ SOURCE;VALUE=URI:https://example.com/holidays.ics
162
+ COLOR:red
163
+ NAME:Company Vacation Days
164
+ DESCRIPTION:The description
165
+ CATEGORIES:MEETING
166
+ IMAGE;VALUE=URI:https://example.com/image.png
148
167
  BEGIN:VEVENT
149
168
  DTSTAMP:20131226T050000Z
150
169
  DTSTART:20140101T000000Z
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: 2.7.1
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Ahearn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-15 00:00:00.000000000 Z
11
+ date: 2022-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ice_cube
@@ -160,9 +160,9 @@ executables: []
160
160
  extensions: []
161
161
  extra_rdoc_files: []
162
162
  files:
163
+ - ".github/workflows/main.yml"
163
164
  - ".gitignore"
164
165
  - ".rspec"
165
- - ".travis.yml"
166
166
  - Gemfile
167
167
  - History.txt
168
168
  - LICENSE
@@ -243,7 +243,10 @@ files:
243
243
  - spec/values/text_spec.rb
244
244
  - spec/values/utc_offset_spec.rb
245
245
  homepage: https://github.com/icalendar/icalendar
246
- licenses: []
246
+ licenses:
247
+ - BSD-2-Clause
248
+ - GPL-3.0-only
249
+ - icalendar
247
250
  metadata: {}
248
251
  post_install_message: 'ActiveSupport is required for TimeWithZone support, but not
249
252
  required for general use.
@@ -263,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
263
266
  - !ruby/object:Gem::Version
264
267
  version: '0'
265
268
  requirements: []
266
- rubygems_version: 3.2.11
269
+ rubygems_version: 3.3.7
267
270
  signing_key:
268
271
  specification_version: 4
269
272
  summary: A ruby implementation of the iCalendar specification (RFC-5545).
data/.travis.yml DELETED
@@ -1,17 +0,0 @@
1
- sudo: false
2
- before_install:
3
- - gem install bundler
4
- language: ruby
5
- rvm:
6
- - 2.7
7
- - 2.6
8
- - 2.5
9
- - jruby-19mode
10
- - ruby-head
11
- - jruby-head
12
- - truffleruby-head
13
- matrix:
14
- allow_failures:
15
- - rvm: ruby-head
16
- - rvm: jruby-head
17
- script: bundle exec rake spec