Class: Relevant::GoogleCalendar
- Inherits:
-
Object
- Object
- Relevant::GoogleCalendar
- Includes:
- Widget
- Defined in:
- lib/relevant/google_calendar.rb
Constant Summary collapse
- Version =
"0.0.2"
Instance Method Summary collapse
Instance Method Details
#calendar ⇒ Object
55 56 57 |
# File 'lib/relevant/google_calendar.rb', line 55 def calendar @calendar ||= GCal4Ruby::Calendar.find(gcal, :title => [:calendar]).first end |
#events ⇒ Object
59 60 61 62 |
# File 'lib/relevant/google_calendar.rb', line 59 def events = {'start-min' => Date.today.beginning_of_day.utc.xmlschema, 'start-max' => 6.days.from_now.end_of_day.utc.xmlschema, :calendar => calendar.id} @events ||= GCal4Ruby::Event.find(gcal, [:search], ) end |
#events_happening_on(date) ⇒ Object
64 65 66 |
# File 'lib/relevant/google_calendar.rb', line 64 def events_happening_on(date) events.select {|event| event.start_time.to_date <= date && (event.end_time - 1.minute).to_date >= date} end |
#gcal ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/relevant/google_calendar.rb', line 47 def gcal return @gcal if defined?(@gcal) @gcal = GCal4Ruby::Service.new @gcal.authenticate([:username], [:password]) @gcal end |