現在我們正在使用 icalendar gem 來生成我們通過電子郵件發送的 ics 檔案。
雖然這確實通過電子郵件為用戶提供了一個方便的“添加到我的日歷”按鈕,但它也不會自動將事件添加到用戶的日歷中,因此用戶仍然必須自己執行該手動步驟。
有什么辦法可以使事件自動添加到用戶的日歷中?這一直很難找到解決方案。
def add_calendar_event
@cal = Icalendar::Calendar.new
@cal.event do |e|
e.dtstart = start_time
e.dtend = end_time
e.summary = 'Organized Appointment'
e.organizer = organizer_email
e.attendee = user_email
e.description = 'random string'
e.status = 'CONFIRMED'
end
@ics_var = { mime_type: 'text/calendar; charset=UTF-8; method=REQUEST', content: @cal.to_ical }
end
uj5u.com熱心網友回復:
這需要對日歷有更多的了解。
他們使用.ics檔案作為事件的格式,但日歷要求用戶將這些事件添加到他們的日歷中。
對于純自動化,您必須要求用戶“使用 {Google/Outlook/ETC} 進行身份驗證”并提供“授權對應用程式的讀/寫訪問權限”。
然后,您將能夠自動將事件添加到日歷中。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/419427.html
標籤:
上一篇:Draper::UninferrableDecoratorError(無法推斷裝飾器)
下一篇:如何驗證不可用期間
