icalendar 2.2.1 → 2.2.2

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: 64b02f2d89672803b2833812e128816a6fe5aba3
4
- data.tar.gz: 38d46d3ef98ed6cf283f25e4724134947327b648
3
+ metadata.gz: 144e7b7601ab22b7de6b32db6da271ca7f2e487d
4
+ data.tar.gz: 36fe6e7a0bc064ff6d989dbbc40b56a87c42508d
5
5
  SHA512:
6
- metadata.gz: 8fcbf5dfced73f2e73751f153af8a9daf8c8f78e439e01ee14edb3bdc29ea053f02613d8ba56773a0fac6fc2f173f002cf65cb0ef00340a162774540343aca55
7
- data.tar.gz: 6ddcb714caeed08fe016cd9b30e07f34c112ed1f7573435af1994537f64a7ad29e0c6cfc843789b8d2a28ed60710107570f0a996a6215ae1633d982f27308a61
6
+ metadata.gz: 053e06312ce27ff2b6e964396171c15b3808a4954f9dc42330d6febde5d0e5339144fe5521088f446db652fa6f12a61718f7585b1025f31f26ca21cd95f1cbef
7
+ data.tar.gz: 4a22eaa229789f42b8584a1a8bc707846ee4f24b0ee34851583fc8c0f2c2fdcbf4aacf34c4fdab9dc82183a64ca8cd51ed9b899837bf26a2cae5e8f54b6a5fd4
@@ -1,3 +1,7 @@
1
+ === 2.2.2 2014-12-27
2
+ * add a `has_#{component}?` method for testing if component exists - John Hope
3
+ * add documentation & tests for organizer attribute - Ben Walding
4
+
1
5
  === 2.2.1 2014-12-03
2
6
  * Prevent crashes when using ActiveSupport::TimeWithZone in multi-property DateTime fields - Danny (tdg5)
3
7
  * Ensure TimeWithZone is loaded before using, not just ActiveSupport - Jeremy Evans
data/README.md CHANGED
@@ -143,6 +143,18 @@ ALARMS
143
143
  # TRIGGER:-PT15M
144
144
  # END:VALARM
145
145
 
146
+ #### Checking for an Alarm ####
147
+
148
+ Calling the `event.alarm` method will create an alarm if one doesn't exist. To check if an event has an alarm use the `has_alarm?` method.
149
+
150
+ event.has_alarm?
151
+ # => false
152
+
153
+ event.alarm
154
+ # => #<Icalendar::Alarm ... >
155
+
156
+ event.has_alarm?
157
+ #=> true
146
158
 
147
159
  TIMEZONES
148
160
  ---
@@ -212,6 +224,8 @@ iCalendar has been tested and works with `tzinfo` versions 0.3 and 1.1
212
224
  e.dtend = Icalendar::Values::DateTime.new event_end, 'tzid' => tzid
213
225
  e.summary = "Meeting with the man."
214
226
  e.description = "Have a long lunch meeting and decide nothing..."
227
+ e.organizer = "mailto:jsmith@example.com"
228
+ e.organizer = Icalendar::Values::CalAddress.new("mailto:jsmith@example.com", cn: 'John Smith')
215
229
  end
216
230
 
217
231
 
@@ -43,6 +43,9 @@ ActiveSupport is required for TimeWithZone support, but not required for general
43
43
  # end tzinfo
44
44
 
45
45
  s.add_development_dependency 'activesupport', '~> 3.2'
46
+ # lock i18n to < 0.7 to maintain ruby 1.9.2 compatibility
47
+ s.add_development_dependency 'i18n', '< 0.7.0'
48
+
46
49
  s.add_development_dependency 'timecop', '~> 0.7.0'
47
50
  s.add_development_dependency 'rspec', '~> 2.14'
48
51
  s.add_development_dependency 'simplecov', '~> 0.8'
@@ -66,6 +66,7 @@ module Icalendar
66
66
  Component.new singular_name
67
67
  end
68
68
  end
69
+
69
70
  add_component c, &block
70
71
  end
71
72
 
@@ -76,6 +77,10 @@ module Icalendar
76
77
  define_method "add_#{singular_name}" do |c|
77
78
  send singular_name, c
78
79
  end
80
+
81
+ define_method "has_#{singular_name}?" do
82
+ !send(components).empty?
83
+ end
79
84
  end
80
85
  end
81
86
  end
@@ -1,5 +1,5 @@
1
1
  module Icalendar
2
2
 
3
- VERSION = '2.2.1'
3
+ VERSION = '2.2.2'
4
4
 
5
5
  end
@@ -102,6 +102,18 @@ describe Icalendar::Event do
102
102
  end
103
103
  end
104
104
 
105
+ describe '#has_alarm?' do
106
+ context 'without a set valarm' do
107
+ it { is_expected.not_to have_alarm }
108
+ end
109
+
110
+ context 'with a set valarm' do
111
+ before { subject.alarm }
112
+
113
+ it { is_expected.to have_alarm }
114
+ end
115
+ end
116
+
105
117
  describe '#to_ical' do
106
118
  before(:each) do
107
119
  subject.dtstart = "20131227T013000Z"
@@ -116,5 +128,23 @@ describe Icalendar::Event do
116
128
  it { expect(subject.to_ical).to include 'SUMMARY:My event\, my ical\, my test' }
117
129
  it { expect(subject.to_ical).to include 'X-CUSTOM-PROPERTY:customize' }
118
130
  it { expect(subject.to_ical).to include 'GEO:41.230896;-74.411774' }
131
+
132
+ context 'simple organizer' do
133
+ before :each do
134
+ subject.organizer = 'mailto:jsmith@example.com'
135
+ end
136
+
137
+ it { expect(subject.to_ical).to include 'ORGANIZER:mailto:jsmith@example.com' }
138
+ end
139
+
140
+ context 'complex organizer' do
141
+ before :each do
142
+ subject.organizer = Icalendar::Values::CalAddress.new("mailto:jsmith@example.com", cn: 'John Smith')
143
+ end
144
+
145
+ it { expect(subject.to_ical).to include 'ORGANIZER;CN=John Smith:mailto:jsmith@example.com' }
146
+ end
147
+
119
148
  end
149
+
120
150
  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: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Ahearn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-04 00:00:00.000000000 Z
11
+ date: 2014-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: i18n
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "<"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.7.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "<"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.7.0
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: timecop
85
99
  requirement: !ruby/object:Gem::Requirement