Sha256: 190d6be4e98094fdd259fcfd90696c56edb6b1f1b9dfe8be3e33e2d5701885bd
Contents?: true
Size: 1010 Bytes
Versions: 2
Compression:
Stored size: 1010 Bytes
Contents
require 'date' module FacebookGoogleCalendarSync module Event def convert_event_to_hash ical_event { 'summary' => ical_event.summary, 'start' => date_hash(ical_event.dtstart), 'end' => date_hash(ical_event.dtend), 'iCalUID' => ical_event.uid, 'description' => ical_event.description, 'location' => ical_event.location } end def merge_events google_event, facebook_event google_event.to_hash.merge(convert_event_to_hash(facebook_event)) end def date_of_most_recent_update facebook_events most_recently_modified_event = facebook_events.max{ | event_a, event_b | event_a.last_modified <=> event_b.last_modified } most_recently_modified_event.last_modified end private def date_hash date_time if date_time.instance_of? Date {'date' => date_time.strftime('%Y-%m-%d')} else {'dateTime' => date_time.strftime('%Y-%m-%dT%H:%M:%S.000%:z')} end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
facebook-google-calendar-sync-0.0.2 | lib/facebook_google_calendar_sync/event.rb |
facebook-google-calendar-sync-0.0.1 | lib/facebook_google_calendar_sync/event.rb |