1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00
fab-manager/app/controllers/api/ical_controller.rb
2019-11-27 17:05:19 +01:00

19 lines
463 B
Ruby

# frozen_string_literal: true
# API Controller for resources of type iCalendar
class API::IcalController < API::ApiController
respond_to :json
def externals
require 'net/http'
require 'uri'
ics = Net::HTTP.get(URI.parse('https://calendar.google.com/calendar/ical/sylvain%40sleede.com/public/basic.ics'))
require 'icalendar'
require 'icalendar/tzinfo'
cals = Icalendar::Calendar.parse(ics)
@events = cals.first.events
end
end