Class: GCal4Ruby::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/ncal2gcal/gcal4ruby_gateway.rb

Instance Method Summary collapse

Instance Method Details

#all_day=(is_all_day) ⇒ Object



18
19
20
21
22
23
# File 'lib/ncal2gcal/gcal4ruby_gateway.rb', line 18

def all_day=(is_all_day)
  if self.end and !(is_all_day == @all_day)
    is_all_day ? self.end=(self.end()+DAY_SECS) :  self.end=(self.end-DAY_SECS)
  end
  @all_day = is_all_day
end

#convert_to_time(t) ⇒ Object



48
49
50
51
52
53
54
55
56
# File 'lib/ncal2gcal/gcal4ruby_gateway.rb', line 48

def convert_to_time(t)
   if t.is_a?String
     return Time.parse(t)      
   elsif t.is_a?Time
     return t
   else
     raise "Time must be either Time or String"
   end
end

#end_timeObject

see end_time=()



40
41
42
43
44
45
46
# File 'lib/ncal2gcal/gcal4ruby_gateway.rb', line 40

def end_time
  if @all_day
    return (self.end-DAY_SECS)
  else
    return self.end()
  end
end

#end_time=(t) ⇒ Object

The event end date and time For all_day-events it is the day, when the event ends (and not the day after as in the google api)



30
31
32
33
34
35
36
37
# File 'lib/ncal2gcal/gcal4ruby_gateway.rb', line 30

def end_time=(t)
  tc = convert_to_time(t)
  if @all_day
    self.end = tc + DAY_SECS
  else
    self.end = tc
  end
end