ical_importer 0.0.16 → 0.0.17

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ical_importer (0.0.16)
4
+ ical_importer (0.0.17)
5
5
  activesupport (~> 3.0.15)
6
6
  i18n
7
7
  ri_cal
@@ -1,6 +1,6 @@
1
1
  module IcalImporter
2
2
  class Parser
3
- attr_reader :feed, :bare_feed, :url
3
+ attr_reader :feed, :bare_feed, :url, :timezone
4
4
  attr_accessor :timeout
5
5
 
6
6
  DEFAULT_TIMEOUT = 8
@@ -22,6 +22,7 @@ module IcalImporter
22
22
  # I know, I'm dirty, fix this to log to a config'd log
23
23
  end
24
24
  end
25
+ @timezone = get_timezone
25
26
  end
26
27
 
27
28
  def should_parse?
@@ -55,6 +56,12 @@ module IcalImporter
55
56
 
56
57
  private
57
58
 
59
+ def get_timezone
60
+ if feed.present? && feed.first.x_properties["X-WR-TIMEZONE"].present?
61
+ feed.first.x_properties["X-WR-TIMEZONE"].first.value
62
+ end
63
+ end
64
+
58
65
  def tap_and_each(list)
59
66
  list.tap do |r|
60
67
  r.each do |event|
@@ -1,3 +1,3 @@
1
1
  module IcalImporter
2
- VERSION = '0.0.16'
2
+ VERSION = '0.0.17'
3
3
  end
@@ -98,6 +98,24 @@ module IcalImporter
98
98
  end
99
99
  end
100
100
 
101
+ describe "#get_timezone" do
102
+ it "finds the feed's timezone out of the x properties" do
103
+ @value = stub
104
+ @value.should_receive(:value)
105
+ subject.stub :feed => [stub(x_properties: { "X-WR-TIMEZONE" => [@value] })]
106
+ subject.send(:get_timezone)
107
+ end
108
+
109
+ it "fails silently if no feed exists" do
110
+ subject.send(:get_timezone).should == nil
111
+ end
112
+
113
+ it "returns nil if no timezone x property exists" do
114
+ subject.stub :feed => [stub(x_properties: { "X-WR-DERPHERP" => [@value] })]
115
+ subject.send(:get_timezone).should be_nil
116
+ end
117
+ end
118
+
101
119
  describe "#open_ical" do
102
120
  it 'cleans up and tries to open an HTTP URL' do
103
121
  subject.stub :open => bare_stuff
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ical_importer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-11 00:00:00.000000000 Z
12
+ date: 2012-10-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -159,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  segments:
161
161
  - 0
162
- hash: 1818151322400970214
162
+ hash: 3426861661267830215
163
163
  required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  none: false
165
165
  requirements:
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  version: '0'
169
169
  segments:
170
170
  - 0
171
- hash: 1818151322400970214
171
+ hash: 3426861661267830215
172
172
  requirements: []
173
173
  rubyforge_project:
174
174
  rubygems_version: 1.8.24