Class: IcalImporter::RemoteEvent
- Inherits:
-
Object
- Object
- IcalImporter::RemoteEvent
- Defined in:
- lib/ical_importer/remote_event.rb
Instance Attribute Summary collapse
-
#event ⇒ Object
Returns the value of attribute event.
-
#utc ⇒ Object
(also: #utc?)
Returns the value of attribute utc.
Instance Method Summary collapse
- #all_day_event? ⇒ Boolean
- #end_date_time ⇒ Object
- #event_attributes ⇒ Object
-
#initialize(event) ⇒ RemoteEvent
constructor
A new instance of RemoteEvent.
- #recurrence_id ⇒ Object
- #start_date_time ⇒ Object
Constructor Details
#initialize(event) ⇒ RemoteEvent
Returns a new instance of RemoteEvent.
7 8 9 10 11 12 13 14 |
# File 'lib/ical_importer/remote_event.rb', line 7 def initialize(event) @event = event begin @utc = @event.dtstart.tz_utc rescue @utc = true end end |
Instance Attribute Details
#event ⇒ Object
Returns the value of attribute event.
3 4 5 |
# File 'lib/ical_importer/remote_event.rb', line 3 def event @event end |
#utc ⇒ Object Also known as: utc?
Returns the value of attribute utc.
3 4 5 |
# File 'lib/ical_importer/remote_event.rb', line 3 def utc @utc end |
Instance Method Details
#all_day_event? ⇒ Boolean
28 29 30 31 32 33 34 |
# File 'lib/ical_importer/remote_event.rb', line 28 def all_day_event? begin (Time.parse(end_date_time.to_s) - Time.parse(start_date_time.to_s)) >= 1.day rescue ArgumentError => e # no time info in '', Defaulting to false false end end |
#end_date_time ⇒ Object
20 21 22 |
# File 'lib/ical_importer/remote_event.rb', line 20 def end_date_time get_date_time_for :dtend end |
#event_attributes ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/ical_importer/remote_event.rb', line 36 def event_attributes { :uid => uid.to_s, :title => summary.to_s, :utc => utc?, :description => description.to_s, :location => location.to_s, :start_date_time => start_date_time, :end_date_time => end_date_time, :all_day_event => all_day_event? } end |
#recurrence_id ⇒ Object
24 25 26 |
# File 'lib/ical_importer/remote_event.rb', line 24 def recurrence_id event.recurrence_id ? event.recurrence_id.to_datetime : nil end |
#start_date_time ⇒ Object
16 17 18 |
# File 'lib/ical_importer/remote_event.rb', line 16 def start_date_time get_date_time_for :dtstart end |