Sha256: d685245866dcb541c0d0134ee34df6c54d2a1f3a2619a4288a67b5da08b5c813

Contents?: true

Size: 659 Bytes

Versions: 6

Compression:

Stored size: 659 Bytes

Contents

require 'date'

module FacebookGoogleCalendarSync
  module GoogleCalendarDescription
    DESCRIPTION_PREFIX = "Last known Facebook event update occurred at: "
    DESCRIPTION_MIDDLE = "\nFacebook last checked at: "
    DESCRIPTION_SUFFIX = "\nTo ensure calendar synchronises properly, please do not modify this description."

    def extract_last_modified_date description
      DateTime.strptime(description[DESCRIPTION_PREFIX.size..DESCRIPTION_PREFIX.size+25])
    end

    def create_description last_known_event_update, now
      "#{DESCRIPTION_PREFIX}#{last_known_event_update.to_s}#{DESCRIPTION_MIDDLE}#{now.to_s}#{DESCRIPTION_SUFFIX}"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
facebook-google-calendar-sync-0.2.2 lib/facebook_google_calendar_sync/google_calendar_description.rb
facebook-google-calendar-sync-0.2.1 lib/facebook_google_calendar_sync/google_calendar_description.rb
facebook-google-calendar-sync-0.2.0 lib/facebook_google_calendar_sync/google_calendar_description.rb
facebook-google-calendar-sync-0.1.0 lib/facebook_google_calendar_sync/google_calendar_description.rb
facebook-google-calendar-sync-0.0.2 lib/facebook_google_calendar_sync/google_calendar_description.rb
facebook-google-calendar-sync-0.0.1 lib/facebook_google_calendar_sync/google_calendar_description.rb