2012-02-06 65 views
0

我知道如何解析ICS文件:的iCalendar解析(HTTP)

# Open a file or pass a string to the parser 
    cal_file = File.open("single_event.ics") 

    # Parser returns an array of calendars because a single file 
    # can have multiple calendars. 
    cals = Icalendar.parse(cal_file) 

但我不得不從HTTP URL(例如http://test.com/events.ics)解析ICS。

我該怎麼做?

回答

0

是你在找什麼?

require 'net/http' 
cal_file=(Net::HTTP.get 'test.com', '/single_event.ics') 

cals = Icalendar.parse(cal_file)