ical_importer 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ical_importer (0.0.4)
4
+ ical_importer (0.0.5)
5
5
  activesupport (~> 3.0.15)
6
6
  i18n
7
7
  ri_cal
@@ -7,7 +7,11 @@ module IcalImporter
7
7
  @bare_feed = open_ical
8
8
  if should_parse?
9
9
  @bare_feed.pos = 0
10
- @feed = RiCal.parse @bare_feed
10
+ begin
11
+ @feed = RiCal.parse @bare_feed
12
+ rescue
13
+ # I know, I'm dirty, fix this to log to a config'd log
14
+ end
11
15
  end
12
16
  end
13
17
 
@@ -22,6 +22,7 @@ module IcalImporter
22
22
  private
23
23
 
24
24
  def build_new_local_event(remote_event)
25
+ remote_event = RemoteEvent.new remote_event
25
26
  LocalEvent.new({
26
27
  :uid => remote_event.uid,
27
28
  :title => remote_event.summary,
@@ -2,7 +2,7 @@ module IcalImporter
2
2
  class RemoteEvent
3
3
  attr_accessor :event, :utc
4
4
  alias :utc? :utc
5
- delegate :description, :recurs?, :rrule_property, :exdate, :to => :event
5
+ delegate :summary, :location, :recurrence_id, :description, :recurs?, :rrule_property, :exdate, :to => :event
6
6
 
7
7
  def initialize(event)
8
8
  @event = event
@@ -77,7 +77,7 @@ module IcalImporter
77
77
  end
78
78
  end
79
79
  # recurrence X times is probably broken - we can select multiple times in a week
80
- @local_event.recur_end_date = (frequency_template / remote_days.length).weeks if @rrule.bounded?.is_a? Fixnum # convert X times to a date
80
+ @local_event.recur_end_date = @local_event.start_date_time + ((@rrule.bounded? * @rrule.interval - 1) / remote_days.length).weeks if @rrule.bounded?.is_a?(Fixnum)
81
81
  when "MONTHLY"
82
82
  @local_event.recur_month_repeat_by = (@rrule.to_ical =~ /BYDAY/) ? "day_of_week" : "day_of_month"
83
83
  @local_event.recur_end_date = frequency_template.months if @rrule.bounded?.is_a? Fixnum # convert X times to a date
@@ -87,7 +87,7 @@ module IcalImporter
87
87
  end
88
88
 
89
89
  def frequency_template
90
- @local_event.start_date_time + (@rrule.bounded? * @rrule.interval - 1)
90
+ @local_event.start_date_time.to_i + (@rrule.bounded? * @rrule.interval - 1)
91
91
  end
92
92
 
93
93
  def recur_map
@@ -1,3 +1,3 @@
1
1
  module IcalImporter
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
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.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -158,7 +158,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
158
158
  version: '0'
159
159
  segments:
160
160
  - 0
161
- hash: 2065431849607984661
161
+ hash: -1619132702590462261
162
162
  required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  none: false
164
164
  requirements:
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  version: '0'
168
168
  segments:
169
169
  - 0
170
- hash: 2065431849607984661
170
+ hash: -1619132702590462261
171
171
  requirements: []
172
172
  rubyforge_project:
173
173
  rubygems_version: 1.8.24