【问题标题】:Test webcal(iCalendar) url from local server从本地服务器测试 webcal(iCalendar) url
【发布时间】:2017-05-31 09:30:19
【问题描述】:
我在 Rails 中创建了路径,为 i 日历生成 .ics 文件。我如何从本地服务器测试该链接
这是我如何在路径(/api/calendar/)上生成 .ics 文件:
send_data cal.to_ical, filename: file_name, type: "text/calendar; charset=utf-8", disposition: 'attachment'
【问题讨论】:
标签:
ruby-on-rails
icalendar
webcal
【解决方案1】:
这就是我的工作
要获取文件,请使用 curl(在 Linux、macOS 或 Windows 10 上)
curl -v http://localhost/api/calendar/file_name.ics
你会看到
< HTTP/1.1 200 OK
< Date: Mon, 22 Jul 2019 17:52:59 GMT
< Server: Apache/2.4.18 (Ubuntu)
< Content-Length: 648
< Content-Type: text/calendar;charset=UTF-8
<
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
DTSTAMP:20190722T175259Z
SUMMARY:An Event
DTSTART:20190716T131500
DTEND:20190716T191500
END:VEVENT
...etc
你可以保存ics文件
curl http://localhost/api/calendar/file_name.ics -O
尝试在 Mozilla Thunderbird、Apple 日历或 Outlook 等日历应用中打开它,或导入 Google 日历或 Outlook 365