Sha256: 2b918db1b293394fc6d92c33b9fb28e8bca71483b5936f0ab458124ad93a1974

Contents?: true

Size: 912 Bytes

Versions: 44

Compression:

Stored size: 912 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    module Calendar
      # This class handles how to convert a single meeting to the ICalendar
      # format. It caches its result until the meeting is updated again.
      # This class generates a ICalendar entry for an individual meeting.
      class MeetingCalendar < BaseCalendar
        # Renders the meeting in an ICalendar format. It caches the results in
        # Rails' cache.
        #
        # Returns a String.
        def events
          Rails.cache.fetch(cache_key) do
            MeetingToEvent.new(meeting).to_ical
          end
        end

        private

        alias meeting resource

        # Defines the cache key for the given component.
        #
        # Returns a String.
        def cache_key
          "meetings-calendar-meeting-#{meeting.id}-#{meeting.updated_at.to_i}"
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
decidim-meetings-0.29.1 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.28.4 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.27.9 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.29.0 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.28.3 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.27.8 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.29.0.rc4 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.29.0.rc3 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.29.0.rc2 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.29.0.rc1 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.28.2 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.27.7 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.28.1 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.27.6 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.26.10 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.26.9 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.28.0 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.27.5 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.28.0.rc5 app/services/decidim/meetings/calendar/meeting_calendar.rb
decidim-meetings-0.28.0.rc4 app/services/decidim/meetings/calendar/meeting_calendar.rb