mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
19 lines
463 B
Ruby
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 |