Sha256: 2fbf7459b755bba5e226b05369ae1101ced7a7e78d81b13e10006061de52226e

Contents?: true

Size: 524 Bytes

Versions: 94

Compression:

Stored size: 524 Bytes

Contents

require 'icalendar'

class FeedsController < ApplicationController
  def events
    calendar = Icalendar::Calendar.new
    calendar.x_wr_calname = 'Nexmo Developer Events'

    Event.all.each do |event|
      calendar.event do |e|
        e.dtstart = Icalendar::Values::Date.new(event.starts_at)
        e.dtend = Icalendar::Values::Date.new(event.ends_at + 1.day)
        e.summary = event.title
        e.description = event.description
      end
    end

    calendar.publish
    render plain: calendar.to_ical
  end
end

Version data entries

94 entries across 94 versions & 1 rubygems

Version Path
station-0.5.16 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.5.15 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.5.14 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.5.13 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.5.12 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.5.11 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.5.10 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.5.9 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.5.8 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.5.7 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.5.6 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.5.5 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.5.4 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.5.3 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.5.2 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.5.1 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.5.0 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.4.9 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.4.8 lib/nexmo_developer/app/controllers/feeds_controller.rb
station-0.4.7 lib/nexmo_developer/app/controllers/feeds_controller.rb